0

Apologies if this has already been answered before, but I didn't see an answer to this question.

I want to upgrade my Debian 10 system to release 11. As such, I want to make a full backup so I can recover, in case something glitches during the upgrade.

My system's disk partitioning is very simple. A swap partition and a large root file system containing everything.

As such, I am thinking that a simple backup approach would be to mount an external drive (via USB, probably), and run tar (with a few options for compression) to back up the root file system, telling it to exclude the backup device's mount point (to avoid infinite recursion).

Then if I need to restore, I can boot a live image, reformat the storage and use tar to copy everything back, probably running grub afterward in order to make it bootable.

Does this sound reasonable? Or am I going to create a mess that will be hard to recover from?

If the latter, what is the best common practice to make a whole-system backup, such that I can simply restore it onto a newly-erased system in order to recover from a disaster?

2 Answers 2

1

Its both reasonable and could create a mess because of bootloader issues, partitioning issues etc.

For simplicity and comprehensiveness I might follow a different approach as follows:

  1. (Optional to save space and only applicable if not using full disk encryption and if you intend to compress backup) fill the disk to backup with a file comprising 0's. You can dd /dev/null to a file until it errors. Then delete file.

  2. Boot off a pendrive or similar (so you are not working on a live filesystem.

  3. Backup the entire block device of the hdd to a usb image. You can pipe it through gzip to compress it. (If you dont compress it you can mount it later on as a filesystem to get individual files back)

0

Your idea would probably work and has the advantage of creating browsable archives, but it also has drawbacks: you get a "copy over time" rather than at a single point in time and the burden of restoring partitioning and boot configuration is on you.

For such scenarios I like to use Clonezilla - precisely because it's fully automated and relatively foolproof. You can run Clonezilla from USB and let it take a snapshot of your disk (by the way, use multithreaded zstd compression for best performance andfinal size). The image will be smaller than dd would produce because unused disk areas won't be included in the disk image. Restoring is similar: boot Clonezilla, select disk, select disk image, wait for it to finish. Restored system should be immediately bootable.

Clonezilla's images aren't browsable because it's not the point of the tool, but you can read disk's partition layout and restore individual partitions using partclone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .