Skip to main content

Filesystem & Storage Playbook

From an SRE perspective, filesystem & storage knowledge is not theoretical. It directly impacts:

  • Availability (disk full โ†’ outage)
  • Performance (I/O bottlenecks)
  • Security (wrong permissions โ†’ breach)
  • Scalability (poor volume planning โ†’ incidents)
  • Recovery (RAID/LVM mismanagement โ†’ data loss)
Intermediate ๐Ÿ“‹ Quick reference: Incident Response Mastery โ†’
Learn this in 10 minutes10 min
  1. Learn the inode trap: a disk can be full while df shows free space
  2. Know when to use LVM and what each RAID level trades off
  3. Review permissions, special bits, and ACLs for common outages
  4. Follow the Storage Incident Debugging Playbook for the next disk alert

Table of Contentsโ€‹

  1. Filesystem Hierarchy Standard
  2. Filesystem Commands
  3. Inodes โ€” Silent Production Killer
  4. LVM
  5. RAID Concepts
  6. File Permissions
  7. Special Bits
  8. umask
  9. ACLs
  10. Real SRE Incident Scenarios
  11. Storage Incident Debugging Playbook
  12. Senior SRE Storage Checklist

๐Ÿงญ Mental modelFive ways filesystem knowledge shows up as SRE riskFilesystem and storage knowledge fans out into five production concerns: availability, performance, security, scalability, and recovery.Filesystem & Storagenot theoretical โ€” production riskAvailabilitydisk full โ†’outagePerformanceI/ObottlenecksSecuritywrong perms โ†’breachScalabilitypoor volumeplanningRecoveryRAID/LVMmismanaged

Filesystem and storage decisions are not theoretical for an SRE โ€” the same underlying knowledge, from inodes to LVM to permission bits, is what determines availability, performance, security, scalability, and recovery outcomes in production.

1. Filesystem Hierarchy Standard (FHS) โ€” Why SREs Careโ€‹

FHS defines where things live in Linux. As an SRE, this helps you debug systems fast.

๐Ÿ”น /etc โ†’ Configurationโ€‹

Contains system & application configs: /etc/passwd, /etc/fstab, /etc/nginx/nginx.conf

๐Ÿ”ฅ SRE Impact: misconfigured /etc/fstab โ†’ system won't boot. Broken service config โ†’ production outage. Configuration drift across servers โ†’ inconsistency.

๐Ÿ›  Monitor: track config changes (GitOps, Ansible), audit sensitive file changes, backup critical configs.

๐Ÿ”น /var โ†’ Logs & Changing Dataโ€‹

Contains /var/log (system & app logs), /var/lib (databases, app state), /var/spool (queues).

๐Ÿ”ฅ Classic SRE Incident:

Logs grow โ†’ /var fills โ†’ system crash
Database can't write โ†’ corruption
Kubernetes node โ†’ NotReady

๐Ÿ›  Monitor: disk usage specifically on /var, log rotation health, alert at 70โ€“80% usage.

๐Ÿ”น /proc โ†’ Kernel & Process Info (Virtual FS)โ€‹

/proc/cpuinfo
/proc/meminfo
/proc/<pid>/

Used heavily in observability tools. SRE usage: debug memory leaks, check open file descriptors, monitor process limits.

๐Ÿ”น /sys โ†’ Kernel & Device Interfaceโ€‹

Interface to kernel and hardware. Used for tuning performance and inspecting device state. Advanced SRE work (low-level tuning, containers, cgroups).

๐Ÿ”น /dev โ†’ Devicesโ€‹

Represents disks: /dev/sda, /dev/nvme0n1

Production relevance: mounting the wrong disk = catastrophic data loss.

๐Ÿ”น /run โ†’ Runtime Stateโ€‹

Stores PID files, sockets, lock files. Temporary โ€” cleared on reboot.


2. Filesystem Commands (SRE Operational Toolkit)โ€‹

df -h โ†’ Disk Freeโ€‹

Shows disk usage by mounted filesystem.

๐Ÿšจ Incident pattern: filesystem 100% โ†’ application crashes. SRE tip: always check inode usage too (see below).

du -shโ€‹

Finds what's consuming space.

du -sh /var/*

Used during disk pressure incidents.

mount, umountโ€‹

Mount filesystems. Critical in: NFS failures, EBS volumes in cloud, Kubernetes persistent volumes.

lsblkโ€‹

Shows block devices hierarchy. Useful for debugging new volume attachment and verifying LVM layout.

blkidโ€‹

Shows filesystem type + UUID. Important for /etc/fstab troubleshooting and recovery after reboot failure.

findmntโ€‹

Better way to see the mount tree.


3. Inodes โ€” Silent Production Killerโ€‹

๐Ÿ”น What is an inode?โ€‹

An inode stores file metadata: permissions, owner, block pointers. It is NOT the filename โ€” just metadata.

๐Ÿ”ฅ How Inode Exhaustion Breaks Systemsโ€‹

You can have 0% disk usage but 100% inode usage โ€” e.g. millions of tiny log files.

Result: cannot create files, applications crash, Kubernetes pods fail, email servers stop.

Check with:

df -i

SRE Monitoring: monitor inode usage %, especially for log directories, temp directories, and container systems.


4. LVM (Logical Volume Manager)โ€‹

Used heavily in production. Why SREs love LVM: resize disks without downtime, flexible storage allocation, snapshot capability.

๐Ÿ”น Key Conceptsโ€‹

PV โ†’ Physical Volume (actual disk)

pvcreate /dev/sdb

VG โ†’ Volume Group (pool of storage)

vgcreate myvg /dev/sdb

LV โ†’ Logical Volume (usable partition)

lvcreate -L 10G -n mylv myvg

๐Ÿ”น Extending Volume Online (Real Incident Case)โ€‹

Disk full โ†’ extend without reboot:

lvextend -L +10G /dev/myvg/mylv
resize2fs /dev/myvg/mylv

โš ๏ธ If you forget resize2fs, the filesystem won't grow.

SRE Best Practice: use LVM for databases, keep root small, keep data volumes separate, monitor VG free space.


5. RAID Concepts (Redundancy & Reliability)โ€‹

RAID = data redundancy or performance improvement.

๐Ÿ”น RAID Levelsโ€‹

LevelPurposeSRE View
RAID 0PerformanceโŒ No redundancy
RAID 1Mirroringโœ” High safety
RAID 5Striping + parityBalanced
RAID 10Mirror + stripe๐Ÿ”ฅ Production favorite

๐Ÿ”น /proc/mdstatโ€‹

Check RAID health:

cat /proc/mdstat

Shows degraded arrays and rebuild progress.

๐Ÿ”ฅ Real SRE Failure: disk fails in RAID5 โ†’ not replaced โ†’ second disk fails โ†’ total data loss.

Monitor: RAID state, rebuild events, disk SMART health.


6. File Permissions โ€” Security & Stabilityโ€‹

๐Ÿ”น rwx Modelโ€‹

User    Group    Others
rwx rwx rwx

Example: -rwxr-xr--

chmodโ€‹

chmod 755 file

Meaning: owner full, others read/execute.

chownโ€‹

Change ownership. Critical for web servers, databases, Kubernetes volumes.


7. Special Bits (Advanced SRE Knowledge)โ€‹

๐Ÿ”น SUID (4000)โ€‹

Executable runs as the file owner. Example: /usr/bin/passwd. โš ๏ธ Security risk if misused.

๐Ÿ”น SGID (2000)โ€‹

In directories: new files inherit the group. Used in shared dev directories.

๐Ÿ”น Sticky Bit (1000)โ€‹

Common on /tmp. Prevents users from deleting others' files.


8. umaskโ€‹

Default permission mask.

umask 022

Prevents overly permissive files. SRE concern: bad umask โ†’ security vulnerability.


9. ACLs (Access Control Lists)โ€‹

When rwx isn't enough.

getfacl file
setfacl -m u:user:rw file

Used in enterprise systems, shared storage, complex permission models.


๐Ÿ”ฅ Real SRE Incident Scenariosโ€‹

  1. Disk Full โ†’ Production Down โ€” Cause: log rotation misconfigured.
  2. Inode Exhaustion โ€” Cause: millions of temp files.
  3. RAID Degraded โ†’ Ignored Alert โ†’ Data Loss
  4. Wrong chmod โ†’ Application Can't Start
  5. Mounted Wrong Volume โ†’ Overwritten Data

๐Ÿ“Š What SRE Should Monitorโ€‹

MetricWhy
Disk usage %Prevent outages
Inode usage %Silent killer
IOPSPerformance
Disk latencyDB health
RAID stateData protection
LVM free spaceCapacity planning
Log growth rateForecasting

๐Ÿง  Senior-Level SRE Thinkingโ€‹

Always ask: What happens if this disk fills? What happens if this mount disappears? What happens if this node reboots? Can I recover this volume?


๐Ÿšจ SRE Storage Incident Debugging Playbookโ€‹

Structured like a real production incident: Detection โ†’ Triage โ†’ Stabilization โ†’ Root Cause โ†’ Prevention.

๐Ÿ”ด SCENARIO 1: Disk Full (Most Common Production Outage)โ€‹

Symptoms: app returning 500 errors, database crash, "No space left on device", Kubernetes pods restarting, node NotReady.

Step 1 โ€” Confirm

df -h
df -i # also check inode exhaustion

Step 2 โ€” Identify what's growing

du -sh /* 2>/dev/null | sort -h
du -sh /var/* | sort -h

Common culprits: /var/log, /var/lib/docker, /tmp, app logs, core dumps.

Real root causes seen in production: log rotation broken, debug logging accidentally enabled, infinite loop writing files, container image layer explosion, backup script writing locally instead of S3, audit logs filling /var.

Step 3 โ€” Emergency mitigation

> large.log   # safely truncate a large log file

โš ๏ธ Never delete active DB files.

Step 4 โ€” Deep diagnosis: Why did the alert not trigger earlier? Was growth sudden or gradual? Is this predictable growth? Check historical disk growth rate and log rate.

Step 5 โ€” Prevention: alerts at 70%, 80%, 90%; log rotation validation; capacity forecasting; separate log partition; auto-scaling or auto-expansion.

๐Ÿ”ด SCENARIO 2: Inode Exhaustion (Silent Killer)โ€‹

Symptoms: disk shows free space, but app says "No space left"; file creation fails.

df -i    # confirm
for i in /*; do echo $i; find $i | wc -l; done
find /var -xdev -type f | wc -l

Common causes: millions of tiny cache files, email queues, Kubernetes emptyDir abuse, temp file leak, log sharding misconfiguration.

Fix: delete unnecessary small files, restart the service creating them, consider reformatting with more inodes (long-term).

๐Ÿ”ด SCENARIO 3: High Disk I/O / Latency (Performance Incident)โ€‹

Symptoms: DB slow, API latency spike, CPU iowait high, pods timing out.

top          # look at %wa
iostat -x 1 # look at await, svctm, %util

Common causes: heavy backup job, unindexed DB query, log burst, swap thrashing, RAID rebuild.

Real production example: backup ran during peak traffic โ†’ saturated disk โ†’ checkout failures.

Mitigation: stop backup, throttle IO, move heavy jobs to off-peak, add faster disk, use a separate volume for DB logs.

๐Ÿ”ด SCENARIO 4: RAID Degradedโ€‹

cat /proc/mdstat

Look for [UU] (healthy) vs [U_] (degraded).

If degraded: identify failed disk โ†’ replace disk โ†’ rebuild RAID โ†’ monitor rebuild. โš ๏ธ Risk: if a second disk fails in RAID5 โ†’ full data loss.

๐Ÿ”ด SCENARIO 5: Filesystem Corruptionโ€‹

Symptoms: system won't boot, "UNEXPECTED INCONSISTENCY", files missing, read-only filesystem.

dmesg | grep -i error
fsck /dev/sdX

โš ๏ธ Never run fsck on a mounted production filesystem unless read-only. Downtime required.

๐Ÿ”ด SCENARIO 6: Mount Disappeared (Cloud / NFS)โ€‹

Symptoms: app freeze, high load, threads stuck in D state, NFS timeout.

mount | grep nfs
findmnt

Real cloud incident pattern: network glitch, EBS detaches, Kubernetes node stuck, pod cannot write.

Mitigation: remount, restart service, possibly reboot node.

๐Ÿ”ด SCENARIO 7: Permission Denied After Deploymentโ€‹

Symptoms: app fails after release, logs show "Permission denied".

ls -l   # check owner, group, mode

Common real cause: CI/CD changed ownership, or a Docker volume was mapped incorrectly.


๐Ÿ“Š Senior SRE Storage Checklistโ€‹

When paged for a storage issue:

1๏ธโƒฃ What is failing? App? DB? Node?

2๏ธโƒฃ Is it: Capacity? Performance? Corruption? Mount? Permissions?

3๏ธโƒฃ What changed? Deployment? Backup? Traffic spike? New log level?

4๏ธโƒฃ Is data at risk?

Advanced Production Design Principlesโ€‹

Always design for: separate OS and data disks; separate logs from DB; RAID + backups; snapshot strategy; alerting before impact; load-testing storage.

Observability Metrics to Always Haveโ€‹

MetricCritical
Disk usage %Yes
Inode %Yes
IOPSYes
LatencyYes
ThroughputYes
iowaitYes
Mount availabilityYes

Summaryโ€‹

  • ๐Ÿ’ก "If it fills, you fail." Treat disk like memory โ€” monitor it before it becomes an outage.
  • ๐Ÿ”ฅ Disk-full with df -h showing free space almost always means either a deleted-but-open file (lsof | grep deleted) or inode exhaustion (df -i), not a du measurement error.
  • โš ๏ธ Storage incidents cascade fast and can corrupt data โ€” they are more dangerous than CPU/memory incidents and are often under-monitored in capacity planning.
  • โœ… Always run resize2fs after lvextend โ€” extending the LV without growing the filesystem is a common silent mistake.

See Alsoโ€‹