Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 16 down vote accepted

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.

share|improve this answer
2  
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
    
@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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.