3

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?

0

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 ;) )

  • 2
    So why is it automatically removed when I run umount on a drive that has been mounted with a GUI file manager? – robingrindrod 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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