Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
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 '10 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. –  Javier Rivera Aug 13 '10 at 11:45
    
checking back, did u try dmesg | tail and seeing if the output shows anything suspicious ? –  koushik Aug 18 '10 at 7:41
add comment

4 Answers

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)

share|improve this answer
    
+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 '10 at 19:47
add comment

as far as a long-term fix goes, why not add the drive to /etc/fstab with a designated mountpoint? i recommend using UUID to identify the drive.

bonus tip: if you want the icon to be displayed when the drive is mounted, you can set the mountpoint somewhere within /media/; if you don't somewhere else, such as /mnt/

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.