Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
1  
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. –  balpha Aug 1 '09 at 16:14
    
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. –  The How-To Geek Aug 1 '09 at 17:50
    
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. –  Michael Ekstrand Aug 2 '09 at 0:58
add comment

3 Answers

up vote 10 down vote accepted

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

share|improve this answer
    
Thanks, I'll mark this as the accepted answer, unless someone comes up with a way to achieve mounts outside /media. –  Lars Haugseth Aug 1 '09 at 22:56
add comment

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

share|improve this answer
add comment

For an external USB hard-disk formatted with ext4 (you'll need to adapt the options if using ntfs):

  • created a file 99-toshiba.rules:

    IMPORT{program}="/sbin/blkid -o udev -p %N"
    ENV{ID_FS_LABEL}!="toshiba", GOTO="toshiba_end"
    ACTION=="add", RUN+="/bin/mkdir -m 0 -p /media/toshiba", RUN+="/bin/mount -o noatime,nodiratime,errors=remount-ro /dev/%k /media/toshiba"
    ACTION=="remove", RUN+="/bin/umount -l /dev/%k", RUN+="/bin/rmdir /home/toshiba"
    LABEL="toshiba_end"
    
  • copied the file: sudo cp 99-toshiba.rules /lib/udev/rules.d/

  • reloaded the configuration sudo udevadm control --reload-rules

As you can see the I manually set the mount point to /media/toshiba but it could be anywhere.

it actually works ;-)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.