Linux system to retrieve lost disk space

  
Some users of Linux systems often encounter, showing that the disk space is full, you have to delete some files. But looking back and thinking, the total file size and the total size of the disk are not consistent, then where are the remaining space? Which files are hidden in the corner to occupy a part of the space. The following small series will teach you how to retrieve the lost disk space and completely clean the hidden files and empty files on the disk. The following three methods can be carried out one by one, and the effect of thorough cleaning can be achieved.
Users who frequently contact linux may encounter such problems frequently:
Receive a disk alert, say that a certain partition is full, then log in to the server df and see that the disk is almost full, then you Just want to find out which directory is full, so du -s * a look, but found that the total size of all subdirectories and df shows the total used disk space is not right, sometimes even a lot of difference, so I wonder : Where is my disk space?
Here are three cases:
Hidden files
The Linux system takes the file name. The file at the beginning of the (dot) is treated as a hidden file, and operators like bash do not match hidden files, so if there is a large hidden file in the root directory, it will not be du-sh. * Statistics, the solution is: du -sh. [^.]*.
Non-empty directory is mounted
Generally, when mounting other partitions, it is recommended to mount to an empty directory. What happens if you mount to a non-empty directory? For example, the /mnt directory is actually inside. There is a file, and then sudo mount /dev/sda6 /mnt is executed. In fact, this mount command can be executed normally, and the partition that is mounted can also be accessed normally. Only the files in /mnt are not accessible now, including du, but the disk space is still occupied. Because if you umount /mnt later, the original file will come back.
































Most of the time, the above three kinds of garbage will be hidden in the computer. Those who have little computer disk can clean up and can free up some space to store other important files. After these three methods are cleaned up, the junk files in the computer are almost cleaned up, so it is a very effective method, try it!

Copyright © Windows knowledge All Rights Reserved