Linux tip: How to unmount busy drive

By Detector | 09 January 2009



You are probably all experienced with the situation – you are trying to unmount a drive, but keep getting told by your system that it’s busy. If you like to find which application hold the drive busy there is one simple solution. A quick one-line in terminal mode will tell you (in this example device name is “windows”):

lsof +D /mnt/windows

This will return the command and process ID of any tasks currently accessing the /mnt/windows directory. You can then locate them, or use the kill command to finish them off.

Tags | , , ,

| |

One Response to “Linux tip: How to unmount busy drive”

  1. How about this similar entry from:
    http://tutorialninjas.net/2007/08/25/unmounting-a-busy-device

    * lsof (device) ex: lsof /dev/cdrom
    * kill -9 (pid)

    If you are confused you can run this: lsof -t ‘device here’ | xargs kill -9 . Just make sure you put the device in. After that command you should be able to unmount the drive.






Archives

Add to Technorati Favorites
website stats
TwitterCounter for @ukion