Matthew Gregan wrote:

At 2004-08-31T16:43:54+1200, Steve Holdoway wrote:


Just been to a customer who uses pen usb devices for backup of
specific data. Their devices ended up as /dev/sde1 and /dev/sdf1...
different ones for different makes of pen device.



The first time the kernel sees a unique device attach, it will assign it a device node (e.g. /dev/sdb). If you remove the device and plug it in again later, it will usually be assigned to the same device node.

However, there are a bunch of conditions where this will not be the
case, so you can't rely on it.



My worry is that they will reset after a reboot, and start counting
from sda1 ( well sdb1 in this case as there's a scsi disk in there). I
hope not!



The kernel will use the first appropriate free device node, so after a reboot it will begin at /dev/sdb or whatever is the first free SCSI disk device node. Your worry is real and your backup script should deal with it.

I suggest you look into a reliable method to identify the newly attached
USB storage device.  Since you've mentioned that you're running a 2.6
kernel, your best bet is udev[0].

udev is similar to what devfs was, but is almost completely done in
userspace and allows you a large amount of control over the name of the
device node that an attached device is assigned, and does so in a way
that guarantees the device will always be assigned the specified name.

[0] http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ

Cheers,
-mjg


Thanks for that. I'll play with this at work tomorrow (:

Steve

Reply via email to