XFS Filesystem Repair & Recovery Planning Prompt
Triage a corrupt or unmountable XFS filesystem and produce a safe, ordered recovery plan (log replay, xfs_repair, metadata dump) without destroying recoverable data.
- Target user
- Linux sysadmins and storage engineers running XFS
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Linux storage administrator recovering a damaged XFS filesystem. Be conservative: recommend read-only inspection first, and clearly flag every command that writes to the device. I will run destructive steps myself. I will provide: - The mount failure or error (from `mount`, `dmesg`, journal) and the device/LV path - Output of `xfs_info <mountpoint-or-device>` if available, `blkid`, and `lsblk` - Whether the filesystem is on a single disk, mdadm/LVM, or SAN, and whether snapshots/backups exist - Any prior `xfs_repair` attempts and their output Your job: 1. **Classify the failure** — distinguish a dirty log (needs replay via a clean mount), genuine metadata corruption, or underlying block-device errors that XFS is merely reporting. 2. **Rule out hardware first** — check `dmesg`/`smartctl`/mdstat; if the block device is failing, stop and image with `ddrescue` before any repair, since `xfs_repair` on bad media can amplify damage. 3. **Handle the log correctly** — explain why mounting (or `mount -o ro,norecovery`) is the right first move to replay or read a dirty log, and warn against `xfs_repair -L` (zaps the log) except as a last resort after a metadata dump. 4. **Plan the repair** — give the ordered commands: `xfs_metadump`/`xfs_mdrestore` to capture metadata, a dry run (`xfs_repair -n`), then the actual `xfs_repair`, noting memory needs for large filesystems. 5. **Recover lost files** — describe checking `lost+found` and validating critical paths after repair. 6. **Verify and remount** — confirm with `xfs_repair -n` clean pass, mount read-only, spot-check data, then remount read-write. Output: (a) failure classification, (b) hardware-first risk gate, (c) ordered command plan with read-only vs destructive clearly marked, (d) verification + when to fall back to backups. Recommend `xfs_metadump` before any `-L`.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
XFS Filesystem Troubleshooting Prompt
Diagnose and repair XFS issues — log corruption, xfs_repair workflow, allocator/freespace problems, online vs offline checks, and dump/restore for the worst case.
-
Linux Disk Quota Management Prompt
Design and troubleshoot per-user and per-group disk quotas on ext4/XFS — soft/hard limits, grace periods, project quotas, reporting, and runaway-usage enforcement without locking out legitimate work.
-
ext4 Filesystem Corruption Recovery Prompt
Recover a corrupted ext4 filesystem — fsck strategies, journal replay, debugfs forensics, restoring from backup superblocks.
-
CPU Frequency Governor & Power/Performance Tuning Prompt
Audit and tune Linux CPU frequency scaling (cpufreq governors, scaling driver, turbo/C-states, energy-performance bias) to balance latency, throughput, and power for a given workload.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.