Sub topic 14
Tracking Growth and Planning Capacity
Assume you are comfortable with SSH, sudo, filesystem paths, and basic shell commands. This chapter focuses on using measurements over time to decide when a filesystem needs attention or more capacity.
Measure the same thing repeatedly
A single df reading tells you the current state. Capacity planning needs a series of readings taken from the same filesystem and mount point. Record both block usage and inode usage because either limit can become the first failure.
date -Is
df -B1 --output=used,avail,pcent,target /
df -i --output=iused,iavail,ipcent,target /Run the commands at a regular interval, such as every 15 minutes or once per hour. Store the output in a monitoring system or a time-series file. Use the same units and exclude temporary filesystems so that unrelated mounts do not distort the trend.
The mount point matters. A server may have separate filesystems for /, /var, /home, or application data. Growth on /var does not consume free blocks on /home, even when both are on the same server.
Calculate growth and runway
For a useful estimate, compare readings separated by a known number of days.
- Block growth rate =
(new used bytes - old used bytes) / days - Inode growth rate =
(new used inodes - old used inodes) / days - Space runway =
available bytes / daily block growth - Inode runway =
available inodes / daily inode growth
If /var has 180 GB available and grows by 6 GB per day, the estimated space runway is 30 days. If it has 900,000 free inodes and consumes 75,000 per day, the inode runway is 12 days. The shorter runway controls the response.
Use several weeks of data when possible. Daily backups, weekly reports, log rotation, and monthly jobs can create repeating peaks. A straight-line estimate based on one busy day may be misleading.
| Observation | Likely meaning | Planning response |
|---|---|---|
| Used bytes rise steadily | Data or logs grow continuously | Estimate the exhaustion date and expand or reduce growth |
| Used bytes jump and then level off | Batch job, backup, or temporary data | Identify the job and measure the next cycle |
| Inodes fall faster than bytes | Many small files are being created | Find the directory and review retention or file layout |
| Free space changes after resizing | The capacity baseline changed | Start a new comparison period |
Turn measurements into decisions
Set an operational threshold before an incident occurs. For example, investigate at 80 percent, plan capacity at 85 percent, and treat 95 percent as urgent. Choose values based on how quickly the service can fail and how long expansion takes.
Include the time needed to obtain approval, provision storage, resize the filesystem, and verify the application. If the predicted exhaustion date is sooner than that lead time, act now.
A trend can also reveal inefficient retention. If logs grow by 2 GB daily but only seven days are needed, retaining 90 days locally consumes unnecessary capacity. Changes to retention should follow the service's operational and legal requirements.
Review the forecast
Recalculate after cleanup, retention changes, workload changes, or storage expansion. Keep the old data so you can compare forecasts with actual exhaustion dates. A forecast is useful only when its assumptions remain visible.
Exercise
A filesystem has 240 GB available and consumes 8 GB per day. It also has 600,000 free inodes and consumes 50,000 per day. Which limit arrives first?
Show answer
Space has 30 days of runway, while inodes have 12 days. Investigate inode growth first.