{"id":71,"date":"2013-09-26T13:43:06","date_gmt":"2013-09-26T13:43:06","guid":{"rendered":"http:\/\/muse.oneshot.in\/?p=71"},"modified":"2013-09-26T13:43:06","modified_gmt":"2013-09-26T13:43:06","slug":"list-open-files-in-a-device-or-partition","status":"publish","type":"post","link":"https:\/\/muse.oneshot.in\/?p=71","title":{"rendered":"List open files in a device or partition"},"content":{"rendered":"<p>If you try to unmount a partition and get a message like this:<\/p>\n<pre># umount \/media\/usbdisk\/\r\numount: \/media\/usbdisk: device is busy<\/pre>\n<p>use the lsof command to find out what programs are using what files:<\/p>\n<pre># lsof \/media\/usbdisk\/\r\nCOMMAND  PID USER  FD TYPE DEVICE SIZE NODE NAME\r\nbash    6925 root cwd  DIR   8,17 4096    1 \/media\/usbdisk\/\r\nxmms    6979 root cwd  DIR   8,17 4096    1 \/media\/usbdisk\/<\/pre>\n<p>This shows that the programs bash and xmms are using the device. For an even clearer picture, use the device name rather than the mountpoint:<\/p>\n<pre># lsof \/dev\/sdb1\r\nCOMMAND  PID USER  FD TYPE DEVICE    SIZE NODE NAME\r\nbash    6925 root cwd  DIR   8,17    4096    1 \/media\/usbdisk\r\nxmms    6979 root cwd  DIR   8,17    4096    1 \/media\/usbdisk\r\nxmms    6979 root  8r  REG   8,17 2713101  377 \/media\/usbdisk\/a.mp3<\/pre>\n<p>You either can wait until those processes exit or terminate them manually.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you try to unmount a partition and get a message like this: # umount \/media\/usbdisk\/ umount: \/media\/usbdisk: device is busy use the lsof command to find out what programs are using what files: # lsof \/media\/usbdisk\/ COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME bash 6925 root cwd DIR 8,17 4096 1 \/media\/usbdisk\/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-71","post","type-post","status-publish","format-standard","hentry","category-information-technology","category-redhat"],"_links":{"self":[{"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=\/wp\/v2\/posts\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=71"}],"version-history":[{"count":1,"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=\/wp\/v2\/posts\/71\/revisions"}],"predecessor-version":[{"id":72,"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=\/wp\/v2\/posts\/71\/revisions\/72"}],"wp:attachment":[{"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muse.oneshot.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}