Nov 1, 2014

Backing up a drive on a Ubuntu

One time backup and restore

Just ran out of room on my tiny SSD, so figuring out a migration path using rsync archive mode.  Mounted the SSD on my  Mounted a large HDD from the bygone era for temporary storage, and began copy:

rsync -a /media/henry/<SSD folder> /media/henry/<HDD folder>
Since the SSD is mounted on USB, rsync goes on for a couple of hours.

Copying from the HDD to another, bigger drive should work just like above (but in reverse direction of course):

rsync -a /media/henry/<HDD folder>/. /media/henry/<new SSD folder>

Incremental backup 

Restrict rootfs backup to skip kernel generated fs, and backup the /mnt separately.  The script to run in the backup folder is then is then

sudo cp -al latest `date +%F`

sudo rsync -aAX --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / latest/rootfs

sudo rsync -aAX --delete /mnt/opt latest

sudo rsync -aAX --delete --exclude={"*.vdi"} /mnt/work latest

I omit the Virtualbox guest's virtual HDD from the backup set, because that file changes every time, and is large.


No comments:

Post a Comment