How to read the current bad blocks list for the disk?
Solution 1:
To answer the question as asked: if /dev/sda1
is already formatted ext3
/ext4
then
dumpe2fs -b /dev/sda1
will list the blocks which have been reserved as "bad" when the filesystem was created.
The disk itself does not reports bad blocks to the host unless it has exhaused its capacity to reallocate them.
Modern hard disks, i.e. those manufactured in the last two decades, will manage the list of bad blocks internally. When they come out of the factory they have a number of spare blocks; when a bad block is detected a spare block is used instead. The number of reallocated blocks is reported in the SMART parameters. If a modern hard disk reports bad blocks to the host this means that the available spare blocks have been exhausted and the hard disk is on its last legs.