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?

 

Robin Cornelius wrote:
> 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!
> 

Thanks for that Robin, it worked!

The drive is now detected as usbhd*

All I need to do now is crack automatically mounting the drive when it 
is plugged in.  By the way, if it helps I'm using Debian 4.0 (text only 
install).

Ta,

Rob



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