LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 11-19-2009, 11:41 PM   #1
someshpr
Member
 
Registered: Jul 2009
Location: CA, USA
Distribution: Debian, RHEL5.4, CentOS 5.4, 6.2, Ubuntu 11.04,12.04
Posts: 107

Rep: Reputation: 26
Mounting external hard drives for RHEL


Hi,
I am new to system administration. We have recently got external USB hard drives (Samsung Story, 1TB) for our office machines. However, the machines do not detect these external hard drives automatically when plugged in. And to manually mount I need to be superuser/root. I want the user to be able to mount/unmount or the USB drives be automatically mounted when plugged in.
So after some serach on the internet, I added this line to fstab line:
Code:
LABEL=SAMSUNG  /media/USB_Bkup  vfat  rw,suid,dev,noexec,noauto,user,async,dmask=000,fmask=111  0 0
I used the dmask and fmask parameters so that all the files ar rw for all the user, and directories are accessible to all users. This all works fine when I mount the drive using
Code:
mount LABEL=SAMSUNG
But I cannot unmount the drive after backup. If I use
Code:
umount LABEL=SAMSUNG
,
I get an error message saying
Code:
umount: LABEL=SAMSUNG is not mounted (according to mtab)
So I usually look up mtab and unmount using
Code:
umount /dev/sdx#
My question is:
1. Is there any way to unmount in a more user-friendly way, i.e., not looking for which device it is attached to?
2. Is there any way to get the USB drive to be mounted automatically when plugged in?

My OS are RHEL 3,4 and CentOS 5.

Any help is appreciated.
TIA
 
Old 11-20-2009, 12:32 AM   #2
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 653

Rep: Reputation: 66
umount by LABEL is not supported yet in RHEL, but yes this works in fedora.
the logic is, if suppose your one of drive is mounted on mutiple places then what it will unmount.

To mount on insertion by drive, you can edit your udev rules. Let me know if you are unaware of udev rules.

Thanks

Last edited by vishesh; 11-20-2009 at 12:33 AM. Reason: umount by label
 
Old 11-20-2009, 07:17 AM   #3
someshpr
Member
 
Registered: Jul 2009
Location: CA, USA
Distribution: Debian, RHEL5.4, CentOS 5.4, 6.2, Ubuntu 11.04,12.04
Posts: 107

Original Poster
Rep: Reputation: 26
Quote:
Originally Posted by vishesh View Post
umount by LABEL is not supported yet in RHEL, but yes this works in fedora.
the logic is, if suppose your one of drive is mounted on mutiple places then what it will unmount.

To mount on insertion by drive, you can edit your udev rules. Let me know if you are unaware of udev rules.

Thanks
Thanks vishesh, for the explanation. Is it possible to unmount by UIUD?
Can you please enlighten me on udev rules?

TIA,
 
Old 11-23-2009, 01:23 PM   #4
someshpr
Member
 
Registered: Jul 2009
Location: CA, USA
Distribution: Debian, RHEL5.4, CentOS 5.4, 6.2, Ubuntu 11.04,12.04
Posts: 107

Original Poster
Rep: Reputation: 26
Error while trying with udev

I tried to mount the external usb hard drive with udev rules but encountered errors. Here is what I did:
I looked at the /var/log/messages while plugging in the hard drive:
Quote:
[root@permian scratch]# tail -f /var/log/messages
Nov 23 13:49:14 permian udevd[5653]: udev done!
Nov 23 13:49:41 permian kernel: usb 1-2: new high speed USB device using address 8
Nov 23 13:49:41 permian kernel: scsi9 : SCSI emulation for USB Mass Storage devices
Nov 23 13:49:41 permian udevd[5653]: udev done!
Nov 23 13:49:41 permian kernel: Vendor: Samsung Model: STORY Station Rev:
Nov 23 13:49:41 permian kernel: Type: Direct-Access ANSI SCSI revision: 02
Nov 23 13:49:41 permian kernel: SCSI device sdc: 1953525168 512-byte hdwr sectors (1000205 MB)
Nov 23 13:49:41 permian kernel: sdc: assuming drive cache: write through
Nov 23 13:49:41 permian kernel: SCSI device sdc: 1953525168 512-byte hdwr sectors (1000205 MB)
Nov 23 13:49:41 permian kernel: sdc: assuming drive cache: write through
Nov 23 13:49:41 permian kernel: sdc: sdc1
Nov 23 13:49:41 permian kernel: Attached scsi disk sdc at scsi9, channel 0, id 0, lun 0
Nov 23 13:49:41 permian scsi.agent[7628]: disk at /devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/host9/target9:0:0/9:0:0:0
Nov 23 13:49:41 permian udevd[5653]: udev done!
Then I looked in to udevinfo:
Quote:
[root@permian scratch]# udevinfo -a -p $(udevinfo -q path -n /dev/sdc)


udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

looking at class device '/sys/block/sdc':

SYSFS{dev}="8:32"
SYSFS{range}="16"
SYSFS{removable}="0"
SYSFS{size}="1953525168"
SYSFS{stat}=" 1 0 8 345 0 0 0 0 0 345 345"

follow the class device's "device"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/host9/target9:0:0/9:0:0:0':
BUS="scsi"
ID="9:0:0:0"
SYSFS{detach_state}="0"
SYSFS{device_blocked}="0"
SYSFS{max_sectors}="240"
SYSFS{model}="STORY Station"
SYSFS{queue_depth}="1"
SYSFS{rev}=""
SYSFS{scsi_level}="3"
SYSFS{state}="running"
SYSFS{timeout}="30"
SYSFS{type}="0"
SYSFS{vendor}="Samsung "

looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/host9/target9:0:0':
BUS=""
ID="target9:0:0"
SYSFS{detach_state}="0"

looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/host9':
BUS=""
ID="host9"
SYSFS{detach_state}="0"

looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0':
BUS="usb"
ID="1-2:1.0"
SYSFS{bAlternateSetting}=" 0"
SYSFS{bInterfaceClass}="08"
SYSFS{bInterfaceNumber}="00"
SYSFS{bInterfaceProtocol}="50"
SYSFS{bInterfaceSubClass}="06"
SYSFS{bNumEndpoints}="02"
SYSFS{detach_state}="0"
SYSFS{iInterface}="06"

looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2':
BUS="usb"
ID="1-2"
SYSFS{bConfigurationValue}="1"
SYSFS{bDeviceClass}="00"
SYSFS{bDeviceProtocol}="00"
SYSFS{bDeviceSubClass}="00"
SYSFS{bMaxPower}=" 2mA"
SYSFS{bNumConfigurations}="1"
SYSFS{bNumInterfaces}=" 1"
SYSFS{bcdDevice}="0000"
SYSFS{bmAttributes}="c0"
SYSFS{detach_state}="0"
SYSFS{devnum}="8"
SYSFS{idProduct}="5f05"
SYSFS{idVendor}="04e8"
SYSFS{manufacturer}="JMicron"
SYSFS{maxchild}="0"
SYSFS{product}="Samsung STORY Station"
SYSFS{serial}="0000002CE09310500550"
SYSFS{speed}="480"
SYSFS{version}=" 2.00"

looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7/usb1':
BUS="usb"
ID="usb1"
SYSFS{bConfigurationValue}="1"
SYSFS{bDeviceClass}="09"
SYSFS{bDeviceProtocol}="01"
SYSFS{bDeviceSubClass}="00"
SYSFS{bMaxPower}=" 0mA"
SYSFS{bNumConfigurations}="1"
SYSFS{bNumInterfaces}=" 1"
SYSFS{bcdDevice}="0206"
SYSFS{bmAttributes}="e0"
SYSFS{detach_state}="0"
SYSFS{devnum}="1"
SYSFS{idProduct}="0000"
SYSFS{idVendor}="0000"
SYSFS{manufacturer}="Linux 2.6.9-89.0.11.ELsmp ehci_hcd"
SYSFS{maxchild}="8"
SYSFS{product}="EHCI Host Controller"
SYSFS{serial}="0000:00:1d.7"
SYSFS{speed}="480"
SYSFS{version}=" 2.00"

looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7':
BUS="pci"
ID="0000:00:1d.7"
SYSFS{class}="0x0c0320"
SYSFS{detach_state}="0"
SYSFS{device}="0x268c"
SYSFS{irq}="177"
SYSFS{subsystem_device}="0x01c1"
SYSFS{subsystem_vendor}="0x1028"
SYSFS{vendor}="0x8086"

looking at the device chain at '/sys/devices/pci0000:00':
BUS=""
ID="pci0000:00"
SYSFS{detach_state}="0"
Then I added the following udev rule to file /etc/udev/rules.d/05-local.rules
Code:
BUS=="usb",SYSFS{product}=="Samsung STORY Station",KERNEL=="sd?1",NAME="Bkup",SYMLINK="usbdevices/samsung1tb"
and changed my fstab to:
Code:
[root@permian scratch]# cat /etc/fstab
/dev/md2                /                       ext3    defaults        1 1
/dev/md0                /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/md3                /home                   ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
/dev/md1                swap                    swap    defaults        0 0
/dev/hda                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
/dev/Bkup           /media/USB_Bkup         vfat    rw,suid,dev,exec,noauto,user,async,dmask=000,fmask=111    0 0
So my udev rules folder now has
Quote:
[root@permian scratch]# ll /etc/udev/rules.d/

total 24
-rw-r--r-- 1 root root 136 Nov 23 13:42 05-local.rules
-rw-r--r-- 1 root root 11368 Apr 8 2008 10-wacom.rules
-rw-r--r-- 1 root root 3898 Mar 9 2009 50-udev.rules
-rw-r--r-- 1 root root 1136 Mar 9 2009 51-by-id.rules
Then I restarted the udev and fstab:
Code:
[root@permian scratch]# /sbin/start_udev 
Starting udev:     [OK]
[root@permian scratch]# mount -a
Finally when I tried to mount the drive, I got this error:
Quote:
[root@permian scratch]# mount /dev/Bkup
mount: special device /dev/Bkup does not exist
Any help on where am I going wrong?
I am running RHEL 3.

TIA,
 
  


Reply

Tags
fstab, rhel, usb automount


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling the Auto mounting of External Drives Pennpadcreative General 1 03-19-2009 07:30 PM
Disabling the Auto mounting of External Drives Pennpadcreative Linux - Desktop 1 03-19-2009 07:21 PM
mounting external drives thelonius Linux - Hardware 2 04-01-2007 09:08 AM
Mounting USB drives (external HD and two at once) jrdioko Linux - Software 4 07-25-2006 06:40 PM
mounting external hard drives Moebius Linux - Newbie 5 06-19-2004 08:39 PM


All times are GMT -5. The time now is 02:12 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration