Course contentsShow
← Linux
Lesson 328 of 1,8193. The Filesystem Hierarchy and POSIX StandardsFree lesson

Capacity Planning for System Partitions

Model projected storage growth to define appropriate partition sizes for critical directories.

In this lesson, you will learn how to forecast storage requirements by modeling data growth patterns to allocate sufficient space for critical system directories.

The Logic of Partition Sizing

Capacity planning is the proactive process of determining how much disk space your system needs before it runs out. In a POSIX-compliant environment, directories like /var/log (logs), /home (user data), and /var/lib (database/container state) have vastly different growth behaviors. To model these, we treat them as independent functions of time and workload.

Modeling Growth Patterns

To plan effectively, you must categorize your directories by their growth profile:

  1. Linear Growth: Typically applies to standard user files. If your team adds 10GB of data a month, you can use a simple linear equation: FutureSize = CurrentSize + (GrowthRate * Time).
  2. Burst/Unpredictable Growth: Applies to /var/log or cache directories. These don't grow steadily; they often remain flat until a debugging session or an application spike causes an exponential jump in usage.
  3. Static/Fixed Growth: Applies to /usr or /bin. These directories only increase during system updates.

A Practical Forecasting Example

If you are managing a web server, you might track the growth of your logs in /var/log over a 30-day period. If you find your logs are growing by 500MB per week, your planning model looks like this:

# Weekly growth: 500MB
# Forecast window: 6 months (26 weeks)
# Total needed = Current_Usage + (500MB * 26)

TOTAL_CAPACITY=$(( $(du -sm /var/log | cut -f1) + (500 * 26) ))
echo "Recommended capacity for /var/log: ${TOTAL_CAPACITY}MB"

By calculating this value, you prevent the common "disk full" error that triggers kernel panic in write-heavy applications. When you use this data to inform your Logical Volume Management (LVM) setup, you can allocate just enough space today while leaving physical volume head-room to extend partitions later as the models change.

Remember, capacity planning is not about guessing; it is about gathering data points over time and using them to calculate the "runway" your filesystem has before it requires intervention.

Key Takeaway: Effective capacity planning requires measuring historical growth rates per directory and projecting them forward to ensure your partitions can accommodate future demand without exhausting underlying storage.