{"id":3625,"date":"2014-10-09T10:00:10","date_gmt":"2014-10-09T02:00:10","guid":{"rendered":"http:\/\/rmohan.com\/?p=3625"},"modified":"2014-10-09T10:02:23","modified_gmt":"2014-10-09T02:02:23","slug":"disk-usage-100-even-after-deleting-files","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3625","title":{"rendered":"Disk usage 100% even after deleting files"},"content":{"rendered":"<p>Reducing Disk Usage When Linux complains that the disk is full, you will naturally try to delete some files or move them away from the filled-up partition. So you delete some large files, and check to see that the disk usage is much lower.<br \/>\n$ sudo du -shx \/<br \/>\n7.8G\u00a0\u00a0\u00a0 \/<br \/>\nBut df tells you that your disk usage is still 100%<br \/>\n$ df -h \/<br \/>\nFilesystem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Size\u00a0 Used Avail Use% Mounted on<br \/>\n\/dev\/disk\/by-uuid\/5a775102-c857-4007-8b5c-9137af04163f\u00a0 9.8G\u00a0 9.2G\u00a0\u00a0 93M 100%<br \/>\nInfuriating, isn&#8217;t it?<\/p>\n<p>Mysterious Disk Usage<\/p>\n<p>So du tells us the files are deleted and disk space is available, but df says the disk is still full. Both are actually correct &#8211; du tells you the actual usage, and df takes into account the file handles that point to the deleted data.<\/p>\n<p>Don&#8217;t believe me? Run lsof and grep for &#8220;deleted&#8221;<br \/>\n$ lsof|grep deleted<br \/>\ndeluged\u00a0\u00a0 25308\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rmohan\u00a0\u00a0 15r\u00a0\u00a0\u00a0\u00a0\u00a0 REG\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8,1 1393377280 400069 \/home\/rmohan\/Google.OS.v12.282.02.iso (deleted)<br \/>\ndeluged\u00a0\u00a0 25308 25309\u00a0\u00a0\u00a0\u00a0 rmohan\u00a0\u00a0 15r\u00a0\u00a0\u00a0\u00a0\u00a0 REG\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8,1 1393377280 400069 \/home\/rmohan\/Google.OS.v12.282.02.iso (deleted)<br \/>\ndeluged\u00a0\u00a0 25308 25310\u00a0\u00a0\u00a0\u00a0 rmohan\u00a0\u00a0 15r\u00a0\u00a0\u00a0\u00a0\u00a0 REG\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8,1 1393377280 400069 \/home\/rmohan\/Google.OS.v12.282.02.iso (deleted)<br \/>\ndeluged\u00a0\u00a0 25308 25311\u00a0\u00a0\u00a0\u00a0 rmohan\u00a0\u00a0 15r\u00a0\u00a0\u00a0\u00a0\u00a0 REG\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8,1 1393377280 400069 \/home\/rmohan\/Google.OS.v12.282.02.iso (deleted)<br \/>\ndeluged\u00a0\u00a0 25308 25333\u00a0\u00a0\u00a0\u00a0 rmohan\u00a0\u00a0 15r\u00a0\u00a0\u00a0\u00a0\u00a0 REG\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8,1 1393377280 400069 \/home\/rmohan\/Google.OS.v12.282.02.iso (deleted)<\/p>\n<p>Aha,\u00a0 we now know that deluged is the culprit that did not release the file handle of the deleted files. Simply kill\/restart the process to free the file handle. After killing the deluged process, lsof shows that there is no longer deleted file handles floating around.<\/p>\n<p>Let&#8217;s take a look at what df says now.<br \/>\n$ df -h<br \/>\nFilesystem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Size\u00a0 Used Avail Use% Mounted on<br \/>\n\/dev\/disk\/by-uuid\/5a775102-c857-4007-8b5c-9137af04163f\u00a0 9.8G\u00a0 7.9G\u00a0 1.4G\u00a0 85% \/<br \/>\nYou have now successfully asked Linux to #givemebackmyspace<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reducing Disk Usage When Linux complains that the disk is full, you will naturally try to delete some files or move them away from the filled-up partition. So you delete some large files, and check to see that the disk usage is much lower. $ sudo du -shx \/ 7.8G \/ But df tells you [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3625"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3625"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3625\/revisions"}],"predecessor-version":[{"id":3627,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3625\/revisions\/3627"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}