Posts Tagged ‘HardDisk’

Linux Out Of Space

August 12, 2008 2 comments

You know the scene. Your system is just too slow, processes are queuing up, you can’t create a new text file because your computer ran out of space.

This is not a system failure nor a mistake on the operating system and you’re desperate trying to find those unused and less important files to delete.

The most obvious action to take is start jumping from directory to directory removing files you don’t require, but after awhile this becomes a painful task.

Before you start removing files, you need to actually know how many free space is left and, in case you have a partitioned system, which filesystems are the affected ones. You know, its always easier to divide a problem to a smaller pieces and attack only the significant ones.

Fortunately this is performed very easily in Linux with the df command.

Open a terminal and type df -h to show the disk space usage report. The -h option tells the system to format the values in human readable form.

As you can see, the problem lies in the /usr filesystem.

Now lets have a look at the directory used space. What we want to know is exactly which folders are the ones using the most disk space; The du command will helps us a lot in this situation.

$ cd /usr
$ du -Sm | sort -n

du shows the estimated disk usage on the current folder. After executing the command you will see a list of the directories ordered by disk space usage.

In the first column you will see the directory size (in Megabytes) followed by the folder name. The last record will always be a single . (dot) representing the total size of all the files and folders where you executed the command.

Now we have delimited the problem to just a few folders, the repairing tasks should cause you no trouble.

Finally, think outside the box, nowadays storage media is cheap and there may be nothing you can do but go buy another hard drive.