Manual fsck stuck and no progress during disk check
I wanted to run an fsck check on my 5TB external hard drive on my raspberry pi after I noticed that cp fails on a couple of files.
This is the output:
$ sudo e2fsck -c -v /dev/sda e2fsck 1.44.5 (15-Dec-2018) Checking for bad blocks (read-only test): 0.46% done, 5:04 elapsed. (0/0/0 errors)There has been zero progress for hours now. The elapsed time is stuck as well. This is actually my second attempt. Before I tried sudo e2fsck -p -c -v /dev/sda. This one doesn't give any output, that's why I let it run for a whole week before terminating.
My drive is unmounted, partitionless, and freshly formatted with mkfs.ext4. Output from ps:
$ ps -a
PID TTY TIME CMD
1075 tty1 00:00:00 bash
8404 pts/1 00:00:00 sudo
8405 pts/1 00:00:04 e2fsck
8446 pts/1 00:00:00 sh
8447 pts/1 00:00:05 badblocks
23605 pts/2 00:00:00 psI noticed on my first attempt, that it was impossible to send a SIGINT, SIGTERM, or SIGKILL to badblocks.
31 Answer
The firmware of the disk will try to recover any read error, itself, and if successful will map the sector to a spare one, so no error will be reported to the OS.
The firmware will only report an error if it doesn't manage to recover the contents of the sector.
So if you have a bad sector, it's beyond salvage, except perhaps by specialists with special equipment.
Your disk might be failing, so a new disk might be required.
To copy a disk while omitting errors, useddrescue.
The new disk will not have a bad sector that will block e2fsck,
so the file-system can be repaired (expect some data-loss).