The addition of the second USB drive, however, has exacerbated an annoyance that I've suffered since setting this system up: the challenge of configuring consistent mount points. The USB drives appear as SCSI drives to Ubuntu, and therefore show up as /dev/sd* in the /dev hierarchy. Although Ubuntu magically handles recognition of the drives as they are plugged in or unplugged from the server, the drives don't consistently show up as a particular sd* device. I don't often unplug these drives, but when I do and then plug them back in (or when the system has been restarted), I have to hunt around the /dev directory, find the correct sd* device, and then manually mount the drive. With one drive, I could easily tell which sd* device had just been added to the system: with two, it became troublesome enough that I searched for some better way to handle my USB drives.
Luckily, I quickly stumbled on this howto article describing a hierarchy under /dev that I've never explored before: /dev/disk (argh!). In a nutshell, labels and other identifiers associated with filesystems on attached drives can be used to consistently reference those drive and mount them. Better yet, I discovered that the volume label on my FAT32 drives was automatically recognized, making the mounting operation as simple as shown by the example below:
mount/dev/disk/by-label/jukebox/mnt/jukeboxSince the drives can be referenced in a consistent manner, I've *finally* been able to add them in fstab, making mount and umount operations *much* easier to deal with!
After you told me about this I was trying to find out if my box had the by-disk devices and came across a posting claiming that by-label was 'broken by design'. Instead, they suggested using LABEL=mylabel in fstab instead of /dev/sd??.
ReplyDeleteLink: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514209
ReplyDeleteInteresting... I like the simpler LABEL syntax, but was worried that it may not be supported in Ubuntu (the post discusses a Debian system). I know Ubuntu is based on Debian, and a quick search turned up this Ubuntu help page for fstab:
ReplyDeletehttps://help.ubuntu.com/community/Fstab
Looks like Ubuntu does support the LABEL syntax in fstab, and I've tweaked my fstab file to use LABEL. Thanks, Jeff!