Recently I was running Unetbootin to install a live dvd image on a pen drive. It got stuck in the middle of the job, and even after closing it, I couldnt umount it with umount or gparted. It was suggested that I use fuser or lsob to identify and terminate the running process.
Gparted showed me that the drive was the device /dev/sdc1
So I tried to identify the process using the device
$ ps ax | grep '/media/D514-D264'
20291 ? D 0:09 /usr/lib/p7zip/7z -bd -aos -o/media/D514-D264 e /userhome/CD Images/livedvd-x86-amd64-32ul-2012.1.iso image.squashfs
21055 ? D 0:05 /usr/lib/p7zip/7z -bd -aos -o/media/D514-D264 e /userhome/CD Images/livedvd-x86-amd64-32ul-2012.1.iso image.squashfs
22896 pts/4 S+ 0:00 grep --color=auto /media/D514-D264[/code]
The integer displayed on lefthand coloumn is the PID (processid)
The command kill can be used to stop the process, by specifying the kill signal and process id.
Table 12-2. Common kill signals
Signal name Signal value Effect
SIGHUP 1 Hangup
SIGINT 2 Interrupt from keyboard
SIGKILL 9 Kill signal
SIGTERM 15 Termination signal
SIGSTOP 17,19,23 Stop the process
So to kill (signal 9) processes 20291,21055,22896 I would issue the command:[[email protected] c]$ sudo kill -9 21055
[[email protected] c]$ sudo kill -9 22896
kill: No such process
[[email protected] c]$ ps ax | grep '/media/D514-D264'
There, no more running processes using the device. Voila, now gparted has no problem unmounting the device!
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.