05 November

How to find out which folders are eating / occupy disk space on your linux server

Written by 

Problem

My server partition is full and i have no idea whats causing the space to run out.

Solution

If you are administering your server in a command line envr., often is not easy to troubleshoot space issues, mainly due to the undreds of folder that the instalation contains, lets face it its not practical to "DF" every folder in the system until we find the aggressor.

Thankfully the NDCU command line tool does the hard work for you, install it by running:

On Ubuntu

sudo apt-get install ncdu

Once installed, you can run it with:

sudo ncdu /

This will analize all folders in the root, hence the "/" , and provide you with a list of the biggest folders / files  in the current folder, you can then select the directory you wish to enter in order to analize if further and so on until you find the file / folder that is causing the issue.

In my case the issue was due to a log file with 32GB in size, ive manage to delete it via:

cd "{file location}"
rm "{file name}"

This clears the file from the system, however if the file is being used by a process invoking a command such as:

df -h

Will still show your file system size without the freed space, in order to clear it a machine restart should take place, or if you know the daemon / process that is using the file restart the service.

Usefull Links

Ncdu offical page: https://dev.yorhel.nl/ncdu

Read 6841 times Last modified on Saturday, 05 November 2016 19:01
Rate this item
(0 votes)

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

Latest Posts

Contacts

João Vieira

Skype: jcv.pt

Email: info@joao-vieira.pt

About

This is my personal page, here you will find IT related, projects, discussions and reviews. Feel free to coment and leave your input.