Shared server guidance · Question & answer

How do I find which directories consume space without crossing other mounted filesystems?

du measures the space accounted to files and directories it can traverse. Start with the affected filesystem and a shallow summary, then narrow to the relevant application. A size ranking tells you where space is used, not which data is safe to remove.

IntermediateLinux VPS and dedicated servers with GNU utilities
Go to the answer

Before you start

  • Permission to inspect the affected directories.

Instructions

1. Summarise a single filesystem level

Use a path already identified by df. Administrative access may be needed for a complete authorised view, and a large tree can generate meaningful read I/O.

Remote Linux shell
sudo du -xhd 1 /var | sort -h

-x stays on the same filesystem, -d 1 limits printed depth, and -h formats values. The traversal can still inspect many files below each directory.

2. Narrow to the responsible application

Repeat only within the large directory that belongs to the affected workload. Distinguish databases, package caches, application uploads and logs before deciding what retention policy applies.

Remote Linux shell
sudo du -xhd 1 /var/log | sort -h

This example inspects log directories. A separate mount beneath the path is excluded by -x and should be assessed explicitly if relevant.

Check the result

  • The capacity is attributed to named applications or data types, and the next action follows their supported retention or storage-expansion procedure.

Troubleshooting

du reports less space than df
Consider inaccessible files, deleted-open files, snapshots, filesystem metadata and mount boundaries.
The scan itself affects performance
Reduce the scope and run during a suitable period; do not launch repeated full-tree scans on a busy server.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.