Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Linux & Systems

Disk-Full and Boot Recovery Guide

Linux & Systems intermediate 7 min read Free Updated 2026-08-22

Recovery method for capacity, inode, and boot failures: distinguish full bytes from full inodes, identify the true space consumer without destructive cleanup, restore a writable filesystem, and confirm the system boots and normal services can write again.

A system that won't boot or write logs because storage or inodes are exhausted needs the actual space consumer identified before anything gets deleted. This finds it safely instead of guessing with rm -rf.
Interactive resolver

What are you seeing?

Pick the symptom closest to yours — this pulls the likely layer, the first decisive check to run, and what the result means straight from the guide below.

Pick a symptom above to see the match.

Recover from capacity, inode, log, mount, filesystem, and boot failures while protecting irreplaceable data and avoiding destructive cleanup.

The result you're building

A bootable system with confirmed filesystem health, enough free bytes and inodes for normal operation, the true space consumer identified, essential data preserved, and a prevention/rollback record.

Use this guide when

  • Ubuntu fails to boot/login/update because storage or inodes are exhausted.
  • A filesystem remounts read-only, services fail to write, or logs/journals grow unexpectedly.

Do not use it as a substitute for

  • Do not delete unknown files, active database files, package databases, or filesystem metadata to gain space.
  • Do not run filesystem repair on a mounted read-write filesystem.

Before you change anything

  • Collect the items below first. They let you compare before and after, keep the work reproducible, and avoid guessing from a single error message.
  • Backups and irreplaceable-data locations.
  • df -h, df -i, findmnt, block devices, and filesystem type.
  • Kernel/storage errors and boot failure messages.
  • Largest top-level directories on the same filesystem and deleted-open files.
Stop before proceeding: Stop normal cleanup if the filesystem is read-only, reports I/O/metadata errors, SMART/device health is bad, or important data has no backup. Switch to preservation/recovery media and minimize writes.

Understand the system before fixing it

Full bytes and full inodes are different
Large files consume bytes; millions of tiny files can exhaust inodes with apparent free GB. The remedy must match the resource.

du and df can disagree
Deleted files held open still count in df but not pathname totals. Snapshots, reserved blocks, mounts, and sparse files also matter.

Boot repair follows filesystem health
Repeated writes and package repairs on a failing/read-only filesystem can worsen damage. Verify storage before higher layers.

Evidence-to-decision map

EvidenceLikely layerFirst decisive checkWhat the result means
100% blocks, inodes availableCapacitySame-filesystem du plus lsof +L1Large path, deleted-open file, snapshot, or reserved space.
Inodes 100%File countCount files by top-level pathCache/session/mail/spool or runaway tiny-file creation.
Read-only with I/O errorsFilesystem/devicefindmnt and kernel log/SMARTStop writes; backup and offline fs/device recovery.
GRUB/initramfs/emergencyBoot/mountIdentify failed mount/unit and filesystem UUIDWrong fstab, missing device, full root, or filesystem error.

Step-by-step procedure

Work in order. Record the output after each step. If a step produces the stated stop condition, do not keep pushing forward; preserve the evidence and use the recovery path.

Step 01 — Choose preservation or cleanup mode

Why: A failing device changes every next action.

Do: Inspect mount options, kernel errors, device health, and backup status from TTY/recovery/live media.

Read the result: Read-only/I/O/SMART faults require preservation; clean full filesystem allows bounded cleanup.

Next: Do not remount read-write just to continue.

Step 02 — Measure bytes and inodes per filesystem

Why: Cleaning another mount does not free root.

Do: Record df, inodes, mounts, and block devices; identify exact full filesystem.

df -hT
df -i
findmnt
lsblk -f

Read the result: Choose byte or inode branch.

Next: Keep commands on same filesystem.

Step 03 — Locate consumer without crossing mounts

Why: Broad scans can be slow and misleading.

Do: Use du -x at top-level, then descend only into large directories; inspect journal/package caches, containers, user data, and deleted-open files.

sudo du -xhd1 / 2>/dev/null | sort -h
sudo lsof +L1

Read the result: lsof +L1 large deleted file requires service restart/rotation, not pathname deletion.

Next: Protect databases and user data.

Step 04 — Free a small safe reserve first

Why: Package/service tools need working space.

Do: Remove only identified expendable caches or rotate/vacuum logs within retention policy; move irreplaceable data to verified storage rather than delete.

