Analyzing low disk space in linux & windows servers


Servers can often get into low disk space situations. It won't be easy to guess which folder in server is eating the whole space in server.

This articles explains how you can find reason for high disk space usage in Windows & Linux.

1. How to folders having largest size in Windows

* Download "TreeSize Free" from http://www.jam-software.de/treesize_free/
* Install & run "TreeSize Free"
* Go to scan & choose drive to examine
* Now, you can see file system tree showing disk usage.
Eg: http://www.jam-software.com/treesize_free/screenshots/EN/Tree.png

2. How to folders having largest size in Linux

* Login to server via ssh as root
* Download http://files.bytehouse.co.uk/disk-space-counter.sh script & execute
* The script will ask you to provide a path to analyse. You need to usually give the path as "/var" or "/usr" as they are the folders having maximum size
* Result will be stored in a file similar to "disk-space-analysis-var.txt" or "disk-space-analysis-usr.txt"
* You can view the result using following commands.

==================
egrep -w "[0-9][0-9][0-9]M|[0-9][0-9][0-9][0-9]M|[0-9]G|[0-9][0-9]G|[0-9][0-9][0-9]G" disk-space-analysis* | cut -d ":" -f 2 | sort -n
==================


Example:
=================================
[root@lnx06 bc]# bash disk-space-counter.sh


Enter path to analyse: /var
=================================
[root@lnx06 bc]# bash disk-space-counter.sh


Enter path to analyse: /usr
====================================
[root@lnx06 bc]# egrep -w "[0-9][0-9][0-9]M|[0-9][0-9][0-9][0-9]M|[0-9]G|[0-9][0-9]G|[0-9][0-9][0-9]G" disk-space-analysis* | cut -d ":" -f 2 | sort -n
1.1G /var
1.8G /usr
113M /var/lib
116M /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64
116M /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/jre
116M /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/jre/lib
116M /usr/share/locale
123M /usr/share/doc
129M /usr/libexec/webmin
134M /var/log/atop
141M /usr/bin
145M /usr/libexec
171M /usr/lib64/valgrind
192M /usr/lib/jvm
222M /var/log
309M /usr/lib
507M /usr/lib64
527M /usr/share
====================================

Last update:
2014-05-12 06:17
Author:
Sherin George
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags

top