View previous topic :: View next topic |
Author |
Message |
solamour l33t
Joined: 21 Dec 2004 Posts: 698 Location: San Diego, CA
|
Posted: Fri Nov 16, 2012 6:09 pm Post subject: [Solved] Assign specific device ID to USB external disk |
|
|
I have 2 USB external disks: Seagate and WD.
Code: | $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 125: ID 1058:1021 Western Digital Technologies, Inc. Elements 2TB
Bus 001 Device 013: ID 0bc2:3320 Seagate RSS LLC
|
Seagate was plugged in first, so it is recognized as /dev/sdb, while WD is /dev/sdc. The problem is, whenever I reboot, depending on which one gets recognized first, the drive IDs get switched (i.e. WD gets /dev/sdb, and Seagate gets /dev/sdc), and that messes up my backup scripts.
How do I always assign /dev/sdb to Seagate no matter which one gets plugged first? I think it has something to do with udev rules (because that's how network adapters are done), but I'm not sure how to proceed from here. I'd appreciate any suggestions.
__
sol
Last edited by solamour on Sun Nov 18, 2012 5:34 am; edited 1 time in total |
|
Back to top |
|
|
gabrielg Tux's lil' helper
Joined: 16 Nov 2012 Posts: 134
|
Posted: Fri Nov 16, 2012 6:22 pm Post subject: |
|
|
I believe that you can play with udev's rules, but I never tried it.
I'm not sure what your problem is, but what I do to overcome the order in which external drives are selected is by using labels (tune2fs /dev/partition -L nameoflabel) and then using that in /etc/fstab, for example:
Code: |
LABEL=nameoflabel /path/to/mountpoint ext4 [your options] 0 0
|
All this, assuming you use ext4, perhaps it works with vfat and friends, haven't tried it. |
|
Back to top |
|
|
solamour l33t
Joined: 21 Dec 2004 Posts: 698 Location: San Diego, CA
|
Posted: Fri Nov 16, 2012 6:30 pm Post subject: |
|
|
Use the label of the disk... clever. Will try. Thanks.
__
sol |
|
Back to top |
|
|
Adel Ahmed Veteran
Joined: 21 Sep 2012 Posts: 1523
|
|
Back to top |
|
|
solamour l33t
Joined: 21 Dec 2004 Posts: 698 Location: San Diego, CA
|
Posted: Sun Nov 18, 2012 5:33 am Post subject: |
|
|
After trying a few different methods,
1) Use the label of the disk.
2) Add "udev" entry (https://wiki.archlinux.org/index.php/Map_Custom_Device_Entries_with_udev).
3) Use UUID in /etc/fstab.
I ended up with the UUID method. No particular reason, and other methods worked equally well. Thank you everyone for taking time to share your suggestions.
__
sol |
|
Back to top |
|
|
|