Diagnostics of disk space on the server

How to control the disk space occupied by the server.

Disk Space Diagnostics via SSH

If you need to check how much disk space is occupied and which files or directories take up the most space, you can use the df and du commands with different options.


Using df

To check the total disk size and available space, run:

# df -h /
Filesystem      Size  Used  Avail  Use%  Mounted on
/dev/vda1      9.8G  3.5G   5.9G   38%   /
  • Size — total disk size.
  • Used — space currently occupied.
  • Available — free space on the disk.

Analyzing Disk Usage with du

To find out which directories occupy the most space, use:

# du -hs /*
0     /bin
100M  /boot
0     /dev
39M   /etc
4.0K  /home
0     /lib
0     /lib64
16K   /lost+found
4.0K  /media
4.0K  /mnt
4.0K  /mnt2
156K  /opt
0     /proc
128K  /root
29M   /run
0     /sbin
4.0K  /srv
40M   /swapfile
0     /sys
72K   /tmp
2.3G  /usr
1008M /var

Once you identify a directory that takes up a lot of space, you can check its contents in detail:

# du -hs /usr/*
170M    /usr/bin
4.0K    /usr/etc
4.0K    /usr/games
44K     /usr/include
582M    /usr/lib
219M    /usr/lib64
38M     /usr/libexec
869M    /usr/local
49M     /usr/sbin
412M    /usr/share
12K     /usr/src
0       /usr/tmp

To display only directories larger than 1MB:

# du -hs /usr/* | grep M
170M    /usr/bin
582M    /usr/lib
219M    /usr/lib64
38M     /usr/libexec
869M    /usr/local
49M     /usr/sbin
412M    /usr/share

Checking Quotas with repquota

To check user quotas, you can use the repquota command. In ISPmanager, quotas are assigned per user group, so the query would look like this:

# repquota -g / | grep user21
user211 --  254948   0   5242880    1756     0     0
user212 --  2622280  0   5242880    37930    0     0
user213 --  668776   0   5242880    35090    0     0
user214 --  43860    0   5242880    2507     0     0
user215 --  75788    0   5242880    8950     0     0
user216 --  24864532 0   78643200   267      0     0
user217 --  297576   0   5242880    1820     0     0
user218 --  129208   0   5242880    11305    0     0
user219 --  411052   0   5242880    15262    0     0

Help

If you encounter any difficulties or need assistance, please create a request to our support team through the ticket system, and we will be happy to help you.

Нужна помощь?Наши инженеры бесплатно помогут с любым вопросом за считанные минутыНаписать нам