How to read the current bad blocks list for the disk?

The commands like:

sudo badblocks -sv /dev/sda1 > bads.txt
sudo e2fsck -l bads.tst /dev/sda1

or

sudo e2fsck -ckvt /dev/sda1

can scan disk /dev/sda1 for bad blocks and mark them as not-usable. But how to read the current bad blocks list for the /dev/sda1?

1 Answer

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.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like