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)
- Learn the inode trap: a disk can be full while
dfshows free space - Know when to use LVM and what each RAID level trades off
- Review permissions, special bits, and ACLs for common outages
- Follow the Storage Incident Debugging Playbook for the next disk alert
Table of Contentsโ
- Filesystem Hierarchy Standard
- Filesystem Commands
- Inodes โ Silent Production Killer
- LVM
- RAID Concepts
- File Permissions
- Special Bits
- umask
- ACLs
- Real SRE Incident Scenarios
- Storage Incident Debugging Playbook
- Senior SRE Storage Checklist
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โ
| Level | Purpose | SRE View |
|---|---|---|
| RAID 0 | Performance | โ No redundancy |
| RAID 1 | Mirroring | โ High safety |
| RAID 5 | Striping + parity | Balanced |
| RAID 10 | Mirror + 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โ
- Disk Full โ Production Down โ Cause: log rotation misconfigured.
- Inode Exhaustion โ Cause: millions of temp files.
- RAID Degraded โ Ignored Alert โ Data Loss
- Wrong
chmodโ Application Can't Start - Mounted Wrong Volume โ Overwritten Data
๐ What SRE Should Monitorโ
| Metric | Why |
|---|---|
| Disk usage % | Prevent outages |
| Inode usage % | Silent killer |
| IOPS | Performance |
| Disk latency | DB health |
| RAID state | Data protection |
| LVM free space | Capacity planning |
| Log growth rate | Forecasting |
๐ง 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โ
| Metric | Critical |
|---|---|
| Disk usage % | Yes |
| Inode % | Yes |
| IOPS | Yes |
| Latency | Yes |
| Throughput | Yes |
| iowait | Yes |
| Mount availability | Yes |
Summaryโ
- ๐ก "If it fills, you fail." Treat disk like memory โ monitor it before it becomes an outage.
- ๐ฅ Disk-full with
df -hshowing free space almost always means either a deleted-but-open file (lsof | grep deleted) or inode exhaustion (df -i), not adumeasurement 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
resize2fsafterlvextendโ extending the LV without growing the filesystem is a common silent mistake.
See Alsoโ
- Process Management & /proc โ
lsof//proc/<pid>/fdfor deleted-file-still-open debugging - Linux Debugging Reference โ where storage fits into the full toolset
- Incident Simulation Labs โ Incident 3 (disk 100%) and Incident 4 (high load, low CPU) hands-on labs
- Incident Response Mindset โ USE method applied to disk saturation