Do you have an external hard drive that always mounts in /media/disk or some totally unuseful location? Here I’m going to try to explain the best way I found to have my partitions mounted exactly where I want them.
Basically GNOME handles all this stuff (removable media) with gnome-volume-manager, which uses HAL to grab information, and you can configure it with gnome-volume-properties. All the work is actually done by gnome-mount which can be configured with GConf.
In my case I have an external hard drive with two partitions, I want to have them mounted in /media/external-1 and /media/external-2.
The best way to do that is configuring HAL. There is very handy tool that allows you to see all the information available through HAL, that is hal-device. With that tool I’m able to see the following:
0: udi = '/org/freedesktop/Hal/devices/volume_uuid_2D11_15EE' volume.mount_point = '' (string) volume.label = '' (string) volume.uuid = '2D11-15EE' (string) block.device = '/dev/sda1' (string) 1: udi = '/org/freedesktop/Hal/devices/volume_uuid_31d943b3_b43c_4388_87db_3e2f30cf87d9' volume.mount_point = '' (string) volume.label = '' (string) volume.uuid = '31d943b3-b43c-4388-87db-3e2f30cf87d9' (string) block.device = '/dev/sda2' (string)
I have found my two parttions, the important thing is the uuid (2D11-15EE, 31d943b3-b43c-4388-87db-3e2f30cf87d9), the best thing to do is to choose a label for each partition and then the mount point will be determined automatically
To do that I have to add a HAL’s user policy file:
/usr/share/hal/fdi/policy/95userpolicy/10-external.fdi:
<?xml version="1.0" encoding="UTF-8"?> <deviceinfo version="0.2"> <device> <match key="block.is_volume" bool="true"> <match key="volume.uuid" string="2D11-15EE"> <merge key="volume.label" type="string">external-1</merge> </match> <match key="volume.uuid" string="31d943b3-b43c-4388-87db-3e2f30cf87d9"> <merge key="volume.label" type="string">external-2</merge> </match> </match> </device> </deviceinfo>
That’s it, now each time I plug in my hard drive the two partitions are auto mounted exactly where I want them 🙂
But wait, I don’t like that noexec mount option that appears by default in my external-2 partition. In order to fix that I can configure gnome-mount to change the defaults, or I can set the options I want.
First I need my complete UDI:
/org/freedesktop/Hal/devices/volume_uuid_31d943b3_b43c_4388_87db_3e2f30cf87d9
Then I set the proper GConf key:
gconftool-2 --type string -s /system/storage/volumes/_org_freedesktop_Hal_devices_volume_uuid_31d943b3_b43c_4388_87db_3e2f30cf87d9/mount_options "[exec]"
Yes, I know the key is huge, it’s sopposed to be “only” the volume’s UUID (31d943b3_b43c_4388_87db_3e2f30cf87d9) but I guess they forgot to allow the fancy way.
In order to have the right mount point I could have done the following instead, but with this the volumes will appear with no label.
gconftool-2 --type string -s /system/storage/volumes/_org_freedesktop_Hal_devices_volume_uuid_32d943b3_b43c_4388_87db_3e2f30cf87d9/mount_point "external-2"
I hope you find this useful.
Hi, thanks for the info.
I m using FC8 with XP dual boot and two hard drives (sda, sdb). All those partitions are getting automounted to /medaia/ and shown on the desktop.
Is there any way in which i can specify not to show them on my desktop n not to mount on /media.
I created entries in fstab to mount them on to /mnt/.
Now i don’t want to mount them on /media n show them on desktop.
Thanks in advance.
Mohan.
LikeLike
mohan: yeah, just go to System -> Preferences -> Hardware -> Removable Drives and Media
LikeLike
Hi Felipe C, thanks for the reply!
I did that, even then also my drives that were mounted(on /mnt/) are displayed on to my desktop.
Is there any configuration file related to my desktop where in i can modify not to show them on my desktop?
LikeLike
mohan: gconftool-2 –set /apps/nautilus/desktop/volumes_visible –type boolean false
LikeLike
Hi Felipe C, i just checked ur reply! it worked out for me. thanks.
LikeLike
Pingback: Elias Hickman’s blog » Automount
I guess this could also apply to SATA drives (really dumb question).
LikeLike
I have a Windows partition that I don’t want automounted, but I do want any true removable drives to automount. How can I arrange that? Is it necessary to use HAL’s UDI and enter all of that crap?
LikeLike
hi, I have my FC8 intalled and I don’t even get any of my external drive(with usb powered) detected…I’ve tried to mount it manually but it seems not plugged.
note) I have this external drive under XP and run well thought, and also I have a huge external hard drive which is not usb powered (AC powered) and a USB disk and both work…this is such a long issue which I also experience in my ubuntu 7.1
any idea?
LikeLike
It is much easier to change the labels on the filesystems on the two external partitions, instead of messing with HAL.
See for example https://help.ubuntu.com/community/RenameUSBDrive
LikeLike
Prasinos: except when the filesystem doesn’t have support for labels.
LikeLike
Works on Fedora Core 9 x86 :)_
LikeLike
Pingback: 100,000 views, and some stats « Felipe Contreras
Can this be done without using UUID and just using the label? So, for example, if one of my drives fails and I move to a backup drive, changing the label on the backup drive to the one from the failed drive, I don’t have to go through this process again?
LikeLike
@led_belly yeah, it’s better to just set the label (if your file-system supports that), then you don’t have to do anything else 🙂
LikeLike