The difference between Du and DF:
Du statistics File size addition, DF statistic block usage, if there is a process in the open a large file, the large file directly by RM or MV dropped, then du will update the statistical value, DF will not update the statistics, or think that the space is not released. Until the process of opening the large file was killed. The problem we encountered was that we periodically deleted the files under/var/spool/clientmqueue, but did not kill the process, so the space has not been released. After you kill the process using the following command, the system resumes.
DF Command Verbose usage
A: Displays all file systems and disk usage scenarios for each partition
I: Show the usage of i-nodes
K: size is denoted by K (default value)
T: Displays all partition disk usage for one file system
X: Displays all partitions that are not part of a file system disk usage
T: Displays the name of the file system to which each partition belongs
H: Dynamic display of easy-to-read formats
Common commands: Df-h Df-hi
Detailed operation
Instruction DF can show the maximum available space and usage for all current file systems, see this example:
[Email protected] ~]# df-h
File system capacity has been used with available% mount points
/dev/sda3 38G 4.1G 32G 12%/
/DEV/SDA1 99M 14M 81M 14%/boot
Tmpfs 188M 0 188M 0%/dev/shm
We added the parameter-H to use the "human-readable" output, that is, in the file system size using GB, MB and other easy-to-read format.
In addition, we can use the parameter-I to view the current use of the file system inode. Sometimes although the file system still has space, but if there is not enough inode to store the information of the file, the same will not add new files.
[Email protected] ~]# Df-ih
File System Inode (i) Used (i) available (i)% mount point used
/dev/sda3 9.8M 180K 9.6M 2%/
/DEV/SDA1 26K 26K 1%/boot
TMPFS 47K 1 47K 1%/DEV/SHM
We can see that the number of inode used in the root directory is 180K and the available inode for 9.6M.
Little Tips
Do you remember what an inode is? The so-called Inode is the basic information (metadata) that is used to store files and directories, including time, file names, users, and groups. When splitting a sector, the system makes a bunch of inode for later use, and the number of inode is related to the total number of files and directories that can be created in the system. If most of the files to be saved are very small, then the same size of the hard disk will have more files, that is to say, more inode to hang files and directories.
Du command detailed usage:
Du: Querying the disk usage space for an archive or directory
A: Displays the disk space occupied by all directories and each file under the second directory
B: Size is represented by bytes (default is k bytes)
C: Last plus Total (default value)
S: Show only the sum of each file size
X: Only files that belong to the same file system are counted
L: Calculate all file sizes
Common commands: Du-h du-sh
Detailed operation
The instruction du can display the amount of disk space occupied by all the files in each directory, in the subdirectories of the specified directory. For example:
[Email protected] guo]# Du-h/etc | More
24k/etc/php.d
244k/etc/readahead.d
108k/etc/cron.daily
24k/etc/yum/pluginconf.d
40k/etc/yum
8.0k/etc/openldap/cacerts
24k/etc/openldap
712k/etc/pam.d
16k/etc/wpa_supplicant
56k/etc/gnome-vfs-2.0/modules
64k/etc/gnome-vfs-2.0
We use the-H parameter to display the format of the human-readable. In the application, we can use the DU command to see which directory occupies the most space. However, Du's output is usually very long, we can add the-s parameter to omit subdirectories under the specified directory, and only show the sum of that directory:
[Email protected] ~]# du-sh/etc
126m/etc
When we look at the usage of the catalog, we can sort the output into the sorts directive to see which file uses the most space:
[Email protected] ~]# Du/etc | Sort-nr | More
128976/etc
55464/etc/gconf
53028/etc/selinux
52996/etc/selinux/targeted
51344/etc/selinux/targeted/modules
37180/etc/gconf/gconf.xml.defaults
25668/etc/selinux/targeted/modules/active
25660/etc/selinux/targeted/modules/previous
18228/etc/gconf/schemas
3664/etc/rc.d
The sort parameter-nr means to reverse sort by the number sort, because we want to sort the size of the directory, so we can not use the size of the human-readable output, otherwise the directory size will have K, M and other words, will cause the sorting is incorrect
This article is from "a long long time later" blog, please be sure to keep this source http://wahahaha.blog.51cto.com/4146629/1542487