badblocks is used to search for bad blocks on a device (usually a disk partition). Device is the special file corresponding to the device (e.g /dev/sda1).
It can be a good idea to periodically check for bad blocks. This is done with the badblocks command. It outputs a list of the numbers of all bad blocks it can find. This list can be fed to fsck to be recorded in the filesystem data structures so that the operating system won’t try to use the bad blocks for storing data. The following example will show how this could be done.
The command:
badblocks -v /dev/sda1 > badblocks.txt
The above command will generate the file badblocks.txt.
You can pass this file to the fsck command to record these bad blocks. Do make sure you type in the correct filesystem, etc ext3,ext4,xfs.
fsck -t ext3 -l badblocks.txt /dev/sda1
Reference:
Link1
No comments :
Post a Comment