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
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 3Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders
- 4Red Hat Enterprise Linux 7 Finally Hits the Big Time
- 5Linux Top 3: Tails 1.0, OpenMandriva Lx 2014.0 and Debian 7.5