3

I keep a backup of my settings and files using:

sudo rsync --verbose --recursive --links --perms / /media/backup/

Is it possible to use rsync (or other bash options) to make a bootable backup of everything? I just want to "clone" everything to a pendrive or another disk and be able to work with the exact same enviroment. And I mean everything, like it was on the original disk (from permissions to installed apps, configs, paths).

I don't really trust GUI's to do this kind of job so I'm avoiding anything from the store.

1

1 Answer 1

3

After rsync, you need to install grub on the drive, and fix /etc/fstab to point to the new volume uuid ( see blkid ), then chroot into the drive and run update-grub to update grub.cfg with the new uuid, then make sure these changes do not get reversed by any future rsyncs you do.

As an alternative, you could just install grub and rsync away, and whenever you actually need to boot the system, press e at the grub menu to edit the entry, and manually fix the root= argument to point to the other disk instead of the original.

More specifically:

#assuming /target is where you have the new drive you rsynced to
# is mounted, and you are running as root ( sudo -s )
#bind mount needed run time filesystems into /target
for f in sys dev proc dev/pts run ; do mount --bind /$f /target/$f
#chroot into target
chroot /target
#install and update grub ( assuming bios boot, not EFI )
dpkg-reconfigure grub-pc
#at the prompt, choose to install grub to the new disk
5
  • Could you please also include the steps?
    – Starx
    Nov 26, 2013 at 6:18
  • When I tried t run update-grub it gave /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
    – Starx
    Nov 26, 2013 at 8:32
  • yes, a step-by-step guide for noobies like me would be amazing!
    – Matt
    Dec 2, 2016 at 6:03
  • @Starx, updated
    – psusi
    Jan 16, 2017 at 3:26
  • @Matt, updated...
    – psusi
    Jan 16, 2017 at 3:27

You must log in to answer this question.

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