How to Dismount a Mounted File System
Novell Cool Solutions: Tip
By Curtis Parker
Digg This -
Posted: 13 Dec 2004
Unable to dismount a mounted file system while it is in use. Let's say you have mounted a network volume, cdrom, or a flash drive and now you want to dismount it but Linux won't allow it because the device is busy.
First you will need to find out what process is using the mounted path. This can be done with the following command:
/usr/sbin/lsof +D /mnt/mounted_path
This command searches the mounted path for open files. If this is a mount for a large server volume, it will take some time to complete. It displays the command, PID, user, file name, etc for each open file.
You have mounted a usb flash drive at /mnt/usb using the command:
mount -t vfat /dev/sda1 /mnt/usb
You've done some work on the drive and then try to dismount the flash drive using the commmand:
It returns this output:
umount: /mnt/usb: device is busy umount: /mnt/usb: device is busy
You must have some process running somewhere that is using that device, run this command:
/usr/sbin/lsof +D /mnt/usb
The output might look like this:
- This shows that you have a terminal window running the bash shell that has changed its working directory to the usb flash drive and you have an instance of vi with testfile.txt open. Exit vi and "cd" out of the usb drive or close the terminal window. After doing so, when you re-run the lsof command, it shows no output. Re-run the umount command and it will return no errors.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com