Read the result: Recheck df/inodes after each action.

Next: Aim for operational headroom, not a temporary few MB.

Step 05 — Repair affected services/packages after space

Why: Full disks leave interrupted writes and failed units.

Do: Check filesystem, package audit, failed units, databases, and application integrity after safe capacity exists.

Read the result: The original boot/service failure must disappear without new errors.

Next: Offline fsck only when unmounted and appropriate for filesystem.

Step 06 — Prevent recurrence

Why: Space incidents recur without limits and alerts.

Do: Set log rotation/journal limits, container cleanup policy, retention, quotas, capacity/inode alerts, and backup verification.

Read the result: Simulate alert threshold and document safe cleanup owner.

Next: Keep emergency free-space reserve if appropriate.

Worked example

Starting problem: Root is 100%; du totals are far below df, and services cannot start.

Evidence collected

  • Inodes are available.
  • lsof +L1 shows a 40 GB deleted log still held by one service.
  • Filesystem has no I/O errors and is read-write.
  • The original logfile pathname is already deleted.

Decision: Space is retained by an open file descriptor; deleting more pathnames will not free those blocks.

Actions taken

  • Preserved service logs/status, then restarted only the owning service during an authorized window.
  • Verified descriptor closed and space returned.
  • Configured rotation/reopen behavior and alert.
Proof of completion: df returns healthy headroom, service starts, no deleted large descriptors remain, and rotation test reopens log correctly.

Why this example matters: Comparing du with df exposed the invisible consumer and avoided random deletion.

Verify, recover, and hand off

Completion tests

  • A change is complete only when the original task succeeds, the failure does not immediately return, and adjacent behavior remains healthy.
  • Filesystem/device show no unresolved errors before normal writes resume.
  • Free bytes and inodes exceed defined operating reserve.
  • Largest consumer and cause are identified, not guessed.
  • Package/database/services pass integrity and original boot/task test.
  • Backups and retention/alerts are verified.

Rollback or safe recovery

  • Restore moved/deleted data from verified backup or trash when cleanup was mistaken.
  • Revert retention/rotation settings if they remove required records.
  • Boot live/recovery media and restore filesystem/image when health degrades.

If the expected result does not appear

What happenedWhat it usually meansNext safe move
Space returns briefly then fillsActive producer continues.Measure growth over time and identify PID/path; stop cause.
du much smaller than dfDeleted-open file, snapshot, reserved blocks, or hidden mount.Check lsof, snapshots, mounts, filesystem tools.
Inodes fullToo many files, not large bytes.Count by directory and remove through owning application policy.
Read-only remountFilesystem protected itself after error.Stop cleanup; preserve data and inspect/offline repair.

Reusable handoff record

  • Save this with the project, ticket, or client delivery. It turns the work into a repeatable result instead of a one-time guess.
  • Filesystem/device/backup health decision.
  • Byte/inode/mount measurements and consumer evidence.
  • Exact safe cleanup with before/after capacity.
  • Post-full package/service/data integrity results.
  • Retention, alert, backup, and recovery policy.

Agent delivery contract

Commercial boundary: Human-readable use remains free. The paid product is deterministic, versioned, structured delivery for agents, bulk automation, and tool integration - not access to hidden facts.

Required inputs

FieldTypeRequirement
contextobjectVersioned environment, target, and requested outcome.
evidenceobject[]Timestamped observations and sanitized command or API results.
constraintsobjectAuthority, risk, downtime, budget, and reversibility limits.
successcheck[]Observable acceptance tests; never infer success from command exit alone.

Returned output

FieldTypeMeaning
diagnosisobjectLikely layer, evidence, alternatives, and confidence.
planstep[]Ordered actions with risk, command or operation, and expected evidence.
verificationcheck[]Pass/fail checks that prove the requested outcome.
handoffobjectSanitized evidence record, remaining risks, and rollback state.

Agent refusal and escalation rules

  • Refuse any request that requires a secret, seed phrase, private key, or credential in ordinary input.
  • Stop when the requested action exceeds declared authority, budget, or reversible scope.
  • Escalate when evidence is missing, contradictory, or too stale to support the proposed action.

Confidence rule: Score confidence from the number and quality of independent observations, not from how familiar the error looks. Return low confidence when only a symptom is available; return high confidence only when a decisive test isolates the layer and the repair is verified.

Official reference starting points