Wednesday, July 18th, 2012, 6:44 pm
Backing Up Bootloader and Home Directories Over the Network
ackups that are robust and resistant to disasters like fire should be distributed. Backing up by writing to external drives is good, but it is not sufficient. Here is how I back up my main machine. Backup is quick in a smaller number of rather large files (not too large as some file systems cannot cope with those), so one trick goes like this:
sudo mkdir /media/backupdrive/`date +%Y-%m-%d` # (if disk space permits, or via external mounted drive for another safety net) sudo tar -cf - /home/|split -b 1000m - /media/backupdrive/`date +%Y-%m-%d`/Home-`date +%Y-%m-%d`.tar.
This includes all the hidden files.
To reassemble:
cat *|tar -xf
this is then scp
‘d or rsync
‘d over to another box based on a wildcard or directory like
/media/backupdrive/`date +%Y-%m-%d`
This leaves a stack of backups in case the latest one is already ‘contaminated’. rsync
of the original files, uncompressed and untar
red, can be fast except for the first time, but for a stack of backups it’s not suitable.
But more files need to be backed up, depending on the bootloader for instance.
MBR backup and restore is done with dd
:
dd if=/dev/sdX of=/tmp/sda-mbr.bin bs=512 count=1 dd if= sda-mbr.bin of=/dev/sdX bs=1 count=64 skip=446 seek=446
If this is saved to the home directory, then it’s included in the main backup.