Disk space

On this page 7

Disk space is the amount of persistent storage capacity available on a server’s drives or volumes for the operating system, applications, databases, logs, caches and user files. Among server resources, it is the one that behaves most like a hard wall: CPU or memory pressure usually slows a system down, but a full file system typically makes writes fail outright.

In server administration, disk space is measured not only in bytes but also in inodes, the file system entries that describe each file. A volume can report free gigabytes and still refuse new files if it runs out of inodes, so both figures belong in monitoring.

How disk space is allocated and consumed

A server stores data on block devices (physical disks, SSDs or virtual volumes) that are divided into partitions or logical volumes and formatted with a file system such as ext4, XFS, NTFS or ZFS. The file system allocates space in blocks, commonly 4 KB, so even a tiny file consumes at least one full block.

Several mechanisms make the reported numbers differ from what users expect. Linux ext file systems keep reserved blocks, by default 5% of the volume, for the root user so that system processes can still write when ordinary users fill the disk. Deleted files held open by a process keep consuming space until that process closes them or restarts, which explains why freeing space sometimes appears to have no effect.

The following table shows the main consumers of disk space on a typical web or application server.

ConsumerGrowth patternTypical control
Log filesContinuous, can spike during errorsLog rotation and compression
DatabasesSteady growth plus temporary filesArchiving, cleanup, separate volume
Backups and snapshotsLarge periodic jumpsRetention policy, off-host storage
Caches and temp filesFluctuatingSize limits and scheduled cleanup
Uploads and user contentDriven by user activityQuotas and object storage
Container imagesAccumulates with each deploymentPruning unused images
Common consumers of disk space on a server

Key metrics for measuring disk space

Monitoring disk space correctly means tracking several distinct metrics, because each one can run out independently. Administrators usually check them with commands such as df -h for byte usage, df -i for inodes and du for the size of individual directories.

MetricWhat it measuresWarning sign
Used percentageShare of capacity in useSustained above about 80-85%
Free bytesAbsolute remaining capacityLess than a few days of growth
Inode usageShare of file entries in useHigh with many small files
Growth rateChange per hour or daySudden acceleration
Time to fullProjected days until 100%Shorter than response time
Disk space metrics and what they reveal

Of these, growth rate and projected time to full are the most useful for alerting. A volume at 90% that grows by a few megabytes a month is far less urgent than one at 60% that is filling at several gigabytes an hour, so trend-based alerts catch real problems earlier than fixed percentage thresholds.

Disk space describes capacity, while other storage-related resources describe speed or contention. Confusing them leads to the wrong fix, such as adding a larger disk when the real problem is slow access.

ResourceQuestion it answersEffect when exhausted
Disk spaceHow much data can be storedWrites fail, services crash
Disk I/OHow fast data can be read and writtenSlow responses
I/O waitHow long the CPU waits for storageHigh load, idle CPU
SwapDisk used as overflow for memorySevere slowdown
Memory usageHow much RAM is in useOut-of-memory kills
How disk space differs from neighboring resources

The resources still interact. Swap files occupy disk space, a full disk can block swap growth, and heavy log writing during an incident consumes both I/O capacity and free space at the same moment.

Managing disk space in practice

Effective disk space management combines separation, limits and automation. Placing logs, databases and application data on separate volumes prevents one runaway consumer from filling the root file system and taking down the whole server.

  • Configure log rotation with size and age limits, and compress old logs.
  • Set retention policies for backups, snapshots and temporary exports.
  • Use quotas for users or tenants on shared hosting servers.
  • Alert on growth trends, not only on fixed thresholds.
  • Plan expansion as part of capacity planning, using logical volumes or cloud disks that can grow online.

On virtual and cloud servers, volumes can usually be resized without downtime, but the file system must then be extended as a separate step. Shrinking is much harder and often unsupported, so it is wiser to grow storage in moderate increments than to overprovision heavily.

Risks of running out of disk space

A full disk causes failures that often look unrelated to storage. Databases may refuse writes or crash, web servers cannot write session files or uploads, package updates break halfway and monitoring agents stop reporting exactly when they are needed.

SymptomHidden causeFirst response
No space left on deviceBytes or inodes exhaustedCheck both df and df -i
Space not freed after deleteFile still held openRestart or signal the process
Database in read-only modeData volume fullFree space, then verify integrity
Root volume fullLogs or temp files on rootMove them to a separate volume
Symptoms of exhausted disk space and how to respond

The most important warning is to never delete files blindly to recover space. Removing active database files or the wrong log can cause data loss; the safe approach is to identify the largest consumers first, then compress, move or rotate before deleting.

The idea in brief

Disk space is the storage room of a server. Every program, log entry, database record and uploaded file needs a place on the disk, and that room has a fixed size.

When the room is nearly full, the server keeps working normally. When it is completely full, it simply cannot store anything new, and programs that need to write data start to fail. The key takeaway is to watch how fast the room is filling up and to clean it regularly, long before it overflows.

A practical scenario

A small company runs its online shop on a single virtual server with a 100 GB disk. One night, a misconfigured payment plugin starts writing a detailed error message for every request, and the application log grows by about 4 GB per hour. By morning the disk is full, the database switches to read-only behavior and customers cannot complete orders.

The administrator finds the oversized log with du, compresses and archives it, and restarts the affected service. Afterwards, the team moves logs to a separate volume, adds size-based log rotation and creates an alert that fires when the projected time to full drops below 24 hours. The result is that a similar incident a few months later is caught and fixed within minutes, with no effect on sales.