[ale] help, what the #$@! is wrong, badblocks command

Ron Frazier (ALE) atllinuxenthinfo at techstarship.com
Mon May 14 11:38:28 EDT 2012


I finally figured this out after much pondering and reading the man page about 10 times. I thought I'd share it in case someone else needs the info. Googling didn't help much, as those listings usually just quote the man page. When the man page says last-block first-block, it doesn't want you to enter those WORDS, it wants you to enter a NUMBER. It mentions that both are optional, but I cannot figure out how to leave out last-block if I want to specify first block.

Say you stopped your test originally at block 33000001. I would restart the test at one block less, so 33000000.

First, you have to determine what the last block number is on the partition. I've found two ways to do that.

1) You can start badblocks without block numbers. It will tell you the block range it's processing.

Ex: sudo badblocks -sv /dev/sda3

And it says something like:

Searching for badblocks in read only nondestructive mode
from block 0 to 66828373

Write down this ending block number. Terminate the test with CTRL-C and then enter the command with the block numbers that you want.

2) You can use the fdisk (or I think also sfdisk) command to list partition information. One of the columns of information is # of blocks. Find the number of blocks in the partition you're interested in and SUBTRACT 1 since the blocks are numbered starting at 0.

sudo fdisk -l /dev/sda (That option is a lower case L. In this case, you don't specify the partition number, just the hard drive designation.)

And it says something like:

/dev/sda2 ...
/dev/sda3 ... 66828374
/dev/sda4 ...

Find the partition you're interested in and read the number of blocks and subtract 1 to find the last block number.

Now, you can enter the badblocks command as follows. Say you want to start testing in the middle of the partition at block 33000000. This example is for non destructive read write mode with badblocks list to a text file. If booted from a live cd, you will lose this text file when you reboot.

sudo badblocks -nsv -o ~/Desktop/badblocks.txt /dev/sda3 66828373 33000000

This will test from block 33000000 to the end of the partition. If you specify 66828374 as the last block, as reported in fdisk, it will report that block number as bad, but, in fact, that block number doesn't exist.

I hope others may find this useful, as it really confused me for a while.

Sincerely,

Ron


--

Sent from my Android Acer A500 tablet with bluetooth keyboard and K-9 Mail.
Please excuse my potential brevity.

(To whom it may concern. My email address has changed. Replying to former
messages prior to 03/31/12 with my personal address will go to the wrong
address. Please send all personal correspondence to the new address.)

(PS - If you email me and don't get a quick response, you might want to
call on the phone. I get about 300 emails per day from alternate energy
mailing lists and such. I don't always see new email messages very quickly.)

Ron Frazier
770-205-9422 (O) Leave a message.
linuxdude AT techstarship.com


Jim Kinney <jim.kinney at gmail.com> wrote:

check partition size. That could be the last block of the partition.

On Mon, May 14, 2012 at 12:06 AM, Ron Frazier (ALE) <atllinuxenthinfo at techstarship.com> wrote:

I was using this command recently to test a hard drive from a live CD of Ubuntu 11.10.

sudo badblocks -nsv /dev/sda3

When some storms came up, I terminated with CTRL-C. It said it stopped at block 48791295. I want to restart with the following:

sudo badblocks -nsv /dev/sda3 first-block 48791295

It says invalid last-block first-block. What's the problem?

Any help is appreciated, as always.

Sincerely,

Ron


--

Sent from my Android Acer A500 tablet with bluetooth keyboard and K-9 Mail.
Please excuse my potential brevity.

(To whom it may concern. My email address has changed. Replying to former
messages prior to 03/31/12 with my personal address will go to the wrong
address. Please send all personal correspondence to the new address.)

(PS - If you email me and don't get a quick response, you might want to
call on the phone. I get about 300 emails per day from alternate energy
mailing lists and such. I don't always see new email messages very quickly.)

Ron Frazier
770-205-9422 (O) Leave a message.
linuxdude AT techstarship.com

_______________________________________________
Ale mailing list
Ale at ale.org
http://mail.ale.org/mailman/listinfo/ale
See JOBS, ANNOUNCE and SCHOOLS lists at
http://mail.ale.org/mailman/listinfo




-- 
-- 
James P. Kinney III

As long as the general population is passive, apathetic, diverted to consumerism or hatred of the vulnerable, then the powerful can do as they please, and those who survive will be left to contemplate the outcome.
- 2011 Noam Chomsky

http://heretothereideas.blogspot.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20120514/9ac5cef7/attachment.html 


More information about the Ale mailing list