Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
However, if I do a du -sh /var it reports that only 4.6G are being used:
# du -sh /var
4.6G /var
Furthermore, free space is somehow disappearing. If I delete say a 1G file, I can watch the newly freed space rapidly dwindle away by repeatedly doing a df -h. But du -sh /var still shows only 4.6G are being used. And I can't find any files with a larger file size in /var. Really weird. Any ideas?
du reports the space used by files and folders--even this is more than the file size. A few quick experiments on my system show that 4K is a minimum file size in terms of disk space.
df reports the space used by the file system. This includes the overhead for journals and inode tables and such.
Use lsof to identify deleted files that are still open:
# lsof | grep deleted
The disk space the deleted file occupies will not be freed until the process with it open is terminated. In my case, a nohup'd tcpdump process was writing output to a deleted file in /tmp . After killing the process, the filesystem cleaned up the deleted file inodes within a minute or two. Afterward, du and df user space were nearly identical. A restart effectively does the same steps, but is not required.
Also note that free space + used space will not be equal to total space when looking at df on most ext filesystems. Some (default is 5% for ext3) of the sectors are reserved for root, and don't appear as "available" in df.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.