How to use the Linux badblocks command

Source: Internet
Author: User

When executing the command, you must specify the disk device to be checked and the number of disk blocks for the device.

Syntax

Badblocks [-svw] [-B <block size>] [-o <output file>] [disk device] [number of disk blocks] [start Block]

Parameter description:

  • -B <block size> specifies the disk block size, in bytes.
  • -O <output file> writes the check result to the specified output file.
  • -S shows the progress during the check.
  • -V displays detailed information during execution.
  • -W performs a write test during the check.
  • [Disk device] specifies the disk device to be checked.
  • [Number of disk blocks] total number of blocks of the specified disk device.
  • [Start Block] specifies the block from which the check starts.

Instance

View the current hard disk information of the system.

# Fdisk-l

For example, the following information is displayed:

Disk/dev/sda: 298.9 GB, 298999349248 bytes

255 heads, 63 sectors/track, 36351 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/sda1 1 262 2104483 + 82 Linux swap/Solaris

/Dev/sda2*263 32898 262148670 83 Linux

/Dev/sda3 32899 36351 27736222 + 83 Linux

Disk/dev/sdb: 42.9 GB, 42949672960 bytes

64 heads, 32 sectors/track, 40960 cylinders

Units = cylinders of 2048*512 = 1048576 bytes

Scan the hard disk by using commands.

# Badblocks-s-v/dev/sdnx

N indicates the hard disk device name, and x indicates the partition number corresponding to the hard disk. For example, to check "/dev/sda2", run the following command:

# Badblocks-s-v/dev/sda2

Checking blocks 0 to 30681000

Checking for bad blocks (read-only test): 306809600674112/306810000000

30680964

30680965

30680966

30680967

30680968

30680969

30680970

30680971

30680972

30680973

...

Done

Pass completed, 37 bad blocks found. Among them, "37 bad blocks found" indicates that there are 37 bad disks on the hard disk.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.