9

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?

4
  • 1
    Open System → Administration → Log File Viewer and look through the logs for more debug info. Try to plug and unplug the USB drive and see what info you find in the logs. It might pinpoint the cause.
    – Li Lo
    Aug 13, 2010 at 3:08
  • It is not the expected behaviour. In my computer /media/ gets cleaned when I unplug the device, even if I do it without umounting it. Aug 13, 2010 at 11:45
  • checking back, did u try dmesg | tail and seeing if the output shows anything suspicious ?
    – koushik
    Aug 18, 2010 at 7:41
  • If you use pmount it will maintain the same mount point based on the name of the device itself. See askubuntu.com/questions/88523/… - instructions for installing pmount to prevent this from happening.
    – SDsolar
    Nov 16, 2017 at 22:34

4 Answers 4

3

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/.

1
  • New users may find it easier to use the Disk utility to set up an fstab entry, since most of the options are explained in the GUI.
    – wjandrea
    Nov 9, 2017 at 20:23
2

You can work around this, by unplugging the USB drive, and the going to a terminal (e.g. Application->Accessories->Terminal) and entering:

sudo rmdir /media/disk
sudo rmdir /media/disk_
sudo rmdir /media/disk__
sudo rmdir /media/disk___
etc

When you replug the disk in it should remount at /media/disk/

(Do the same for your /media/0BC7-569E)

1
  • +1 for a workaround. That's what I've been doing, but like others said it's not intended behavior that those directories are created. I would like to know why it happens.
    – Cesar
    Aug 13, 2010 at 19:47
1

This is not a complete answer, but rather a comment to help understand the issue better (I don't have enough reps yet to comment).

You can check diagnostic messages generated while usb / sdio devices are mounted and unmounted by running following command or by selecting (clicking on) the "dmesg" item in the left hand side of System -> Administrator -> Log File Viewer

dmesg | tail -20

The tail command prints only the most recent 20 msgs. While inserting or removing the card, run this several times or change the number at the end to see more/ less messages. This would give you an idea of what is going wrong.

1

Make sure you always unmount USB devices before you un-plug them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .