Today Jenkins (formerly Hudson) CI server suddenly hung up, the investigation of a half-day found that the disk has 100%, I really regret that the disk was not set up a big point, in fact, you can adjust with LVM, but the heart is still no bottom, afraid of the data are lost, decided to adjust the disk allocation. Now, first of all, Jenkins under the useless items are killed, you can make a lot of space.
We all know that using the du command allows you to view directories, such as viewing the/home/kuuyee directory for disk space use the following command:
1root@pm-ubuntu:~# Du/home/kuuyee-sh
2333m/home/kuuyee
But there is a problem, my Jenkins directory there are hundreds of build projects, one by one to look at the directory occupancy situation too much trouble, Google to find a way:
1root@pm-ubuntu:~# Du/home--max-depth=1-h
2125m/home/linux
3333m/home/kuuyee
4457m/home
That's it. The disk occupancy of all subdirectories is listed! The--max-depth parameter here represents the depth of the directory to be listed, set to 2 if you want to list the level two directory, and so on.
If you want to, the result output to the file can be this:
1root@pm-ubuntu:~# du/home--max-depth=1-h > Disk_status.txt
The following is a description of the use and parameters of the du command:
Usage: du [options] ... [File] ...
Or: du [option]...–files0-from=f
Summarize the amount of disk used in each < file >, and take the total amount of the catalogue.
The parameter meaning is as follows:
-S gives only the total number of blocks of data used for each names parameter.
-A recursively displays the number of blocks of data in each file in the specified directory and in the Descendants directory. If-S is not specified or-A is specified, only the number of disk blocks per directory in names and each subdirectory in it is displayed.
-B lists disk space usage in bytes (the system defaults to K bytes).
-k lists disk space usage in 1024-byte units.
-C finally add a total (system default).
-L calculates all file sizes.