[ale] flash ddrives (2)
Brian Pitts
bpitts at learnlink.emory.edu
Thu Dec 14 11:35:57 EST 2006
Instead of mounting by physical location, you could specify the UUID or
label. Find them with
ls /dev/disk/by-label -lah
ls /dev/disk/by-uuid -lah
You need to reformat or use mtools to specify the label on a FAT device.
e2label can do it for ext2/3.
In your fstab you would specify LABEL=<label> or UUID=<uuid> instead of
/dev/<DEVICENODE>.
Or you could use udev to specify a persistent device node for each
device based on a unique attribute.
First find a device's attributes with udevinfo -a -p `udevinfo -q path
-n /dev/<DEVICENODE>`
Then find one that's unique. For example, with my USB key at
/devices/pci0000:00/0000:00:02.2/usb3/3-3 I find the value
SYSFS{serial}=="6E530B001BE7"
Now you'd want to create a file with this rule in /etc/udev/rules.d/ .
The numbers in the file names are treated similarly to the those in
/etc/init.d; lower means sooner. For example
vim /etc/udev/rules.d/10-mystorage.rules
Now You could add a rule, in my case I might add
SYSFS{serial}=="6E530B001BE7", KERNEL=="sd?1", NAME="usbkey"
This would say that if a device with that serial is the first partition
anywhere on the scsci bus create a device node for it at /dev/usbkey.
Now restart udev with /etc/init.d/udev restart
and edit your fstab to refer to the new device node.
I hope that's helpful.
-Brian
More information about the Ale
mailing list