Personal computing discussed

Moderators: SecretSquirrel, notfred

 
bthylafh
Grand Gerbil Poohbah
Topic Author
Posts: 3735
Joined: Mon Dec 29, 2003 11:55 pm
Location: Southwest Missouri, USA

udev for hot-swapping eSATA drives

Mon Apr 13, 2009 11:58 am

I have an eSATA drive cradle hooked up to an Ubuntu 8.10 system. I want to write a udev rule such that any drive plugged into the cradle will have the same device name (it boots as /dev/sdb) and preferably the same /dev/sg* device as well. Hot-swap is working at the moment, but if I unplug one drive and plug in another, it gets a new devname (/dev/sde) and a different /dev/sg device.

Any suggestions?
Hakkaa päälle!
i5-2500K@4.3|Asus P8P67-LE|8GB DDR3-1600|Powercolor R7850 2G|SanDisk Ultra II 480GB|1988 Model M|Saitek X-45|Logitech MX 518 & F310|Dell 2209WA|Sennheiser PC151|Asus Xonar DX
 
notfred
Maximum Gerbil
Posts: 4223
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: udev for hot-swapping eSATA drives

Mon Apr 13, 2009 12:40 pm

When you hotswap is anything else already grabbing later devices? I wonder if you end up with sde as something else already has sdc and sdd (Optical drives, card readers etc).

I'm running Ubuntu 8.10 and I see /etc/udev/rules.d/61-persistent-storage-edd.rules that does hook up disks to /dev/disk/by-id/<blah> based on their id, although this is kind of the opposite of what you are looking for in that different disks will get farmed out to different paths, but at least the same disk always gets farmed out to the same path regardless of what /dev/sd<blah> it is. The network and CD stuff in 70-persistent-net.rules 70-persistent-cd.rules and their generators at 75-cd-aliases-generator.rules 75-persistent-net-generator.rules might be closer to what you are looking for, especially the network one.
 
bthylafh
Grand Gerbil Poohbah
Topic Author
Posts: 3735
Joined: Mon Dec 29, 2003 11:55 pm
Location: Southwest Missouri, USA

Re: udev for hot-swapping eSATA drives

Mon Apr 13, 2009 12:48 pm

notfred wrote:
When you hotswap is anything else already grabbing later devices? I wonder if you end up with sde as something else already has sdc and sdd (Optical drives, card readers etc).


This computer's got two hard drives in sdc and sdd, which are in a software RAID 1; sda is the boot drive. The two optical drives seem to be scd0 and scd1. The eSATA device is sdb on bootup.

I'm running Ubuntu 8.10 and I see /etc/udev/rules.d/61-persistent-storage-edd.rules that does hook up disks to /dev/disk/by-id/<blah> based on their id, although this is kind of the opposite of what you are looking for in that different disks will get farmed out to different paths, but at least the same disk always gets farmed out to the same path regardless of what /dev/sd<blah> it is. The network and CD stuff in 70-persistent-net.rules 70-persistent-cd.rules and their generators at 75-cd-aliases-generator.rules 75-persistent-net-generator.rules might be closer to what you are looking for, especially the network one.


OK, I'll have a look.
Hakkaa päälle!
i5-2500K@4.3|Asus P8P67-LE|8GB DDR3-1600|Powercolor R7850 2G|SanDisk Ultra II 480GB|1988 Model M|Saitek X-45|Logitech MX 518 & F310|Dell 2209WA|Sennheiser PC151|Asus Xonar DX
 
bthylafh
Grand Gerbil Poohbah
Topic Author
Posts: 3735
Joined: Mon Dec 29, 2003 11:55 pm
Location: Southwest Missouri, USA

Re: udev for hot-swapping eSATA drives

Mon Apr 13, 2009 1:52 pm

There's a utility called PySDM that can customize udev rules. I'm going to try that out.
Hakkaa päälle!
i5-2500K@4.3|Asus P8P67-LE|8GB DDR3-1600|Powercolor R7850 2G|SanDisk Ultra II 480GB|1988 Model M|Saitek X-45|Logitech MX 518 & F310|Dell 2209WA|Sennheiser PC151|Asus Xonar DX
 
bthylafh
Grand Gerbil Poohbah
Topic Author
Posts: 3735
Joined: Mon Dec 29, 2003 11:55 pm
Location: Southwest Missouri, USA

Re: udev for hot-swapping eSATA drives

Mon Apr 13, 2009 3:09 pm

It fails horribly, will start up but the window is grayed out and doesn't display anything. Pity.
Hakkaa päälle!
i5-2500K@4.3|Asus P8P67-LE|8GB DDR3-1600|Powercolor R7850 2G|SanDisk Ultra II 480GB|1988 Model M|Saitek X-45|Logitech MX 518 & F310|Dell 2209WA|Sennheiser PC151|Asus Xonar DX

Who is online

Users browsing this forum: No registered users and 4 guests