0

What is the difference between badblocks vs fsck command in linux?

Don't they have the same capability or could you specify which command would be appropriate for what scenario.

EX: Is a badblock mainly used for a disk(mounted or unmounted) and is fsck mainly used for partitions?

Thanks!

1 Answer 1

3

fsck checks the integrity of the filesystem, i.e. the structures which have been written to a device file (typically a partition). A filesystem usually only occupies some of the blocks on the underlying storage. Depending on how it is invoked, it will only attempt to write data data to correct an error.

Conversely badblocks will look at all the blocks in the device. By default, it too just checks for errors, but you can tell it to rewrite each block to test the device fully.

Since the filesystem exists at a higher level of abstraction than the block device, you can have filesystem errors without having a bad block. Conversely if you have a bad block and that block is used by the filesystem then you will have filesystem errors. It is therefore also possible to have bad blocks which are not currently in use by the filesystem - here badblcoks can detect an issue but the filesystem will be intact.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .