DF and du command differences

Source: Internet
Author: User

1, under normal circumstances, DF and du output results will have a gap.


The DU-SH command accumulates all the directories, symbolic links, and the number of blocks used by the file system using the specified file system.


Total block number;

The DF command, by viewing the file system disk block allocation graph, draws the total number of blocks and the remaining blocks.

File system allocation Some of the disk blocks used to record some of its own data, such as I node, disk map, indirect block, super block, etc.


。 This data is not visible to most user-level programs, often referred to as meta data.

The du command is a user-level program that does not consider meta data, while the DF command looks at the file system's disk allocation diagram and considers meta data



As a result, DF calculates a used space that is slightly larger than the results of the DU calculation.



2, under abnormal circumstances, DF calculation used space will be much larger than DU.

This is also the problem encountered before, DF View results File system 100% used, and Du's result is also 6GB idle, so a problem hardware manufacturers a support incredibly do not know how to explain, this is also let me curious to check back at night to see the reason, the results of Google a bit.

The reason for this is that Du is used for computing space based on the file name and directory name, and DF is used to calculate space using hard disk block usage.

When an application is writing a large file, we RM or mv the file (Unix is allowed to do so, Windows is silly at this point), the application takes possession of the handle, and according to the location of the disk where the handle refers to write the disk directly, and does not check whether the file is deleted.

Therefore, the above problems will arise. Specific to the Oracle level, this can happen: Oracle for some reason in generating a large trace file, may cause the Oracle and other catalogs full, if the direct RM or MV off the trace file will find that the space is not released, This could lead to an Oracle database down-machine.

Workaround: Use the "> tracefile.trc" command to empty the file, if you need to keep the trace file for later analysis of the problem, you can use the CP first copy the file to another place, and then empty the original file


This article is from the "Computer Network" blog, please be sure to keep this source http://reder.blog.51cto.com/10844461/1713811

DF and du command differences

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.