Linux System Restore – Complete Restore of Linux System

backupfedoralinuxrsyncsystem-restore

I am familiar with using rsync to back up various files from my system but what is the best way to completely restore a machine.

What I have tried in the past is:

  1. Do a basic format/reinstall from the Fedora install disks
  2. Make sure networking is enabled
  3. Copy everything from rsync backup over the top of the newly installed system

This way sort of works but I do not think every package that was installed works 100% afterwards.

I want to be able to restore my system with the minimum amount of effort and everything work the same as at the moment the backup was taken. Also if possible install to other machines and essentailly have two machines with the same packages and data.

Best Answer

Here's what I've done (this assumes a single disk, at /dev/sda)

  • use dd to backup the MBR and partition table: "dd bs=512 count=1 if=/dev/sda of=/backups/sda.layout"

  • use rsync to copy the entire thing with something like: "rsync -axvPH --numeric-ids ..."

On restore I do this:

  • boot the target machine with sysrescuecd, I will typically have the 'sda.layout' file on a USB stick.

  • restore the MBR/partition table with dd: "dd bs=512 count=1 if=/path/to/sda.layout of=/dev/sda"

  • Use partprobe (thanks commenter Mark) to get the kernel to re-read the partition table.

  • Mount all the various partions under /restore/. I make the mount points identical under restore, so if I have /boot, /var on my source, I end up with /restore/boot, /restore/var, etc.

  • use rsync to restore the entire thing.

Related Topic