Working with disk space

It is important to monitor the disk subsystem when using a VPS server. There should always be free space for applications and files.

If you run out of disk space, errors will occur during operation, files and databases may also be damaged.

If there is not enough free space, delete unnecessary files. When you increase the scale of projects or their number, you can expand the disk or switch to a new tariff.

The df, lsblk, parted, fdisk commands allow you to find out the amount of disks and the amount of free space. You can use the du and ncdu utilities to analyze the disks activity.

It is also recommended to check inodes when analyzing the disk subsystem.


du (disk usage) is available in all UNIX operating systems and does not require installation. Provides general information about the occupied space on the disk subsystem.

Also du can be used in cases where there is no free disk space to install other utilities.

After executing the command, you will receive information about how much disk space each file and folder in the current directory takes.

Basic du commands

  • -h – display the disk usage (Mb, Kb)
  • -s – display the total size of the specified folder
  • -c – output of total results

For example, to see the size of all folders in the root directory, enter:

du -shc /*
  • -a – to see the disk usage of all files
  • -k – to see disk usage by a directory tree (in kilobytes)
  • - -exclude – excludes files of a specific format from the evaluation of disk usage. For example, if we want to remove jpeg files from the output:
du -ah --exclude="*. jpeg "
  • -time – displays the date the files were last modified.

For example, to determine the size of files and the date of their last changes, enter:

du -ah --time


ncdu – utility for monitoring the disk subsystem. Thanks to the graphical interface, it is much easier and more convenient to work with it.

To install ncdu enter:

Debian, Ubuntu

apt install ncdu


yum install ncdu

To get information about a specific directory, enter:

ncdu directory_name

To analyze the root directory:

ncdu /

The number of # shows which files and folders are taking up the most disk space.

The first column may contain the following designations:


directory read error


subdirectory read error


is included in the calculation o


from a different filesystem


is not a file or directory


has already been taken into account


empty directory

 Navigation in ncdu

up arrow, down arrow

moving through directories

Enter, right arrow

directory entry

left arrow

return to the previous directory

Interface functions in ncdu


sort by name (ascending, descending)


sort by size (ascending, descending)


display change (in percent and in #)


display of actual size or used disk space


show/hide hidden files and directories


call for help


deletion (confirmation required)


information about the selected item


- output

Keys used in ncdu

  • -h quick reference information.
  • -q update every 2 seconds (default 10 times per second).
  • -x only directories and files of the same file system are considered during scanning. Mounted directories are not counted.
  • -r read mode, delete is not available.
  • --exclude excluding a file or file type. That is, the files will be present in the output, but will not affect the calculation of the disk usage.
ncdu --exclude=/path/to/directory/*exception *

For example, to exclude jpeg files, enter:

ncdu --exclude=/path/to/directory/*.jpeg

-о saving analysis results to a file:

ncdu / -o path/save/file.txt

Why don't the du, ncdu and software data match?

1. If the control panel and when analyzing the disk space using the du, ncdu utilities shows that there is free space, but the applications still report that there is not enough free space, check inodes.

2. If du and ncdu show less free space than in the control panel, or applications report insufficient free space even after deleting files, check the file system. Run df command:

df -h

Most likely, the command output will contain information about full disk usage. The du and ncdu utilities show how much disk space is physically used. If the file after deletion is available to the active process, the system takes it into account when counting.

Determine which processes are using the deleted files:

lsof | grep '(deleted)'

Restart these processes:

service process_name restart

If you have any questions, please create a ticket to technical support.