Linux Backups For Real People, Part 1 - page 3
Backup HardwareDepending on how your particular flavor of Linux has customized
udev, it is possible that removable USB devices won't always be assigned the same names when you plug them in. You need them to always be the same when you run backup programs. The correct way is to configure
udevto handle this. Ubuntu, Fedora, Red Hat, Mandriva, PCLinuxOS, and doubtless many more have an easy way to control this: simply add a unique device label to your backup partition. For example, suppose you're using a Compact Flash card for your backups. You'll need the tools specific to your filesystem to do this, so for FAT16/32 fetch the
mtoolspackage. First add an entry like this to
/etc/mtools.confto map a Windows-style drive letter to your filesystem. You may use any letter:
# Lexar compact flash drive u: file="/dev/sdc1"
Then create your new device label:
# mlabel u: Volume has no label Enter the new volume label : backup1
$ mlabel -s u: Volume label is BACKUP1
Now when you plug in your Compact Flash card it will automatically be mounted at
/media/BACKUP1. (Sorry, I don't know how to make MS-DOS disklabels not shout at you; you're stuck with uppercase.)
Update: Robyn Willson tells how to make DOS disklabels in lowercase using mkfs:
# mkfs.vfat -n labelname /dev/sdb1
-n is the option for volume name and labelname is the disklabel in lowercase.
What if your particular flavor of Linux does not do this? Writing good
udev rules is something we'll cover in detail soon, so in the meanwhile you can resort to good old
/etc/fstab. First create the
/media/backup1 directory, then make an entry in
/etc/fstab like this:
# Lexar 2G compact flash, backup1 LABEL=BACKUP1 /media/backup1 vfat user,noatime,noauto,rw,dev,exec,suid 0 0
You'll have to mount it manually. Any user should be able to mount and unmount the device like this:
$ mount /media/backup1 $ umount /media/backup1
Don't worry, our ace backup scheme can handle this with ease. Come back next week to find out how.
- man udev
- man mlabel
- Writing udev rules
Sponsored by BlackBerry
BlackBerry® Enterprise Server Express enables businesses of any size to quickly and easily get started with the BlackBerry solution. It provides advanced BlackBerry smartphone features with no additional software or user license fees, and works with any Internet-enabled BlackBerry data plan or a BlackBerry enterprise data plan. Download now!