You are here

Ubuntu - find out the free space


How much free space is left? Who took it? These two issues have to be faced constantly, especially file server administrators. If on the Windows platform, in a graphical environment, it's not difficult to find out, then the console of server versions of Linux can confuse many. However, do not be afraid, it's quite easy to get interesting information in the Linux environment.

As practice showed, this issue is relevant not only for novice administrators. Indeed, it is not enough just to find out the size of a file or folder, but you need to quickly and efficiently find out exactly who has taken up disk space and what. But first things first.

Let's start with a simple question, how to see how much free space is left.

For this purpose, there is a command df -h which displays a list of all file systems, their size and mount points. The -h switch allows you to display information in a convenient form for viewing - in megabytes and gigabytes, without a key, information about the size is displayed in blocks.

We answered the first question, but, as a rule, this answer raises even more questions. From the information received is absolutely not clear what exactly is the disk full. This can be both important data, and photos from the latest corporative event, "carefully" duplicated by users on their network folders. In the first case, you should think about increasing the volume of the disk subsystem, and in the second you can safely clean the disk and conduct explanatory conversations.

To answer the second question, we need to know the size of individual folders and files.

On Linux systems, this can be done with the du command, indicating the folder of interest, or you can specify the -h option to get user-friendly results.

Despite the fact that this team works, there is no practical benefit from it. Why? Now we will explain, the part of the command output is shown below: du -h / usr

5,5M    /usr/local/java/jdk1.8.0_65/db/lib
104K    /usr/local/java/jdk1.8.0_65/db/bin
5,7M    /usr/local/java/jdk1.8.0_65/db
353M    /usr/local/java/jdk1.8.0_65
526M    /usr/local/java
4,0K    /usr/local/games
526M    /usr/local
6,5G    /usr

Yes, we found out that the / usr folder has a size of 6.5 GB, but we did not get the idea of what exactly takes the main place in this folder. There was not a whole picture about how to fill the disk space, and there is not.

But do not despair, a small ncdu utility comes to our aid, it does not exist in the standard installation, but it is installed without any problems from the repository: apt-get install ncdu

The unattended utility displays information about the current folder, but since we are interested in the entire file system , Then specify the root directory as a parameter: After a short calculation, the utility displays a hierarchical list of directories starting with the largest size: Well, that's quite another matter. Immediately see what exactly is occupied by disk space. The utility is interactive, we can navigate through the tree, enter folders, change the presentation of information, delete unnecessary files and directories. All the features of the program can be found by calling the built-in help: As you can see, the utility is simple, but very rich in features, for example, you can quickly include a more visual representation of the data: Now the question of what disk space is used and what to do it is solved in just a few minutes. In our opinion, this utility should be in the arsenal of every system administrator.

Taken from: ]]>http://interface31.ru/tech_it/2012/09/ubuntu-server-kak-uznat-svobodnoe-...]]>

0 0

Share the article with your friends in social networks, maybe it will be useful to them.


If the article helped you, you can >>thank the author<<