Disk Space management tools for Linux Server?

bleggee
bleggee used Ask the Experts™
on
Can anyone suggest any SW tools/utilities/commands to help manage disk space, identify space hogs, etc for a Linux Server?
(If it matters, it is a web server, headless CentOs 7 LAMP)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
John TsioumprisSoftware & Systems Engineer

Commented:
SInce you are headless you either go for a text based disk usage application like DUtree or if you have webmin then you can go to File Manager.and as you hover over the folder name you will get 3 vertical dots...click on them and in the last entry in the context menu you will see Properties -->Calculate Selected Size
EDIT 1 : Well this was a bit quirky...there is an old module for Webmin called Disk Usage ...install the 1.2 version and you should see it under Others...somehow this should be the END but the module by default only queries the /tmp folder when the issue is to get the whole disk...so if you look carefully you will see a faded cog for settings...hit it and change to / let it calculate/collect and that's all...all the info in a single click
EDIT 2: it's added in the side notification panel and you have a quick overiew or click to have the whole pictureClipboard01.jpg
Software Engineer
Distinguished Expert 2018
Commented:
Usage:
du -s / | sort         #  (Disk usage, sorted) or
du -sh / | sort -h     # more understandable numbers

Open in new window


and from there select a directory and use that... f.e. for /var
du -s /var | sort            #or
du -sh /var | sort -h

Open in new window


Freespace:
df                                  # freespace

Open in new window

That will show the free space per filesystem (disk).

Management:
rm / mv     # user remove or move to get rid of data, move it to another location
cp             # Copy data to another location.    all can work with -r to dive down.

Open in new window


Another thing that should be possible is to setup quota on disks. That would limit the amount of data that is allowed to be used on the filesystem.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
I'd add these 2x to noci's list too, which simply add the -h (human option) for faster reading of output.

df -h
df -hi

Open in new window


I also use pyha like this...

# shell startup file
alias lsfs='pydf -ha | grep -P /dev/md | grep -v /var/lib/lxd'

# lsfs
/dev/md4    1804G 1111G  601G 61.6 [####..] /                              
/dev/md4    1804G 1111G  601G 61.6 [####..] /david-favor

Open in new window

Duncan RoeSoftware Developer

Commented:
I use this script
#!/bin/sh
#set -x
T=$(mktemp)
mount >$T
find . -mount -mindepth 1 -maxdepth 1 -type d |
  while read i
  do
    grep -E -q "on $(readlink -f "$i") " $T || du -sx "$i"
  done | sort -n
rm $T

Open in new window

which I have named vss, as below
vss>vss.out
cat vss.out

Open in new window

The largest directories are at the bottom, so are left on the screen. Run it in /, then in the largest few identified directories. ls -lSr (sort by size) if you don't see big directories in the next level down.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial