Ubuntu - How to automount an external drive at a preconfigured mount point?

10,653

Solution 1

GeorgeM is close, but not close enough.

On Ubuntu, gnome-mount is reponsible for mounting media and also for maintaining the needed configuration. The man page of gnome-mount should tell you much more and with a little trial and error you should be able to achieve what you want.

After I played with this for a little while, I found the following:

  1. It seems you can not specifiy a mount point outside of /media
  2. You can set the mount points name by hal udi

The following command will change the settings used to mount a USB drive on my system:

gnome-mount --write-settings \
            --hal-udi /org/freedesktop/Hal/devices/volume_uuid_00AD_15D0 
            --mount-point p

When inserted, the USB drive will be mounted in /media/p

Solution 2

The mount point is determined by HAL and its complicated and arcane rules. No need to hack your fstab file.

Share:
10,653

Related videos on Youtube

Lars Haugseth
Author by

Lars Haugseth

Just another (Ruby|Perl|Java|C|Lisp|assembly) hacker.

Updated on September 17, 2022

Comments

  • Lars Haugseth
    Lars Haugseth over 1 year

    Normally, when I attach an external USB drive to my Ubuntu system, the filesystem on it are automounted to /media/label. However, I'd like the filesystem to be mounted at a mount point of my choosing. I've added a line like this to my /etc/fstab:

    UUID=2BE905C238C1F724   /p   ntfs-3g   defaults   0   0   # Passport 320GB
    

    This allows me to manually mount the volume at /p by running sudo mount /p, however the filesystem is no longer automounted when the drive is attached to the PC. What do I need to do to get automount to this mount point to work, if at all possible?

    • Admin
      Admin almost 15 years
      This is not a real answer, more like a workaround: If the label is unique among your media, you could make /p a symlink to /media/label.
    • Admin
      Admin almost 15 years
      I've always had terrible luck with external USB drives and Ubuntu. They never seem to mount in the right place - so I did the same thing as balpha.
    • Admin
      Admin almost 15 years
      It seems like it should be possible to override this, at least for compliant volume managers, by arranging for the volume.mount_point HAL property to be set. I have not, however, figured out how to accomplish this or make it work with Thunar's volume manager.
  • Lars Haugseth
    Lars Haugseth almost 15 years
    Thanks, I'll mark this as the accepted answer, unless someone comes up with a way to achieve mounts outside /media.