Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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:
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?
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
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?
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.
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"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.