![]() |
hard drive device assignment - question
Can someone give a basic description of how linux assigns drive letters?
I understand that a drive letter assignment is not static. If I add a drive between /dev/sda and /dev/sdb, my /dev/sdb will become /dev/sdc and the new drive will become /dev/sdb. I have a hot swap tray and have come into some unexpected behavior. I removed /dev/sde from the hot swap tray and then loaded another drive into this same tray. When I mounted the new drive with options in fstab, it wouldn't mount because the new drive was /dev/sdf, not /dev/sde. Apparently, linux is looking at the id of the drive in addition to it's place in the BIOS chain. My fstab entry is: /dev/sde /backups auto noauto,rw,noexec,async,user 0 0 I was avoiding using UUIDs in the fstab so that new HDDs would not have to be "registered" in the fstab prior to use. Is there a way to tell linux (or fstab) whatever drive is plugged into SATA channel X mount to /mountpoint? Thanks, WT |
udev. Writing udev rules is slightly outdated (the udevadm command has replaced some of the commands shown) but is the best guide I know of.
|
I'm answering my own questions so others know the answer:
udev is not necessary. tree /dev/disk will list not only the disks by id and UUID, but also by hardware path. Next add a line to your fstab similar to: /dev/disk/by-path/pci-0000:03:00.0-scsi-1:0:0:0-part1 /backups auto noauto,user,noexec,rw,async 0 0 The entry will always mount the disk connected to the specified scsi port to backups. Note the -part1 for partition number. Best, WT |
Quote:
It wasn't necessary (in this case) for you to write your own udev rules - different thing altogether. by-path is handy in situations, but by being so specific (bus, port ...) can be a PITA also. Another option for you might be to label all your backup filesystems the same name (say BACKUP). Single line in fstab for that LABEL - then when you plug any of those disks in, they mount as above. Won't work if you ever try to plug two in at once of course ... |
Thanks for sharing wjtaylor; that tree /dev/disk is a neat technique :)
|
| All times are GMT -5. The time now is 09:39 PM. |