sdc suddently sdd?

Phil Meyer pmeyer at themeyerfarm.com
Fri Dec 29 16:59:34 UTC 2006


Tom Horsley wrote:
> I just realized that sometime fairly recently my usb2
> drive I use for backups has stopped showing up as
> /dev/sdc and instead shows up as /dev/sdd (with no
> device named /dev/sdc anywhere).
>
> Wah happened?
>
> How can I reliably mount my backup drive on /backup
> if the device name changes at random?
>
> Hopefully my fixed disks will at least stay sda
> and sdb?
>
>   

A bit of udev rules tweaking will cure this.  A udev rules editor is in 
the works, as I understand things, but for now its just a little grunt 
work.  The rules will apply going forward, so just copy the new rules 
file to an upgraded or new system and you are good to go.

make sure you have usbutils installed -- it is not by default.

# yum install usbutils

# lsusb

The goal with lsusb is to identify the vendor and device numbers for 
your drive.

Some external enclosures have their own UDB hub, so they show up twice.  
My WD does:

 -> sudo lsusb
Password:
Bus 003 Device 002: ID 050d:0109 Belkin Components F5U109/F5U409 PDA Adapter
Bus 003 Device 001: ID 0000:0000 
Bus 001 Device 001: ID 0000:0000 
Bus 004 Device 001: ID 0000:0000 
Bus 004 Device 002: ID 046d:c03f Logitech, Inc.
Bus 005 Device 001: ID 0000:0000 
Bus 005 Device 003: ID 1058:0500 Western Digital Technologies, Inc.
Bus 005 Device 005: ID 1058:0404 Western Digital Technologies, Inc.
Bus 005 Device 002: ID 413c:a005 Dell Computer Corp.
Bus 002 Device 001: ID 0000:0000 

What I need are the values for the disk.  In my case its either 
1058:0500 or 1058:0404.

To tell, I have to do a lsusb -v

That gives me WAY more info than I want, but run it to a temp file.  I 
know what I am looking for, because I have the numbers.

# lsusb -v > /tmp/moo
# vi /tmp/moo

search for those two numbers.  One will say hub (or nothing), and one 
will say disk (look for iProduct a few lines after the number).

Ok, so now I have the number that lsusb gave me.

# vi /etc/udev/rules.d/65-local.rules

add:

# Western Digital 320GB External
SYSFS{idVendor}=="1058", SYSFS{idProduct}=="0404", SYMLINK+="big%n"

Now whenever the drive is connected a link is made to /dev/big(n)

Now edit /etc/fstab:

/dev/big1               /data1                  ext3    defaults        0 0

Alternatively, use the automounter so that the system doesn't complain 
coming up if the drive is not there.

add a line to /etc/auto.master:

/-      /etc/auto.big

then create /etc/auto.big

# External USB
/data1    -fstype=ext3    :/dev/big1

Restart the automounter:

# service autofs restart

hal may mount it a second time, but hey, its mounted where I want it AND 
where hal wants it. :)

All done.

Of course 'big' and 'data' are arbitrary :)

I believe that this will be the 'correct' method going forward.  A tool 
will scan your USB devices, and create the rules file for you.  For now, 
its a 5 minute job.

Good luck!




More information about the fedora-list mailing list