Du, df, and Linuxdudf in Linux

Source: Internet
Author: User
Tags disk usage

Du, df, and Linuxdudf in Linux

During Linux O & M, it is often found that the values of du and df are different, and sometimes they are very different.

In specific circumstances, df may see that the disk is full, but du determines that the disk space is large.

The file system allocates some disk blocks to record some of its own data, such as I nodes, disk distribution charts, indirect blocks, and super blocks. This Data is invisible to most user-level programs, usually referred to as Meta Data.

Df: run the command to view the disk block distribution graph of the file system to obtain the total number of blocks and the remaining number. Reflect the actual usage of the system disk.

Du: User State program. Only partial statistics of the file system are collected, regardless of MetaData.

So df> = du

If the difference between df and du values is very large, it indicates that some programs may specify the file output to the deleted file.

For example, when the log file is deleted during the running process, the program will continue to output to the fileHandler pointed to by the original log without terminating. Even if a new file with the same name is created, it is still written to the original file according to the original fileHandler. In df's view, the disk growth still exists, but du's view shows that the file has been deleted. After Long-term operation, df will see that the disk usage is much higher than du.

In this case, the process can be terminated, and the deleted file fileHandler will be recycled and deleted.

If you do not know the process ID, you can use lsof to query

# Lsof | grep delete

Original article: du and df-Zero-degree Space in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.