Friends who are often exposed to Linux, especially those on a server that is shared by many people, may often encounter problems like this:
Received a disk alarm, said that the XXX partition is full, then log on to the server DF A look, found that the disk is really full, and then you want to find out which directory is full, so du-s * a look, but found that all the size of subdirectories and DF Show total has been using disk space is not, sometimes even a lot of difference , so I wondered: where did my disk space go?
Here's a list of 3 things I know:
Hide Files
The Linux system takes the filename. The file at the beginning of the (dot) is considered a hidden file, and an operator like Bash will not match the hidden file, so if there is a larger hidden file under the root directory, it will not be du-sh *, the solution is: Du-sh. [^.] * 。
non-empty directory is Mount
When other partitions are generally mounted, it is recommended to mount to an empty directory, so what happens if you mount to a non-empty directory? For example, the/MNT directory had files inside it, and then the sudo mount/dev/sda6/mnt was executed. In fact, the Mount command can be fully implemented, the mount of the partition can be normal access, but the original in the/mnt file, now have access to, including du also can not see the size, but the disk space is still occupied, because if you umount/mnt later, All the original documents will be back.
Empty File
The size of a file and the amount of disk space may not be exactly the same, such as a program has been open a file called log is written, and the middle of the > Log command to clear the contents of the log, it will produce such a file. Here is an introduction to this document.
Through the above three methods of processing, your disk space is not much larger? However, there may be other circumstances, welcome to add.