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

Alex Butcher lug at assursys.co.uk
Sat Jun 21 16:34:32 UTC 2008


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).

> -- ach

HTH,
Alex.
-- 
Alex Butcher, Bristol UK.                           PGP/GnuPG ID:0x5010dbff

"[T]he whole point about the reason why I think it is important we go for
identity cards and an identity database today is that identity fraud and
abuse is a major, major problem. Now the civil liberties aspect of it, look
it is a view, I don't personally think it matters very much."
  - Tony Blair, 6 June 2006 <http://www.number-10.gov.uk/output/Page9566.asp>



More information about the Sclug mailing list