← Back to Playbooks
    SEV-2Infrastructure

    Disk Full Playbook

    Storage capacity exhausted - writes are failing, databases are crashing, logs are lost, and services are degrading in ways that look like application bugs. Disk full is one of the most common and most misdiagnosed infrastructure failures. This playbook covers diagnosis and remediation across Linux, Windows, AWS, Azure, GCP, and Kubernetes environments.

    Operator's Field Notes

    Jeremy Martinez · Incident Commander | Principal Site Reliability Engineer

    "Disk full incidents have a unique quality: they cause failures that look like something else entirely. A database crashes and the team starts investigating query performance. A service returns 500s and the team checks the deploy history. Logs stop appearing and the team thinks the logging pipeline is down. Meanwhile, the filesystem is at 100% and nothing can write."

    "The other trap is that df -h looks fine. The volume shows 40% free. But the inodes are exhausted, or a process has deleted files that are still open, or the reserved blocks for root are consumed. Always check df -h,df -i, andlsof +D / in that order."

    "My rule of thumb: if anything returns 'No space left on device', stop everything else and fix the disk first. Every minute you spend investigating other theories while the disk is full is wasted time."

    DISK FULL SYMPTOM MATRIX

    Direct Symptoms

    • • ENOSPC / "No space left on device" errors
    • • Database write failures and crashes
    • • Application logs stop being written
    • • Service unable to create temp files
    • • Container/pod evictions (Kubernetes)
    • • SSH login failures (can't create session files)

    Indirect / Misleading Symptoms

    • • 500 errors with no obvious application cause
    • • Database replication stopping silently
    • • Metrics and monitoring gaps
    • • Deployment failures ("unable to write layer")
    • • Cron jobs silently failing
    • • Authentication failures (session storage full)

    First 5 Minutes: Triage

    Disk full incidents require fast triage because the blast radius grows every second - each failed write can cascade into data loss, corrupted state, or service crashes. Your first priority is confirming which disk is full, on which host, and whether it's space or inodes.

    0-30s

    Confirm disk is actually full

    Run df -h on the affected host. Check ALL mount points - /var, /tmp, /data, /var/log may be separate partitions. Also run df -i for inode usage. Disk can show 40% free but be inode-exhausted.

    30-90s

    Identify what's consuming space

    du -sh /* | sort -hr | head -20 - find the largest directories. Common culprits: /var/log (logs), /tmp (temp files), /var/lib/docker (container images/layers), /data (database WAL files), application upload dirs.

    90s-2m

    Check for deleted-but-open files

    lsof +L1 | awk '{print $7, $1, $2, $NF}' | sort -rn | head -20 - Files deleted from the filesystem but still held open by running processes. They won't release space until the process closes the file handle or is restarted.

    2-3min

    Assess blast radius

    Which services depend on this disk? Is it a root volume, a data volume, or a log volume? Database volumes are SEV-1. Log volumes are SEV-3. Root volumes that prevent SSH/deployments are SEV-1.

    3-5min

    Quick wins to free space immediately

    1) Truncate large log files: > /var/log/large-file.log (don't delete - truncate). 2) Clear package manager cache: apt clean / yum clean all. 3) Remove old temp files: find /tmp -mtime +7 -delete. 4) Docker: docker system prune.

    Linux / Ubuntu Diagnostics

    Linux is the most common deployment OS. These commands work across all distributions - Ubuntu, Debian, CentOS, RHEL, Amazon Linux, Alpine.

    Disk Space Analysis

    # Overview of all mounted filesystems
    df -h                    # human-readable sizes
    df -hT                   # include filesystem type (ext4, xfs, tmpfs, etc.)
    df -i                    # inode usage (critical - see inode playbook)
    
    # Find largest directories (top-down)
    du -sh /* 2>/dev/null | sort -hr | head -20
    du -sh /var/* 2>/dev/null | sort -hr | head -10
    du -sh /var/log/* 2>/dev/null | sort -hr | head -10
    
    # Find files larger than 1GB
    find / -xdev -type f -size +1G -exec ls -lh {} \; 2>/dev/null | sort -k5 -hr
    
    # Find files larger than 100MB, sorted by size
    find / -xdev -type f -size +100M -printf '%s %p\n' 2>/dev/null | sort -rn | head -20
    
    # Find recently modified large files (likely the growing ones)
    find / -xdev -type f -size +50M -mmin -60 -printf '%T+ %s %p\n' 2>/dev/null | sort -r | head -20
    
    # Find files growing RIGHT NOW (run twice 30s apart, compare)
    watch -d -n 30 'du -sh /var/log/* | sort -hr | head -10'

    Deleted-But-Open Files (Hidden Space Consumers)

    # Files that are deleted but still held open by processes
    # This is the #1 cause of "df shows full but du shows less"
    lsof +L1 | awk '{print $7, $1, $2, $NF}' | sort -rn | head -20
    
    # Show total space consumed by deleted-but-open files
    lsof +L1 | awk 'NR>1 {sum += $7} END {printf "%.2f GB\n", sum/1024/1024/1024}'
    
    # To reclaim: restart the process holding the file handle
    # Or truncate the file descriptor:
    # ls -l /proc/<PID>/fd/ | grep deleted
    # > /proc/<PID>/fd/<FD_NUMBER>    # truncates without restart
    
    # Common offenders:
    # - Logrotate ran but app didn't reopen the log file
    # - Rsyslog or journald holding huge rotated logs
    # - Java apps with log4j not releasing old log file handles
    # - nginx/Apache after log rotation without reload

    Critical: This is the most commonly missed cause of disk full. du won't count these files. Only df reflects the true usage. If df says 100% but du -sh / shows much less, you have deleted-but-open files.

    Log File Management (Emergency)

    # IMPORTANT: Truncate, don't delete. Deleting creates deleted-but-open files.
    # Truncating zeros the file while keeping the handle open.
    
    # Truncate a specific log file
    > /var/log/syslog
    > /var/log/application/app.log
    truncate -s 0 /var/log/large-file.log
    
    # Clear old journal logs (systemd)
    journalctl --vacuum-size=500M     # keep only 500MB
    journalctl --vacuum-time=2d       # keep only 2 days
    
    # Find and remove old rotated logs
    find /var/log -name "*.gz" -mtime +7 -delete
    find /var/log -name "*.old" -mtime +3 -delete
    find /var/log -name "*.[0-9]" -mtime +7 -delete
    
    # Clear package manager caches
    apt-get clean                     # Debian/Ubuntu
    yum clean all                     # CentOS/RHEL
    dnf clean all                     # Fedora
    
    # Remove old kernels (Ubuntu)
    dpkg -l 'linux-*' | awk '/^ii.*linux-image/{print $2}' | sort -V | head -n -2 | xargs apt-get -y purge
    
    # Clear tmp files
    find /tmp -type f -atime +7 -delete
    find /var/tmp -type f -atime +7 -delete

    Filesystem Reserved Blocks

    # ext4 reserves 5% of blocks for root by default
    # On a 1TB disk, that's 50GB you can't use as a normal user
    # This is by design - it ensures root can still log in and fix things
    
    # Check reserved block percentage
    tune2fs -l /dev/sda1 | grep -i "reserved"
    
    # Reduce reserved blocks to 1% (safe for data volumes, not root volumes)
    tune2fs -m 1 /dev/sda1
    
    # Reclaim reserved blocks immediately if you're root
    # (the reserved blocks ARE available to root, just not normal users)
    # Check if your service is running as root or not

    Key insight: If your app runs as a non-root user and df shows 95% used, the app may already be getting ENOSPC while root can still write. ext4's reserved blocks are for root only.

    Windows Server Diagnostics

    Windows Server environments face disk full issues from IIS logs, Windows Update caches, crash dumps, and the WinSxS component store. PowerShell provides the best diagnostic tooling.

    PowerShell Disk Analysis

    # Check all drives
    Get-PSDrive -PSProvider FileSystem | Select Name, Used, Free,
      @{N='% Used';E={[math]::Round($_.Used/($_.Used+$_.Free)*100,1)}}
    
    # Detailed volume info
    Get-Volume | Select DriveLetter, FileSystemLabel, FileSystem,
      @{N='Size(GB)';E={[math]::Round($_.Size/1GB,2)}},
      @{N='Free(GB)';E={[math]::Round($_.SizeRemaining/1GB,2)}},
      @{N='%Used';E={[math]::Round(($_.Size-$_.SizeRemaining)/$_.Size*100,1)}}
    
    # Find largest files on C: drive
    Get-ChildItem -Path C:\ -Recurse -File -ErrorAction SilentlyContinue |
      Sort-Object Length -Descending |
      Select-Object FullName, @{N='SizeMB';E={[math]::Round($_.Length/1MB,2)}} -First 30
    
    # Directory sizes (top-level)
    Get-ChildItem -Path C:\ -Directory -ErrorAction SilentlyContinue | ForEach-Object {
      $size = (Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue |
        Measure-Object -Property Length -Sum).Sum
      [PSCustomObject]@{ Path = $_.FullName; SizeGB = [math]::Round($size/1GB,2) }
    } | Sort-Object SizeGB -Descending | Format-Table -AutoSize
    
    # Recently modified large files
    Get-ChildItem -Path C:\ -Recurse -File -ErrorAction SilentlyContinue |
      Where-Object { $_.Length -gt 100MB -and $_.LastWriteTime -gt (Get-Date).AddHours(-1) } |
      Sort-Object Length -Descending | Select FullName, Length, LastWriteTime

    Windows-Specific Cleanup

    # Clear Windows Update cache (can be 10+ GB)
    Stop-Service wuauserv
    Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force
    Start-Service wuauserv
    
    # Clear temp files
    Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
    Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
    
    # Analyze WinSxS component store (often 5-15 GB)
    Dism /Online /Cleanup-Image /AnalyzeComponentStore
    Dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase
    
    # Clear IIS logs (common on web servers - can grow to 50+ GB)
    Get-ChildItem -Path "C:\inetpub\logs" -Recurse -File |
      Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-7) } |
      Remove-Item -Force
    
    # Clear crash dumps
    Remove-Item -Path "C:\Windows\Minidump\*" -Force -ErrorAction SilentlyContinue
    Remove-Item -Path "C:\Windows\MEMORY.DMP" -Force -ErrorAction SilentlyContinue
    
    # Clear event logs (emergency only)
    wevtutil cl Application
    wevtutil cl System
    wevtutil cl Security
    
    # Disk Cleanup utility (interactive but thorough)
    cleanmgr /sagerun:1
    
    # Check for Volume Shadow Copies consuming space
    vssadmin list shadowstorage
    vssadmin resize shadowstorage /for=C: /on=C: /maxsize=5GB

    Common Windows culprits: IIS logs (unbounded by default), Windows Update downloads, WinSxS component store, SQL Server transaction logs, crash dumps, and Volume Shadow Copies. Check all of these before expanding the volume.

    AWS (EBS / EFS) Diagnostics

    AWS disk full issues typically involve EBS volumes (block storage attached to EC2), EFS (shared NFS-like storage), or ephemeral instance storage. EBS can be expanded online without downtime - but you need to extend the filesystem after expanding the volume.

    AWS EBS Volume Management

    # Check which EBS volume is full
    lsblk                              # list block devices
    df -hT                              # see filesystem types and mount points
    nvme list 2>/dev/null               # Nitro instances use NVMe
    
    # Find the EBS volume ID from inside the instance
    # For Nitro instances:
    TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \
      -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
    curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
      http://169.254.169.254/latest/meta-data/block-device-mapping/
    
    # Check volume details via AWS CLI
    aws ec2 describe-volumes --volume-ids vol-xxxxx \
      --query 'Volumes[*].{ID:VolumeId,Size:Size,State:State,IOPS:Iops,Type:VolumeType}'
    
    # --- EXPAND EBS VOLUME (online, no downtime) ---
    
    # Step 1: Modify the volume size in AWS
    aws ec2 modify-volume --volume-id vol-xxxxx --size 200
    # Wait for modification to complete:
    aws ec2 describe-volumes-modifications --volume-ids vol-xxxxx
    
    # Step 2: Extend the partition (if partitioned)
    sudo growpart /dev/nvme0n1 1        # or /dev/xvda 1
    
    # Step 3: Extend the filesystem
    # For ext4:
    sudo resize2fs /dev/nvme0n1p1
    # For xfs:
    sudo xfs_growfs /
    
    # Verify
    df -h
    
    # --- EBS IOPS / THROUGHPUT LIMITS ---
    # gp3 baseline: 3000 IOPS, 125 MB/s
    # If disk is slow but not full, check if you're hitting IOPS limits:
    aws cloudwatch get-metric-statistics \
      --namespace AWS/EBS --metric-name VolumeQueueLength \
      --dimensions Name=VolumeId,Value=vol-xxxxx \
      --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \
      --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
      --period 300 --statistics Average

    AWS gotcha: Expanding an EBS volume is a two-step process. Modifying the volume in AWS just makes more raw blocks available. You still need to growpart the partition and resize2fs/xfs_growfs the filesystem. Many engineers forget step 2-3.

    Azure Managed Disk Diagnostics

    Azure Managed Disks can be expanded but require the VM to be deallocated (stopped) for OS disks, or can be expanded online for data disks. Azure also has unique issues with temp disks (D: drive) that are ephemeral and lost on VM reallocation.

    Azure Disk Management

    # Check disk info from Azure CLI
    az disk list --resource-group <rg> --output table
    az vm show --name <vm> --resource-group <rg> \
      --query "storageProfile.dataDisks[*].{Name:name,Size:diskSizeGb,Lun:lun}"
    
    # --- EXPAND Azure Managed Disk ---
    
    # For DATA disks (can be done online in some regions):
    az disk update --resource-group <rg> --name <disk-name> --size-gb 256
    
    # For OS disks (requires VM deallocation):
    az vm deallocate --resource-group <rg> --name <vm>
    az disk update --resource-group <rg> --name <disk-name> --size-gb 128
    az vm start --resource-group <rg> --name <vm>
    
    # After expansion - extend filesystem inside VM:
    # Linux:
    sudo growpart /dev/sda 1            # or /dev/sdc for data disks
    sudo resize2fs /dev/sda1            # ext4
    sudo xfs_growfs /datadrive          # xfs
    
    # Windows (PowerShell):
    $MaxSize = (Get-PartitionSupportedSize -DriveLetter C).SizeMax
    Resize-Partition -DriveLetter C -Size $MaxSize
    
    # --- AZURE TEMP DISK WARNING ---
    # Azure VMs have a temporary disk (D: on Windows, /dev/sdb on Linux)
    # This disk is EPHEMERAL - data is lost on VM maintenance/reallocation
    # NEVER store important data on the temp disk
    # Check: lsblk | grep -i "RESOURCE_DISK"
    
    # Check Azure disk metrics
    az monitor metrics list --resource <disk-resource-id> \
      --metric "Composite Disk Read Bytes/sec" "Composite Disk Write Bytes/sec" \
      --interval PT5M

    Azure gotcha: The temp disk (D: drive / /mnt on Linux) is the #1 source of Azure disk full confusion. Apps that write to /tmp or D:\\ will lose data on reallocation. Also, expanding the OS disk requires VM deallocation (downtime).

    GCP Persistent Disk Diagnostics

    GCP Disk Management

    # List disks attached to instance
    gcloud compute disks list --filter="users~<instance-name>"
    gcloud compute instances describe <instance> --zone <zone> \
      --format="table(disks[].source,disks[].diskSizeGb)"
    
    # --- EXPAND GCP Persistent Disk (online, no downtime) ---
    
    # Step 1: Resize the disk
    gcloud compute disks resize <disk-name> --size=200GB --zone <zone>
    
    # Step 2: Extend filesystem (inside VM)
    # ext4:
    sudo resize2fs /dev/sdb1
    # xfs:
    sudo xfs_growfs /data
    
    # If disk is partitioned:
    sudo growpart /dev/sdb 1
    
    # --- PERFORMANCE LIMITS ---
    # GCP PD performance scales with size
    # pd-standard: 0.75 IOPS/GB read, 1.5 IOPS/GB write
    # pd-ssd: 30 IOPS/GB read, 30 IOPS/GB write
    # pd-balanced: 6 IOPS/GB
    # A 10GB pd-ssd only gets 300 IOPS - disk can be "full enough" performance-wise
    
    # Check if you're hitting performance limits
    gcloud compute instances describe <instance> --zone <zone> \
      --format="yaml(disks)"
    
    # GCP local SSDs (ephemeral - like Azure temp disks)
    # Data lost on VM stop/maintenance
    # Check: lsblk | grep local

    GCP gotcha: GCP Persistent Disk IOPS scale linearly with disk size. A 10GB disk might be "fine on space" but starved for IOPS. If disk I/O is slow, try expanding the disk even if it's not full - you get more performance with more size.

    Kubernetes Disk Diagnostics

    In Kubernetes, disk full can happen at the node level (host filesystem, imagefs) or the volume level (PersistentVolume claims). Node-level disk pressure triggers pod eviction. Volume-level fullness causes individual pod write failures.

    Kubernetes Disk & Volume Commands

    # Check node disk pressure conditions
    kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range .status.conditions[*]}{.type}={.status}{"\t"}{end}{"\n"}{end}' | grep -i disk
    
    # Node-level disk usage
    kubectl describe node <node> | grep -A 5 "Allocated resources"
    kubectl top nodes
    
    # Check for evicted pods (disk pressure causes evictions)
    kubectl get pods --all-namespaces --field-selector status.phase=Failed | grep Evicted
    kubectl get events --all-namespaces | grep -i "evict\|disk\|ephemeral"
    
    # PersistentVolume and PVC status
    kubectl get pv --sort-by='.spec.capacity.storage'
    kubectl get pvc --all-namespaces
    kubectl describe pvc <pvc-name> -n <namespace>
    
    # Check disk usage inside a pod
    kubectl exec -it <pod> -- df -h
    kubectl exec -it <pod> -- du -sh /* 2>/dev/null | sort -hr | head -10
    
    # Ephemeral storage usage per pod
    kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range .spec.containers[*]}{.resources.limits.ephemeral-storage}{"\t"}{end}{"\n"}{end}'
    
    # Docker/containerd image and layer cleanup on node
    # SSH to node, then:
    docker system df                  # Docker disk usage breakdown
    docker system prune -a --volumes  # Nuclear option - removes all unused
    crictl rmi --prune                # containerd cleanup
    
    # Kubelet disk eviction thresholds
    # Default: nodefs.available < 10%, imagefs.available < 15%
    # Check: cat /var/lib/kubelet/config.yaml | grep -A 5 eviction
    
    # --- EXPAND PVC (if StorageClass supports it) ---
    # Edit the PVC spec.resources.requests.storage to a larger value
    kubectl patch pvc <pvc-name> -n <namespace> -p \
      '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'
    # The underlying CSI driver will expand the volume
    # Pod may need restart for filesystem expansion

    K8s gotcha: Container images and layers fill up imagefs on nodes. If you deploy frequently with large images and never prune, nodes fill up even though no app data is growing. Set up garbage collection or a CronJob to prune.

    Common Culprits by Service Type

    Databases

    • PostgreSQL: WAL files (pg_wal/), bloat from vacuum not running, temporary files from large queries
    • MySQL: Binary logs (binlog), InnoDB tablespace, slow query logs, general logs left on
    • MongoDB: Journal files, oplog growth, WiredTiger cache files
    • Redis: RDB snapshots, AOF files growing without rewrite, fork memory for background saves

    Web Servers / Applications

    • Nginx/Apache: Access logs, error logs (especially with debug enabled), temp upload files
    • Node.js: npm cache, node_modules duplicates, heap snapshots, core dumps
    • Java: Heap dumps, GC logs, thread dumps, log4j files, tmp compilation
    • Docker: Container layers, build cache, dangling images, container logs (json-file driver)

    System Level

    • Systemd journal: Can grow unbounded. Default is 10% of filesystem or 4GB
    • Package manager: apt/yum/dnf caches accumulate old packages
    • Kernels: Old kernel versions not cleaned up (Ubuntu keeps 3 by default)
    • Core dumps: If enabled, can fill disk with multi-GB dumps per crash

    CI/CD & DevOps

    • Jenkins: Build artifacts, workspace not cleaned, Docker build cache
    • GitLab Runner: Docker cache, build logs, package caches
    • Artifact storage: Old releases not cleaned, snapshot repos growing
    • Terraform: State file backups, provider plugin cache

    Prevention Checklist

    Monitoring

    • ☐ Alert at 80% disk usage (warning) and 90% (critical)
    • ☐ Alert on inode usage at 80%
    • ☐ Monitor disk usage growth rate (predict when full)
    • ☐ Track deleted-but-open file space (lsof-based check)
    • ☐ Monitor per-volume IOPS and throughput against limits
    • ☐ Dashboard showing disk trends for all production hosts

    Operational

    • ☐ Log rotation configured with max size AND max files
    • ☐ systemd journal max size configured
    • ☐ Docker log driver with max-size and max-file
    • ☐ Automated cleanup of temp files, old packages, old kernels
    • ☐ Database WAL/binlog retention policies set
    • ☐ Container image garbage collection on K8s nodes
    • ☐ Separate partitions for /var/log, /data, /tmp

    Post-Incident Questions

    ?

    What filled the disk? Was it a gradual growth or a sudden spike? Can we prevent the specific cause?

    ?

    Why didn't monitoring catch this before it hit 100%? Are alerts configured on all critical volumes?

    ?

    Is log rotation configured correctly? Are rotated logs actually being cleaned up?

    ?

    Should this volume be larger, or should we address the root cause of growth?

    ?

    Are separate partitions needed to prevent log growth from killing the database or application?

    ?

    Do we need automated expansion (AWS auto-scaling EBS, K8s volume expansion)?

    ?

    Were deleted-but-open files a factor? Do we need to fix log rotation + service reload procedures?

    ?

    Is this volume on the right storage tier? (e.g., gp3 vs io2, Premium vs Standard SSD)

    Related Resources