When a user logs in to the Linux system server to view it, it is found that the results detected by df and du are different. The actual use space detected by du is significantly smaller than the used space detected by df. A lot, what is this all about? Is some space hidden? Let's take a look at the different solutions used by the df and du commands.
The method is as follows:
First, we use df to view the used space:
As you can see from the above figure, the root partition has used 5456700KB (contract 5.20GB).
Then, we use du to find the size of each directory under the root partition:
Exclude the two directories in the red box (because they are mounted), the total of all directories The size is 3075332KB (contract 2.93GB), which is 2.27GB smaller than df.
Why is there so much space left?
Actually, because we deleted some files that the process is writing, although it has been deleted by us, as long as the process is still, the file will not be deleted, but it will be temporarily stored in the system. Somewhere, it's a bit like the Windows recycle bin.
To solve this problem, the easiest way is to restart the server, but the production environment is generally not easy to restart, so we can solve it in other ways.
First use the lsof command with the grep command to find out which ones have been deleted, but still occupy the system space "rogue”.
The file in the red box above is a large file I deleted before. I am trying to restart this program (node). I killed the process directly because I did autostart, so I You don't have to manually start it.
The used space has dropped to 3226324KB (contract 3.08GB), which is very close to the total space of du statistics.
Next, I restarted the other deleted files one by one. The size of the final df is almost the same as the total space of the du statistics.
At this point, it solves the different files found by df and du, and drives away the "rogue" in the system, and it is our space.
The df and du commands have been found to have different solutions for using the space. If you have this problem, you can follow the above steps to solve the problem.
The at command in the Linux command is used to list the scheduled tasks. It is simi
In the Ubuntu system, many users will download the update part of the program after
Kernel is the system kernel. When the Linux system is upgraded, the kernel will be
node.js can be used not only to write scripts for web pages, but also to run Linux commands on the s
Steps to install Fluentd on RedHat
Two classifications of Linux system commands
How to use clam antivirus antivirus in Linux
Linux system how to use the crond command
Ubuntu dual system can not enter the Windows disk solution
How to import files from a Docker container to the host
How to fix sublime text in Linux to launcher
What should I do if hacmp fails to start after AIX is powered off?
What is the meaning of Linux beginners learning commands?
Linux boot error report to disable selinux policy?
Windows7 Ultimate can't enter the bios interface?
The start menu of Windows7 system changed to classic style (2)
How to clone WindowsXP with Ghost2003
Repair red rice identification error Xiaomi mobile assistant 1.2.1.4251 public beta update
Win 7 system using SSD solid state drive data
Computer technology: win8 system set file sharing method
Internet Explorer 10 Release Preview System Requirements
How to open control panel in win10
The browser can also browse through the pages. How to use it? The