Renaming USB device

Warren Block wblock at wonkity.com
Wed Nov 11 01:02:48 UTC 2009


On Wed, 11 Nov 2009, Polytropon wrote:
> On Tue, 10 Nov 2009 17:19:39 -0600, Peter Steele <psteele at maxiscale.com> wrote:
>> When a system has a USB drive present, the system typically
>> names it /dev/da0. However, if the system has SATA drives
>> hooked to an LSI controller, or if the system has SCSI drives,
>> the same drive prefix is used as is for the USB drive.
>
>> I realize this is something that likely has to be done in the
>> form of a kernel patch, but the question is can it be easily
>> done?
>
> A kernel patch isn't needed and would surely break many working
> subsystems. An option is to use aliases through the means of
> /etc/devfs.conf, e. g.
>
> 	link	da3	usbdisk0

That's fragile for dynamic devices; da3 might not be da3 next time it's 
attached.  You can create a link on device detection through devd.conf 
using ln.  It's also necessary to manually set owner and permissions, 
since devfs.conf settings aren't applied.  Thread about that here:

http://docs.freebsd.org/cgi/getmsg.cgi?fetch=4340+0+archive/2009/freebsd-current/20091101.freebsd-current

> or, if you want to enter the field of partition names in /etc/fstab,
> refer to the disks by their labels, so you don't need to know
> which da device a certain disk or USB stick actually is - it
> gives you independance from the order of detection by the
> system (first detected, first device name).

Labels are an excellent solution in this case.

-Warren Block * Rapid City, South Dakota USA


More information about the freebsd-questions mailing list