frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

How to check which files/folders are taking the most space on your server?

VPS servers could are usually limited by disk space and/or Inodes(file number). If a server reaches the limit, it may cause some problems and the server might stop working correctly. When you lack disk space and/or Inodes, the server will not function normally. When a task/app is executed it usually creates a temporary file and if you have no disk space/inodes for that, it will simply get stuck and might cause further issues.

When you are near the end of free disk space, usually the server informs you about it if you use any control panel, but you can check the disk space or Inodes periodically yourself in order to manage it.

Checking disk space

The disk space can be check using the following commands:

Check the general disk space usage on the server

df -h

Check the folder you are in content, files, and how much space it takes:

du -h

Check  only the disk space of the folder you are opened:

du -hs

Check any folder and the size of files/folders in it:

du –hs /etc

Checking files that are larger than 1024kb:

find / -mount -size +1024k -type f -exec du -Sh {} \;|sort -rh

Checking inodes usage

Checking the inodes on the folder you are in:

for i in 'ls -1A'; do echo "'find $i | sort -u | wc -l' $i"; done | sort -rn | head -5

Checking the top 50 folders by inode usage:

du -a / | sort -n -r | head -n 50

Note. You can use this command within the specific folder:

cd /etc
du -a / | sort -n -r | head -n 50

Tagged:
Sign In or Register to comment.

Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2021 Time4VPS. All rights reserved.

Get In Touch