Who Needs This and What Goes Wrong Without It
If you have ever run chkdsk or fsck on a failing drive only to watch it make things worse, you already know the limits of basic repairs. This guide is for system administrators, IT generalists, and advanced home users who manage file systems that hold critical data. The problems we tackle go beyond simple bit flips: partition table corruption, damaged MFT or inode tables, RAID array inconsistencies, and file systems that refuse to mount despite passing surface scans.
Without a structured strategy, you risk permanent data loss. A common mistake is jumping straight to repair commands on a drive that is physically failing—this can push a marginal drive into total failure. Another is applying fixes meant for one file system type (like NTFS) to another (like ext4), which can destroy metadata. We have seen teams lose entire projects because they ran automatic repair on a drive with a damaged file system journal, not realizing the journal itself was corrupted and the tool was writing bad data back.
What you will gain from this guide is a repeatable process: triage the problem, isolate the cause, choose the right tool for the specific corruption pattern, and verify the repair without trusting the drive again until you are certain. We focus on strategies that preserve the original data as much as possible, using read-only analysis and sector imaging before any write operation.
The scenarios we cover include: a drive that spins but shows RAW or unrecognized partition; a RAID5 array that drops to degraded mode with inconsistent parity; an external drive that was unplugged during a write operation and now fails to mount; and a VM disk image with a corrupted guest file system. Each case requires a different approach, but the underlying principles remain the same.
When Basic Fixes Fail
Basic utilities assume the file system metadata is mostly intact. When the superblock is gone, the partition table is overwritten, or the journal is corrupted, those tools either refuse to run or produce destructive results. We have seen chkdsk /f turn a readable NTFS volume into a directory of orphaned .chk files because it tried to fix a damaged MFT without a backup.
The alternative is to step back, understand the structure of the file system, and use low-level tools that let you inspect and modify data at the sector level. This is not as daunting as it sounds—many excellent tools provide a graphical or command-line interface that abstracts the complexity, but you still need to know what you are looking at.
Prerequisites and Context You Should Settle First
Before you touch a repair tool, you need to establish a few things. First, is the drive failing physically? Listen for clicking, grinding, or spinning up and down. If you suspect hardware failure, your first step should be to create a sector-by-sector image using a tool like ddrescue or a hardware imager. Never run repair software directly on a failing drive—it can cause further damage.
Second, do you have a verified backup of the data? If the answer is no, treat the drive as your only copy and work in read-only mode until you have a full image. Even if you have a backup, verify that it is restorable before attempting risky repairs.
Third, understand the file system type and its layout. NTFS, FAT32, ext2/3/4, HFS+, APFS, and Btrfs all store metadata differently. A quick review of the file system structure—where the boot sector, superblock, MFT, or inode table resides—will help you interpret what the tools report.
Tools You Should Have Ready
We recommend having a bootable Linux USB with the following installed: ddrescue (for imaging), TestDisk and PhotoRec (for partition recovery and file carving), fsck variants (e2fsck, ntfsfix, etc.), and a hex editor like wxHexEditor. For Windows, R-Studio and DMDE are powerful commercial options that handle many complex scenarios. For macOS, Disk Utility’s fsck_apfs and third-party tools like Disk Drill can help.
Also prepare a second drive or network location with enough free space to hold the image. The image should be at least the size of the failing drive. If the drive has bad sectors, ddrescue will retry and map them; the resulting image may be incomplete but still usable for recovery.
Finally, set aside enough time. Complex repairs can take hours or days, especially if you are imaging a large drive with many bad sectors. Rushing leads to mistakes.
Core Workflow: Sequential Steps in Prose
We break the repair process into four phases: capture, analyze, plan, and repair. The order matters—skipping analysis can lead to choosing the wrong repair method.
Phase 1: Capture a Read-Only Image
Boot from a Linux live USB and use ddrescue to create an image of the failing drive. Example command: ddrescue -d -r3 /dev/sdb /mnt/image/sdb.img /mnt/image/sdb.log. The -d flag uses direct disk access, -r3 retries bad sectors three times. The log file tracks progress, so you can resume if interrupted. Once the image is complete, work exclusively on the image file, not the original drive.
Phase 2: Analyze the Image
Mount the image read-only using loopback: mount -o loop,ro sdb.img /mnt/loop. If it mounts, inspect the file system—check for missing files, directory structures, and errors in system logs. If it does not mount, use TestDisk to scan for lost partitions. TestDisk can also list files from the raw image. For deeper analysis, open the image in a hex editor and look for known signatures: NTFS boot sector signature (EB 52 90), ext4 superblock (S3 EF), or partition table entries.
Phase 3: Plan the Repair
Based on the analysis, decide on the repair approach. If the partition table is missing but you can identify the partition boundaries from the hex dump, you can rebuild it manually with TestDisk or by editing the MBR/GPT. If the superblock is corrupted, locate a backup superblock (e.g., with mke2fs -n for ext4) and restore it. If the file system journal is damaged, you may need to replay it partially or disable journaling temporarily.
Document your plan and the exact commands you intend to run. This helps avoid mistakes and gives you a rollback point if something goes wrong.
Phase 4: Execute the Repair on the Image
Work on a copy of the image if possible. For partition table repairs, use TestDisk’s “Write” function. For superblock recovery, use e2fsck -b superblock with the backup block number. For NTFS, ntfsfix is safe but limited; for deeper repairs, use chkdsk on a Windows VM with the image attached as a virtual disk. After the repair, try to mount the image read-write and verify file integrity.
Tools, Setup, and Environment Realities
The choice of tool depends on the file system and the type of corruption. Below we compare three common approaches for different scenarios.
| Tool | Best For | Limitations |
|---|---|---|
| TestDisk | Partition table recovery, boot sector repair, file listing from damaged partitions | Does not repair file system metadata (MFT, inodes); requires manual interpretation of scan results |
| e2fsck (ext family) | Fixing inode inconsistencies, orphaned blocks, directory structure errors | Can be destructive if run with -y without understanding the problem; requires backup superblock location |
| R-Studio (commercial) | Recovering files from severely corrupted or formatted drives, RAID reconstruction | Expensive; file system repair is limited—focuses on file extraction rather than fixing the file system |
Environment Considerations
If you are working remotely, ensure you have a stable connection and enough bandwidth to transfer the image. For large drives (4TB+), imaging over the network may take days; consider using a local workstation with direct SATA or USB connection. Also, power loss during imaging can corrupt the image file—use a UPS or laptop battery.
Virtual machine disk images (VMDK, VHDX) present a special case: you can attach the image to a VM and boot from a rescue ISO, or use tools like qemu-img to convert the image to raw and then apply the same workflow. Snapshots are your friend—take a snapshot before any repair operation.
Variations for Different Constraints
Not every situation allows you to create a full image. Here are variations for common constraints.
When the Drive Is Still Readable but Slow
If the drive has a few bad sectors but is otherwise responsive, you can skip the full image and work directly on the drive. But still use read-only commands first. Use smartctl -a /dev/sdb to check SMART attributes. If reallocated sectors are increasing, image the drive as soon as possible.
When You Have Limited Storage for an Image
If you cannot store a full image, use sparse imaging: ddrescue --sparse /dev/sdb /mnt/image/sdb.img /mnt/image/sdb.log. This only writes blocks that have data, skipping zeros. The resulting image is smaller but can still be mounted. Alternatively, use a cloud storage with compression, but be aware of bandwidth costs.
When the File System Is Encrypted
Encrypted volumes add a layer of complexity. You need the passphrase or key to mount the volume. If the encryption layer is intact but the inner file system is corrupted, you can image the encrypted container and then use tools on the decrypted loop device. If the encryption header is damaged, recovery is much harder and may require backup of the header.
When Dealing with RAID Arrays
RAID introduces parity and striping. For a RAID5 with one failed disk, you can reconstruct data using the remaining disks and parity. Tools like mdadm can assemble the array in read-only mode (mdadm --assemble --readonly /dev/md0 /dev/sd[bcde]1). Then image the virtual device. If the array is inconsistent, you may need to force assembly with missing disks and then repair the file system.
Pitfalls, Debugging, and What to Check When It Fails
Even with careful planning, repairs can fail. Here are common pitfalls and how to debug them.
Pitfall: Running Repair on the Original Drive
We cannot stress this enough: always work on a copy or image. If the repair goes wrong, you still have the original untouched drive. If you ignored this advice and the repair made things worse, stop immediately and create an image before doing anything else.
Pitfall: Not Verifying the Backup
You thought you had a backup, but when you try to restore, the backup software reports errors. Always test a restore before attempting repairs. A backup is only as good as its restorability.
Pitfall: Misinterpreting Tool Output
Tools like TestDisk can show multiple partition candidates. Choosing the wrong one can overwrite valid data. If you are unsure, save the partition table to a file and compare with known good data. Use a hex editor to verify the partition start sector matches actual boot sector signatures.
Pitfall: Ignoring Drive Health
Even if you repair the file system, the drive may be on its last legs. After recovery, replace the drive. Monitor SMART attributes and schedule data migration.
What to Check When the Repair Fails
If the file system still won't mount, check the system logs (dmesg or journalctl) for I/O errors or file system errors. If you see “attempt to access beyond end of device,” the partition table is likely wrong. If you see “corrupted journal,” you may need to replay the journal manually or disable it with e2fsck -j for ext4. For NTFS, chkdsk /f on the image might work, but if it hangs, the image may have too many bad sectors.
If all else fails, fall back to file carving with PhotoRec or R-Studio. Carving extracts files based on headers and footers, ignoring the file system structure. You will lose directory names and metadata, but you can recover the file contents.
Frequently Asked Questions and Checklist
Here are some common questions we encounter, along with a checklist to follow before and during a repair.
FAQ
Q: Can I use chkdsk on a drive that is making noise?
A: No. Stop immediately. The noise indicates physical damage. Image the drive first, then run chkdsk on the image.
Q: My drive shows as RAW. Is the data lost?
A: Not necessarily. RAW usually means the partition table or boot sector is damaged. Use TestDisk to scan for partitions. Often the data is still there.
Q: How long does imaging take?
A: For a healthy 1TB drive, about 2-3 hours over USB 3.0. For a failing drive, it can take days as ddrescue retries bad sectors.
Q: Should I use chkdsk /f or chkdsk /r?
A: /r implies /f and also scans for bad sectors. But on a failing drive, /r can cause more damage. Use /f on an image only.
Pre-Repair Checklist
- Backup verified? Yes/No
- Drive health checked (SMART)? Yes/No
- Image created? Yes/No
- Work on image, not original? Yes/No
- File system type identified? Yes/No
- Repair plan documented? Yes/No
Post-Repair Verification Checklist
- File system mounts read-write? Yes/No
- Directory structure intact? Yes/No
- Critical files accessible and not truncated? Yes/No
- File system errors in logs? Yes/No
- Backup of repaired image made? Yes/No
What to Do Next: Specific Next Moves
Once you have successfully repaired the file system and verified data integrity, your next steps are critical to avoid repeating the situation.
First, migrate data off the repaired drive onto a new, healthy drive. Even if the old drive seems fine, its failure risk is now higher. Use a tool like rsync or robocopy to copy files, preserving permissions and timestamps.
Second, implement a proactive monitoring system. Set up SMART monitoring with email alerts. For critical servers, consider using a RAID controller with battery-backed cache and regular patrol reads to detect latent errors.
Third, review your backup strategy. If you did not have a backup before this incident, now is the time to implement one. Follow the 3-2-1 rule: three copies, two different media, one offsite. Test restores quarterly.
Fourth, document the repair process for future reference. What went wrong? What worked? What would you do differently? This documentation can save hours if a similar issue arises.
Finally, if the data you recovered is irreplaceable (e.g., family photos, critical business records), consider making a second backup on a different medium, such as a cloud service or an optical disc (M-DISC for longevity). The effort you put into post-repair steps is what prevents the next crisis.
Comments (0)
Please sign in to post a comment.
Don't have an account? Create one
No comments yet. Be the first to comment!