Using Linux Badblocks Command to Check Disks and Partitions

Using Linux Badblocks Command to Check Disks and Partitions

Badblocks is a Linux command its used to search for bad blocks on a disk drive.

Linux-drive-tts

Checking badblocks and saves it into specific file

[root@TTS ~]# badblocks -v /dev/sda3 > bad-blocks.txt
Checking blocks 0 to 40959999
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.

Option v – Verbose mode

Now you can check the badblocks using fsck command

[root@TTS ~]# fsck -t ext4 -l bad-blocks.txt /dev/sda3
fsck from util-linux-ng 2.17.2
e2fsck 1.41.10 (10-Feb-2009)
/dev/sda6 is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)? yes

/dev/sda3: recovering journal
/dev/sda3: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/sda3: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda3: 14/1488032 files (0.0% non-contiguous), 1376806/5944576 blocks

Block size

[root@TTS ~]# badblocks -v -b 1024 /dev/sda3
Checking blocks 0 to 40959999
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.

option b – block-size specify block size in bytes .the default limit is 1024

Maximum bad block count

[root@SS1429-MAA ~]# badblocks -v -e 50 /dev/sda3
Checking blocks 0 to 40959999
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.

option e – Specify maximum no of bad blocks.The default is 0.

Input file

[root@TTS ~]# badblocks -v -o badblocks.log /dev/sda1
Checking blocks 0 to 102399
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.

option o – Write the list of bad blocks to the specified file.




One thought on “Using Linux Badblocks Command to Check Disks and Partitions

  1. uberbringer.com

    Sweet blog! I found it while browsing on Yahoo News.

    Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem
    to get there! Thank you

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *