28

I need to do a destructive (rw) test on a new drive, and a read-only on a drive that fell out of my RAID array. I want to see if it finds problems and how far along it is.

tshepang
  • 64,472
  • 86
  • 223
  • 290
xenoterracide
  • 57,918
  • 74
  • 184
  • 250

1 Answers1

31

Let /dev/sda be the new drive on which to test destructive-rw and /dev/sdb the old drive where you want non-destructive-r

# badblocks -wsv /dev/sda
# badblocks -sv /dev/sdb

-s gives the process indicator

-v gives verbose output

-w enables destructive read-write

-n would be non-destructive read-write

Read-only testing is the default and doesn't need special parameters.

fschmitt
  • 8,720
  • 35
  • 46
  • 5
    You might want to add the use the "-o output_file" option for badblocks as well because it writes the bad sectors into a file which you can pass to `mke2fs` or `e2fsck` to make those tools aware of which blocks are broken. – tante Oct 21 '10 at 12:30
  • 2
    @tante is right without "-o output_file" the results are just output to the screen, unusable by e2fsck. The badblocks man page however recommends that you run "e2fsck -c" instead of utilizing badblocks -o, to avoid possible block size mismatch, fwiw... – rogerdpack Nov 27 '13 at 13:04