Hetzner is a nice, cheap host for server. Unfortunately they do not let you download backups and snapshots of cloud servers locally. So you are kind of locked in with them.
Here is how I create full disk backups for e.g. standard CX11 servers with default images.
Make sure you understand everything before you attempt this. Pay special attention to your own partitions and make sure you archive what you really need. Consider imaging the whole device instead of just a partition.
Create a backup
- Create a new snapshot of your server
- Create a new server from it
- Boot said server in rescue mode
- Use good old
dd
andgzip
to image the main disk to a local archive ssh root@SERVERIP "dd if=/dev/sda1 bs=1M status=progress | gzip -" | dd of=SERVERIP.sda1.dd.gz bs=1M
- The
bs=1M
is fairly random by me, worked well, didn’t care to optimize gzip
(with the default compression level) kind of maxed out the server CPU but still enabled me to almost max out my download bandwidth. Of course the ratio between remote CPU compression speed vs download bandwidth depends on your specific situation. You might want to usexz
orzstd
instead.
- The
- Don’t be stupid, do it twice and compare the checksums
If you do not need your server to be live during backup, you can skip the snapshotting and second server of course, just boot your server in rescue mode instead.
Build a new server from a backup
- Create a new server using the same or a similar configuration as the backed up one
- Boot said server in rescue mode
cat SERVERIP.sda1.dd.gz | ssh root@SERVERIP "gunzip -c | dd of=/dev/sda1 bs=1M status=progress conv=fsync"
- Reboot to leave rescue mode
If you want to restore your server because of a breakage, just boot it into rescue mode and do the same as above otherwise.