Hard drive backups

My reliable-so-far computer has been making a “tick tick” sound in the fan recently. I’ve never been one to keep backups of my personal work, but doing freelance work for the past year and a half has made me a bit paranoid about losing my personal and work data. Time to backup!

Jamie Zawinski’s backup PSA is my favorite document about backing up data. So I ordered one of the new hybrid drives mentoned on Coding Horror and got it in the mail a few days ago.

I’ve copied disks using dd in the past, but it’s silent output always leaves me concerned. This time I went with Clonezilla Live, a simple-to-use Debian-based live CD whose sole purpose is to duplicate disks. Easy!

My next little hurdle was when I put in my hybrid drive and put the old drive into an external enclosure. My machine booted fine, but when I plugged in the external disk, it wouldn’t mount. Ubuntu 10.10 was attempting to mount the external disk to the root of the filesystem. This line in /etc/fstab was the culprit:

# <file system>  <mount point>   <type>  <options>         <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=<some-uuid> /               ext4    errors=remount-ro 0       1

The first change I had to make was to change the UUID on the external disk. I used the following command to do so:

tune2fs -U random /dev/sdb1

Then, I updated the fstab like so:

# <file system> <mount point>   <type>  <options>                         <dump>  <pass>
UUID=<new-uuid> /media/backup   ext4    user,nobootwait,errors=remount-ro 0       2

The external now mounts to /media/backup, is mountable automatically by ubuntu since the user option is set, and fsck will check the drive last since pass is now set to 2. nobootwait prevents the machine from booting if the disk is not present.

I dropped this in a file, and now I have an easy command to backup to a bootable drive!

#!/bin/sh
sudo rsync -vaxE --delete --ignore-errors / /media/backup/
This entry was posted in Computing. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *