How to mount external drive with the same name every time?
I'm having this issue under Xubuntu 21.10 (kernel 5.11.0-41-generic) where, when clicking on a USB external drive label in Thunar's sidebar after I've plugged it in (so it shows up but is still unmounted) gets the drive mounted with a different "label" each time. It's getting mounted under the same location, but the folder it's getting mounted at is "/media/$USER/DRIVE_NAME$NUMBER", where $NUMBER is a number that increments each time I mount the drive. This is becoming a pain for obvious reasons. Thanks in advance to anyone helping.
You can tell the mount point in /etc/fstab
.
So you would set the name, and your partition would always mount with the same name.
The header of the file is reasonably explanatory
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
see 1:
- Run a combination of
sudo fdisk -l
andsudo blkid
to identify the UUID of your partition. - Edit with
sudo nano /etc/fstab
(or use the editor of your choice). - Add a line like
UUID="xxxx-xxxx" /media/<mount point of your choice> ext4 defaults,user,auto 0 1
. - Reboot.
The exact flags to use should be fine tuned.
You have to create directory /media/<mount point of your choice>
for the mount to take place.