Thursday Night

Paul Betts’s personal website / blog / what-have-you

md Arrays and Feisty – A lesson in why I’m glad I have a backup plan

comments

I upgraded my desktop to Ubuntu Feisty Fawn yesterday; it took forever now that I only have crappy DSL internet, but it finally finished. I noticed some strange RAID errors from md (the Linux Software RAID driver), but I wrote them off as typical “upgrading to beta OS” noise. After it was done and I rebooted, I noticed some really strange problems, like Firefox and Evolution being broken, as well as my Beryl theme disappearing. I then went to look at my /docs folder, where I keep my Email to see if Evolution had overwritten it. Imagine my surprise when I found out that the RAID-1 array which I keep my documents (as well as the Firefox and Beryl config folders) under had been massively corrupted.

Luckily, I have an exact copy of this folder on my laptop, so a simple mkfs && rsync -avlzp did the trick. But here’s the lesson: Always have a backup of your important documents on another machine. Always. Even if they’re in RAID-1, that doesn’t protect you from filesystem corruption or accidental deletion. Especially before you do an OS upgrade; this is the first time I’ve had filesystem corruption in years, but it can happen, and losing your stuff sucks a lot.

Microsoft is gonna make this a lot easier for Windows users because they’re releasing a new product called Windows Home Server that’ll make automatic backups really easy. They’ve got what is basically LVM hinted for data integrity so you can just keep throwing drives in it to expand the space. In Linux of course, it’s easy too: Just move everything you want to keep safe into one folder (I call it /docs), then create symlinks to important folders:

cd ~
sudo mkdir -p /docs/$USER && sudo chown "$USER:users" /docs/$USER
evolution –force-shutdown
mv .evolution /docs/$USER/evolution && ln -s /docs/$USER/evolution ~/.evolution
ln -s /docs/$USER ~/Documents

Then to do a backup to a remote machine:

rsync -avlzp –delete /docs/ root@some_other_machine:/docs/

Now if you’re clever, you’ll set this up in a cron job using sudo crontab -e, but you need to set up SSH keys to do this (ie, after you set this up when you ssh to some_other_machine, it shouldn’t prompt you with a password). This site should help you do it.

Written by Paul Betts

March 15th, 2007 at 1:20 pm

Posted in Linux, Microsoft

Leave a Reply