Home » Questions » Computers [ Ask a new question ]

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

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

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:

Asked by: Guest | Views: 343
Total answers/comments: 2
Guest [Entry]

"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:

It seems you can not specifiy a mount point outside of /media
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"
Guest [Entry]

"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 ;-)"