[sclug] How to find which /dev/xxx a usb device is on?

Dr Adam Trickett adam.trickett at iredale.net
Sat Jun 21 16:46:08 UTC 2008


On Saturday 21 Jun 2008, Alex Butcher wrote:
> On Sat, 21 Jun 2008, Andy Hayward wrote:
> > 2008/6/21 John Stumbles <sclug at yaph.org.uk>:
> >> I'm trying to script mounting usb devices such as digicam memory cards
> >> and a USB external HDD. The digicam card script has a horrible kludge of
> >> code like: 'try /dev/sdc1 ... sdd1? ... sde1? ...' etc until it finds
> >> where the card has popped up on.
> >>
> >> I've now got an external hdd for backup which needs to be mounted
> >> (ideally on bootup but it's encrypted so couldn't go in fstab anyway (or
> >> could it?)).
> >>
> >> Before I redo the 'try this/try that' code can anyone suggest a better
> >> way?
> >
> > Mount using the filesystem UUID instead of giving the device.
>
> Or, hack around with udev so that you get a symlink that points to the
> right device, which'll work even if the filesystem UUID changes (e.g.
> different memory cards).

You don't have to hack udev, you are encouraged to configure it, see my 
Hants-LUG talk:  
http://www.iredale.net/p/by-topic/unix/linux/introduction-to-udev/

-- 
Adam Trickett
Overton, HANTS, UK

A bank is a place where they lend you an umbrella in fair
weather and ask for it back when it begins to rain.
	--  Robert Frost
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://sclug.org.uk/pipermail/sclug/attachments/20080621/6883b2d2/attachment.bin 



More information about the Sclug mailing list