Disk Errors
A collection of disk-related errors and their fixes.
Block Size Mismatch Warning
After writing an ISO to a flash drive, partitioning tools may complain:
| |
This happens when a tool like dd writes at the ISO's native 2048-byte block size onto a device that uses 512-byte sectors. Zeroing the first few blocks sometimes helps:
| |
If that doesn't clear it, recreating the partition table with fdisk or gdisk will.
SMART Monitoring
Check the health of a drive with smartctl:
| |
Key attributes to watch for trouble:
- Reallocated_Sector_Ct (ID 5): sectors the drive has remapped due to read errors. Any non-zero value means the drive is actively degrading.
- Current_Pending_Sector (ID 197): sectors waiting to be remapped on next write. Non-zero means the drive is struggling.
- Offline_Uncorrectable (ID 198): sectors that couldn't be read during offline tests.
- UDMA_CRC_Error_Count (ID 199): usually indicates a bad cable or connection rather than a dying drive.
Run a short self-test:
| |
And check results after a few minutes:
| |
Filesystem Repair
For ext4 filesystems, unmount first then check:
The -f flag forces a check even if the filesystem appears clean. For XFS:
| |
If the filesystem is too damaged to mount normally, try mounting read-only first to recover what you can:
| |
Bad Blocks
Test a drive for bad blocks (this is a destructive write test, data will be lost):
| |
For a non-destructive read-only test:
| |
These tests take a long time on large drives but can confirm whether a drive has physical media issues beyond what SMART reports.