Re: PnP external hard drives
Jens Ruehmkorf <[email protected]> Mon, 04 Dec 2006 09:16:32 +0100
| Newsgroups | gmane.org.user-groups.linux.beijing |
|---|---|
| Message-ID | <[email protected]> |
Hi Benjamin,
Collar, Benjamin SLC CT PEK schrieb:
> Does anyone know how to make the automount always mount a specific
> USB device to a specific mount point? I have 4 filesystems on the
> drive, and I would like it if they are *always* mounted to
> /media/fs1, /media/fs2, etc
let's see. Automounting in Gnome is done via pmount; "man 1 pmount"
tells some more:
-- snip --
pmount is invoked like this:
pmount device [ label ]
This will mount device to a directory below /media if policy is met (see
below). If label is given, the mount point will be /media/label,
otherwise it will be /media/device.
-- snap --
So, if it's your only other /dev/sd*-device (besides your regular
sata-harddrive), everything is fine. If you have several such devices
(like a usb-stick and your usb-drive), one will become /dev/sdb, the
other /dev/sdc, depending on the order you have plugged them in. That's
why you are stuck :(
Hm. Some solutions I see:
1. Give each partition a (distinct) label and see, whether pmount
respects that. (You can add labels to your partition with "e2label" for
ext2/ext3, with "xfs_admin" for xfs and with "reiserfstune" for
reiserfs. "mkfs.vfat -n LABEL" sets the vfat-label.)
2. If this doesn't suffice, you can try to add mount-points to
/etc/fstab that *only* use labels as source-device. (See the
policy-section in pmount's man page.) I've tried the following with an
ext3-device (but should work with vfat-labels just the same):
# e2label /dev/sdb1 DISK1
# cat <<EOF >> /etc/fstab
> LABEL=DISK1 /mnt/disk1 ext3 noauto,rw,users,exec,nosuid 0 0
> EOF
#
3. If using labels together with pmount doesn't work you can use
udev-rules in "/etc/udev/rules.d". I use the following to acces my ipod:
-- snip --
BUS="scsi", KERNEL="sd?1", SYSFS{vendor}="Apple", \
OPTIONS+="all_partitions", SYSFS{model}="iPod" NAME="ipod"
-- snap --
Should be in a file like "/etc/udev/rules.d/95-ipod.rules", all in one
line. Now, whenever I plug my ipod into my notebook, the kernel/udev
will create a device "/dev/ipod" for it -- and pmount will always mount
it accordingly. To make this work for your usb-drive, you have to look
up some parameters in /sys/** when you have the device plugged in.
I myself would probably go for solution 3; but I'd be interested in any
other success-reports as well.
Good luck trying,
Jens
--
Jens Ruehmkorf
German Aerospace Center
Telephone +49 2203 601-2616
E-mail mailto:[email protected]
Internet http://www.dlr.de/dlr/verkehr
_______________________________________________
blug-general list
[email protected]
http://list.beijinglug.org/cgi-bin/mailman/listinfo/blug-general