Skip to content

Instantly share code, notes, and snippets.

@cabrinha
Last active August 29, 2015 14:17
Show Gist options
  • Save cabrinha/cdc87b8341c630f4ef8c to your computer and use it in GitHub Desktop.
Save cabrinha/cdc87b8341c630f4ef8c to your computer and use it in GitHub Desktop.
Bootable, Redundant Backup?
sfdisk -d /dev/sda > part_table
sfdisk /dev/sdb < part_table --force
reboot
grub-install --recheck --root-directory=/backup /dev/sdb
mkfs.ext4 /dev/sdb1,2,5 (sdb3 is swap, sdb4 is "Extended")
[root@testbox ~]# mkdir /backup
[root@testbox ~]# mkdir /backup/boot
[root@testbox ~]# mkdir /backup/home
[root@testbox ~]# mount /dev/sdb1 /backup/boot -t ext4
[root@testbox ~]# mount /dev/sdb2 /backup -t ext4
[root@testbox ~]# mount /dev/sdb5 /backup/home -t ext4
[root@testbox ~]# mount -o bind -t proc /proc /backup/proc/
[root@testbox ~]# mount -o bind -t dev /dev /backup/dev/
[root@testbox ~]# mount -o bind -t sysfs /sys /backup/sys/
rsync -aAXv --progress --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* /backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment