How much storage am I using?
Two commands can give you very different answers for the same folder. This page shows which one to use when you need a figure for storage reporting, and what the difference means.
Use this command#
du -sh --apparent-size /path/to/directoryFor example:
du -sh --apparent-size /projects/<project>/people/<KU-ID>This reports the apparent size: the logical size of the files under that directory. Use this figure when you are asked how much data you store, and when you are planning storage capacity, transfers, or backups.
Allocated size and apparent size#
du -sh on its own is a common and perfectly valid command — it just answers a different, more technical question.
- Apparent size (
--apparent-size) is the logical size of your files: the size they appear to have when you list, copy, archive or transfer them. - Allocated size (plain
du -sh) is how much room the filesystem has set aside to hold them. Storage is handed out in fixed blocks, so a small file still occupies a whole block, and filesystem features can change how much space a file really takes up on disk.
Neither number is wrong. They answer different questions: how large is my data, versus how much room is it occupying on this particular filesystem right now.
Note The two figures often differ most when you have very many small files, or files stored in an unusual way — sparse files, for example, can appear much larger than the room they occupy. A large gap between the two is not in itself a sign that something is wrong.
Why apparent size is used for reporting#
Apparent size is a practical basis for reporting because it describes your data rather than the storage technology underneath it. It stays meaningful if data is moved between systems, it is the figure that matters when you estimate a transfer or plan where a dataset should live, and it does not change just because the underlying filesystem organizes blocks differently.
Important Apparent size is not a backup multiplier, and it does not mean "your data plus its backups". It is simply the logical amount of data you store.
Actual backup storage can differ from this figure in either direction, because backup systems may use compression, deduplication, snapshots and their own retention rules. That is a separate question from how much data you are storing — see Snapshots and recovery.
Seeing where the space goes#
To find which subfolders account for most of your data:
du -h --apparent-size --max-depth=1 /path/to/directory | sort -hThis lists each immediate subfolder with its own total, sorted smallest first — so the largest entries are at the bottom of the output, where they are easy to spot. Increase --max-depth to go deeper, one level at a time.
Large scans take time#
du works by walking every file underneath the path you give it. On a folder with a lot of files this can take a long while and puts load on the shared filesystem, which affects everyone.
A few habits that help:
- Start at a specific folder rather than a whole project when you can.
- Run one scan at a time, and let it finish before starting another.
- Use
--max-depth=1first to see which subfolder is worth looking into, instead of scanning everything deeply straight away.
Tip If a scan is likely to take a long time, run it from a job rather than on the login node — see Login nodes vs compute nodes.
If you want the allocated figure too#
Plain du -sh remains useful as a technical check of how much room your data occupies on this filesystem:
du -sh /path/to/directoryJust don't use it as your storage reporting estimate — use the --apparent-size figure for that.
