I have an external USB drive which is always plugged in. I have modified fstab and created a folder in media so that the drive is mounted at media/drive_name. However, is automount is enabled, every time I restart the system the drive get remounted in media/user_name/drive name. I would like to keep automount on for other devices, but for this specific one have my own mount point. Is there any way to do this?
1 Answer
Try this:
Make your script: make a new text document and put this in:
#!/bin/sh mkdir -p /path/to/custom-mount sudo umount /dev/sdaX ((This is the drive you want to mount in the custom location)) sudo mount -t filesystem-type -o rw /dev/sdaX /path/to/custom-mount
Put this script under
/etc/init.d
.- Make it executable by running
sudo chmod -x /etc/init.d/script-name
. - Run
update-rc.d script-name defaults
.
Hopefully, this will unmount your drive and then remount it under the folder you want.
-
@ThomasW. I think he already has that. Will it be removed upon reboot, when the drive gets unmounted? Apr 21, 2015 at 1:15
-
missed that. sorry. It should stay but it's still a good form to make a note that you should make sure the mount point exists yet. In fact if you change
/bin/sh
to/bin/bash
we can add in some error check code but meh– Thomas Ward ♦Apr 21, 2015 at 1:22 -
-
Yes, like - automatic. pmount takes care of this problem all by itself. askubuntu.com/questions/88523/…– SDsolarAug 1, 2017 at 9:56
fstab
?