Filesystem – Why Does Mount Point Keep Changing and How to Prevent It?

filesystemmountusb-drive

When I plug in an external USB drive, it automatically mounts and it's accesible in /media/disk/

However after a while, this is how my /media directory looks like:

cesar@minas-tirith:~$ ls /media/
0BC7-569E  0BC7-569E_  disk  disk_  disk__  disk___

As you can see, the disk entry is repeated with additional _ appended at the end. I don't know why this happens, but I can imagine that under some circumstances, the system can't mount the disk in /media/disk/ and creates disk_, then it can't mount it in /media/disk_ and creates disk__ and so forth. The other entry 0BC7-569E I think it's from a SD media card so it's not only for USB drives.

I would like to know what is causing this? Is this expected behavior? or how can I prevent this from happening?

Best Answer

For a long-term fix, you could add the drive to /etc/fstab with a designated mountpoint. I recommend using the UUID to identify the drive.

Bonus tip:

If you want the icon to be displayed when the drive is mounted, set the mountpoint somewhere within /media/. If you don't, set the mountpoint somewhere else, such as /mnt/.

Related Question