Find lost disk space under Linux three kinds of situation

Source: Internet
Author: User

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.

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.