Where did all my space go on Linux?

Table of Contents

It happens your systems are working away happily one min and the next they stop. On Linux most of the time it seems that the hard drive or partition fills up and then everything stops.

If you open up a SSH and type

[root@SLnetTest1 ~]# du -h --max-depth=1 /

399M /opt
16K /lost+found
28M /sbin
13M /boot
412K /dev
1.5M /cli-rt
17G /var
5.4M /bin
32K /root
4.0K /media
9.1M /etc
4.0K /home
4.0K /selinux
4.0K /mnt
0 /proc
4.0K /srv
104M /lib
13G /tmp
0 /sys
468M /usr

As you can see mine was all gone in the /tmp. Cleaned it up and restart the services and good as gold.

Here is another command to add to the list of administrative commands I frequently need on Linux. To easily view the size of the directories in the directory you are currently in sorted by size, run the following.

du --block-size=MiB --max-depth=1 | sort -n

This command lists the directories with their sizes in megabytes and sorts the results by size in ascending order. If you prefer to sort in descending order, use this command.

du --block-size=MiB --max-depth=1 | sort -rn

source https://hathaway.cc/2013/12/linux-command-line-disk-usage-sorted-by-size/


Our Services