A Linux filesystem rarely jumps from healthy to full without leaving clues. Application logs accumulate, database files expand, backups overlap, container layers linger, and user uploads grow a little each day. A one-time df check shows the current position, but Linux disk capacity monitoring turns repeated measurements into enough warning to act before storage becomes an incident.
The practical goal is not to predict an exact failure date months in advance. It is to estimate whether a filesystem is stable, growing normally, or approaching an operating limit faster than the team can safely respond. For anyone searching for “capacity monitoring disk Linux,” the missing ingredient is usually history: collect consistent values, compare like-for-like periods, and report the trend alongside the current percentage.
Why a current disk percentage is not a capacity plan
A threshold such as 80% is useful, but it does not explain urgency by itself. A 72% full volume that has not changed for six months may need no immediate work. Another volume at 54% that grows five percentage points each week could become the greater risk very quickly.
Percentage also hides scale. Ten percent free on a 100 GB root volume is 10 GB; ten percent free on a 20 TB data volume is 2 TB. Workloads consume storage in bytes, not percentages, so a useful report includes both. It should also distinguish the filesystem's technical maximum from the operating limit where the team wants to intervene.
Capacity planning is therefore a combination of four facts:
- Current use: used bytes, available bytes, percentage used, and inode use.
- Rate of change: how many bytes or percentage points are added per day or week.
- Operating limit: the point where cleanup, expansion, or workload changes must begin.
- Response lead time: how long the chosen action takes to approve, test, and complete.
Collect stable Linux filesystem measurements
Start with the POSIX output format from df. It is easier to parse consistently than human-friendly output, while df -B1 provides byte values when GNU coreutils is available. Exclude temporary and pseudo filesystems so short-lived runtime mounts do not pollute the capacity history.
# Percentage and block-based view
LC_ALL=C df -P -x tmpfs -x devtmpfs
# Byte values on GNU/Linux
LC_ALL=C df -B1 -P -x tmpfs -x devtmpfs
# Inode capacity
LC_ALL=C df -Pi -x tmpfs -x devtmpfs
Record the timestamp, hostname, filesystem or device identifier, mount point, total bytes, used bytes, available bytes, and inode values. Capture the command exit status too. If collection fails, store an explicit error or unknown state; never turn missing output into a healthy zero.
Use stable mount-point configuration for filesystems that matter. Device names can change after reboot or storage reconfiguration, and dynamic container mounts can appear and disappear. A small allowlist for /, /var, application data, database data, and backup targets usually produces a cleaner operational report than collecting every mount without context.
Check inodes as well as free bytes
A filesystem can have gigabytes free and still reject new files when it runs out of inodes. This is common when an application creates huge numbers of cache files, sessions, queue fragments, mail items, or tiny log files. The symptoms can look like ordinary disk exhaustion even though byte usage appears safe.
Track inode percentage with the same history and status rules used for bytes. When inode use rises unusually fast, count files in likely directories and identify the creating process before deleting anything. The corrective action may be a retention rule, application fix, or filesystem redesign rather than simply adding storage.
Store history in a simple, durable format
Disk forecasting on Linux does not require a complex time-series platform. A CSV file, SQLite database, or small central table is enough for a handful of servers, provided observations use consistent units and timestamps. JSON Lines is also convenient when collectors send records to another system.
{"observed_at":"2026-11-23T08:00:00Z","host":"web-01","mount":"/var","total_bytes":107374182400,"used_bytes":67645734912,"available_bytes":39728447488,"used_percent":63,"inode_percent":18,"status":"ok"}
Write observations atomically and prevent overlapping collectors with a lock. Keep enough history to see normal cycles: at least eight to twelve weeks for weekly reporting, and longer for seasonal businesses. Preserve storage-resize and migration events as annotations because they change the baseline.
Calculate a useful growth rate
The simplest growth rate compares two observations:
growth_per_day = (latest_used_bytes - earlier_used_bytes) / elapsed_days
That calculation is easy to understand, but two points can be misleading. A temporary backup, log rotation, package update, or cleanup may make one day unusual. A rolling median of daily changes or a linear trend across several weeks is more stable. Use the median when you want resistance to spikes; use linear regression when the data is reasonably smooth and you want an interpretable slope.
Always compare equivalent moments. If backups create a large temporary file every night, measurements taken during the backup should not be mixed casually with measurements taken after cleanup. Collect at a consistent time, or deliberately track both peak and settled usage. Capacity must cover the peak even when forecasting is based on settled growth.
Forecast the operating limit, not absolute zero
Once the growth rate is positive, estimate the time remaining to the chosen operating limit:
limit_bytes = total_bytes * operating_limit_percent / 100
remaining_to_limit = limit_bytes - used_bytes
estimated_days_to_limit = remaining_to_limit / growth_per_day
Suppose a 500 GB application volume is 68% full and growing by 2 GB per week. If the operating limit is 80%, approximately 60 GB remains before that threshold, giving about 30 weeks at the recent rate. That is not a guarantee. It is a planning signal that should be revised with each new observation.
Do not calculate a date when the trend is flat, negative, based on too little data, or statistically erratic. Report “no reliable forecast” and explain why. Honest uncertainty is more useful than a precise-looking date built from a temporary spike.
Choose thresholds around response time
Generic 80% and 90% thresholds are common, but disk capacity planning for a server should reflect how the system behaves and how long remediation takes. A cloud block volume that can be expanded online may need less lead time than an encrypted local array requiring procurement, downtime, and tested recovery procedures.
- Healthy: current use is within range and the forecast provides ample lead time.
- Watch: growth has accelerated, available capacity is declining, or the estimated limit is within the planning window.
- Action required: the limit is likely before remediation can be completed safely.
- Unknown: observations are missing, stale, inconsistent, or insufficient for a forecast.
Include minimum absolute free-space rules. A very small root filesystem may need a warning even below a percentage threshold, while a large archive volume can operate safely at a higher percentage if growth and workload requirements are understood. Document any filesystem-specific reserve requirements as well.
Find what is consuming the growth
A forecast tells you when action may be needed, but not what action is appropriate. When a trend changes, identify the directories and file classes responsible. Run deeper scans deliberately because recursive disk analysis can be expensive on busy or very large filesystems.
# Top-level directory sizes on one filesystem
sudo du -x -B1 --max-depth=1 /var 2>/dev/null | sort -n
# Large regular files, without crossing filesystem boundaries
sudo find /var -xdev -type f -size +500M -printf '%s %p\n' 2>/dev/null | sort -n
# Deleted files still held open by a process
sudo lsof +L1
Common causes include unbounded logs, database binary logs, old releases, abandoned container images, package caches, duplicate backups, generated media, and deleted files that a running process still holds open. Confirm ownership and retention requirements before removing data. A hurried deletion on a nearly full server can cause more damage than the capacity problem.
Plan cleanup and expansion safely
Cleanup should be policy-driven and repeatable. Configure log rotation, application retention, backup lifecycle rules, and container pruning with explicit age or ownership criteria. Test each rule on representative data and log what it removes. Avoid broad commands whose safety depends on the current working directory or filename expansion.
If growth is legitimate, expansion may be the correct response. Check the full storage chain: cloud or physical device, partition table, RAID or LVM layer, encryption mapping, filesystem, mount configuration, backup capacity, and recovery procedure. Increasing the underlying disk does not always enlarge every layer automatically.
Record the change in the capacity history. A resize creates a step change in total and available bytes; without an annotation, reporting logic may misinterpret it as cleanup or corrupted data.
Account for databases, logs, and backup peaks
Different workloads need different context. MySQL storage can grow through table data, indexes, temporary files, binary logs, and backups. Retention changes or a large import can invalidate a trend based on ordinary transactional growth. Pair filesystem observations with database-size and binary-log evidence where possible.
Log volumes often grow in bursts during incidents. Keep a normal trend, but separately verify that the filesystem has room for an abnormal logging period. Backups can create temporary peaks even when retention keeps long-term use flat. Monitoring only after old backups are deleted may miss the actual maximum space needed to complete the next run.
Automate collection without hiding failures
Run the collector from a systemd timer or cron under an account with only the permissions it needs. Use absolute command paths, a controlled locale, timeouts, locking, and explicit output validation. Send records centrally or retain them locally with backups appropriate to their value.
Alert when collection itself becomes stale. A capacity report based on a month-old observation can look reassuring while the server is filling rapidly. Show the latest successful collection time and distinguish “filesystem healthy” from “filesystem was healthy when last checked.”
Test failure paths on a non-production system: inaccessible mounts, malformed command output, timeouts, renamed mount points, and a collector that cannot write its history. These tests prove that an unknown state will be visible rather than silently omitted.
Turn disk forecasts into a weekly decision report
A concise weekly report is often more useful to a small team than another dashboard. For each important filesystem, include current use in bytes and percent, inode use, change since last week, recent growth rate, estimated time to the operating limit, status, and recommended next step.
Highlight only meaningful movement. A stable volume can be summarized in one line. A filesystem with accelerated growth should include likely contributors, the data window behind the forecast, the response deadline, and an owner. Carry unresolved actions forward until verification shows that the risk has cleared.
- Collect byte and inode usage at consistent times.
- Keep at least several weeks of comparable history.
- Use robust growth calculations instead of one-day changes.
- Forecast a documented operating limit with stated uncertainty.
- Include remediation lead time in the status decision.
- Investigate growth by directory and workload before deleting data.
- Annotate cleanups, migrations, and storage expansions.
- Report stale or failed collection as unknown, not healthy.
Make storage growth visible before it becomes urgent
Storage capacity planning on Linux works best as a repeated operational habit: collect consistent evidence, compare it with history, estimate the planning window, and attach a safe next action. The result is not a perfect prediction. It is enough warning to choose between cleanup, retention changes, workload redesign, and expansion without crisis-driven decisions.
DMCloud Architect turns Linux disk, inode, database, backup, and other health signals into a concise weekly report for developers and small business owners. See trends and risks without adding another dashboard to watch with Infrastructure Health Reporting.