Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. The df -h on the partition /data was showing full usage of 20GB but du -sh /data was showing a usage of only 581MB.
  2.  
  3. ubuntu@ip-xxx-xx-x-xx:/data$ df -h
  4. Filesystem Size Used Avail Use% Mounted on
  5. ...
  6. /dev/xvdb 20G 20G 0G 100% /data
  7.  
  8. ubuntu@ip-xxx-xx-x-xx:/data$ du -sh .
  9. 581M .
  10.  
  11. This huge difference means that files are deleted from filesystem but are still referenced from some open applications.
  12.  
  13. There were no results of deleted files after running the following command.
  14. ubuntu@ip-xxx-xx-x-xx:/data$ lsof -nP | grep '(deleted)'
  15. ubuntu@ip-xxx-xx-x-xx:/data$
  16.  
  17. After few minutes of confusion I tried running the same command with sudo and there it was.
  18.  
  19. ubuntu@ip-xxx-xx-x-xx:/data$ sudo lsof -nP | grep deleted
  20. sh 5267 root cwd DIR 202,16 0 393217 /data/xxxxxxxxxxxxx (deleted)
  21. sh 5267 root 2w REG 202,16 3742909615 397337 /data/xxxxxxxxxxxxx/nohup.out (deleted)
  22. tail 5270 root cwd DIR 202,16 0 393217 /data/xxxxxxxxxxxxx (deleted)
  23. tail 5270 root 2w REG 202,16 3742909615 397337 /data/xxxxxxxxxxxxx/nohup.out (deleted)
  24. tail 5270 root 3r REG 202,16 1196962556 397656 /data/xxxxxxxxxxxxx/log/production.log (deleted)
  25. tail 14934 root 2w REG 202,16 1424371 398138 /data/xxxxxxxxxxxxx/nohup.out~ (deleted)
  26. tail 14934 root 3r REG 202,16 9281997539 659099 /data/xxxxxxxxxxxxx/log/production.log.1 (deleted)
  27. tail 19409 root 2w REG 202,16 1424371 398138 /data/xxxxxxxxxxxxx/nohup.out~ (deleted)
  28. tail 19409 root 3r REG 202,16 4805248107 655668 /data/xxxxxxxxxxxxx/log/production.log.9 (deleted)
  29.  
  30. Looking at the corresponding processes, I found that there were open processes that were holding references to the old files.
  31. ubuntu@ip-xxx-xx-x-xx:/data$ ps -ef | grep 5267
  32. ubuntu 2712 1616 0 13:13 pts/3 00:00:00 grep --color=auto 5267
  33. root 5267 1 0 Jan10 ? 00:00:00 sh -c tail -f -n 0 "/data/xxxxxxxxxxxxx/log/production.log"
  34. root 5270 5267 0 Jan10 ? 00:00:00 tail -f -n 0 /data/xxxxxxxxxxxxx/log/production.log
  35.  
  36. After killing all of such process, df and du matched completely and 18GB of disk space got freed up.
  37. ubuntu@ip-xxx-xx-x-xx:/data$ df -h
  38. Filesystem Size Used Avail Use% Mounted on
  39. ...
  40. /dev/xvdb 20G 625M 18G 4% /data
  41.  
  42. Hurray!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement