D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Mounting USB external hard drive with same device every time?

 

Rob Beard wrote:
> Hi folks,
> 
> I was hoping someone could help with something I am stuck on at the moment.
> 
> I have tried Google and I read up something about UDEV rules.  I have 
> tried creating a rule and placing it in /etc/udev (I called it 
> freecombackupdevice.rules) although when I reconnect the drive is is 
> automatically mounted to /media/drive_label whereas I actually want it 
> to mount to /mnt/backup.
> 

Yea udeu rules are the way forward.

Try creating rules for the scsi subsystem layer not the usb layer as i
think the usb layer is too low to be meaningful to a block level file
system.

The relevant output is

   looking at device
'/devices/pci0000:00/0000:00:02.2/usb3/3-1/3-1:1.0/host17/target17:0:0/17:0:0:0':
     ID=="17:0:0:0"
     BUS=="scsi"
     DRIVER=="sd"
     SYSFS{ioerr_cnt}=="0x0"
     SYSFS{iodone_cnt}=="0x2d"
     SYSFS{iorequest_cnt}=="0x2d"
     SYSFS{iocounterbits}=="32"
     SYSFS{timeout}=="30"
     SYSFS{state}=="running"
     SYSFS{rev}=="0000"
     SYSFS{model}=="MHV2080AH       "
     SYSFS{vendor}=="FUJITSU "
     SYSFS{scsi_level}=="3"
     SYSFS{type}=="0"
     SYSFS{queue_type}=="none"
     SYSFS{queue_depth}=="1"
     SYSFS{device_blocked}=="0"
     SYSFS{max_sectors}=="240"



For my USB sticks i use

BUS=="scsi", SYSFS{model}=="USB SM Reader   ",
NAME{all_partitions}="card_sm"

if you only have one partition this is some what simpler but you can
stick to the all_partitions if you like then map the correct partition
in /etc/fstab

I would guess (after some Chardonnay) at UDEV rules of :-

BUS=="scsi", SYSFS{model}=="MHV2080AH       ", NAME{all_partitions}="usbhd"

this should generate a bunch of

/dev/usbhd1 - /dev/usbhd15 entries

Set /etc/fstab rules to mount the correct partition.

For reference my fstab is

/dev/card_sm1   /media/card_sm  vfat    rw,user,noauto  0       0



Good luck!



-- 
Robin Cornelius
http://www.byteme.org.uk

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html