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.

If I mount a drive using the file manager (I'm using PCManFM), the mount point is automatically removed when I run the umount command. However, if I mount by running mkdir and then mount, I have to manually remove the mount point after I have run umount.

Why does this happen? Is there a way to mount the drive using the mount command that will make the mount point be automatically removed?

Update: Is it similar to the reason for this?

share|improve this question

1 Answer 1

It is not up to umount to delete a directory so from command line you need to do it yourself.

You can use a script for that:

#!/bin/bash
mount_point=/media/directory
umount $mount_point && rmdir $mount_point &

and save it as umount.sh.

The mount_point might be better off as a variable so you could so

./umount.sh /media/dir

Something like this

#!/bin/bash
mount_point=$1
umount $mount_point && rmdir $mount_point &

So why is it automatically removed when I run umount on a drive that has been mounted with a GUI file manager?

The answer to this is more likely a design decision. I have not found any documentation on this (maybe someone else can provide a link ;) )

share|improve this answer
    
So why is it automatically removed when I run umount on a drive that has been mounted with a GUI file manager? –  user1291332 Apr 8 '13 at 17:22
    
still looking for that but it might be a design decision :P –  Rinzwind Apr 8 '13 at 17:34

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.