Automounting a storage device with GNOME

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:


<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">

<match key="block.is_volume" bool="true">
<match key="volume.uuid" string="2D11-15EE">
<merge key="volume.label" type="string">external-1</merge>
<match key="volume.uuid" string="31d943b3-b43c-4388-87db-3e2f30cf87d9">
<merge key="volume.label" type="string">external-2</merge>


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:


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.

15 thoughts on “Automounting a storage device with GNOME

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


  2. 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?


  3. Pingback: Elias Hickman’s blog » Automount

  4. 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?


  5. 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?


  6. Pingback: 100,000 views, and some stats « Felipe Contreras

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


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.