LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-04-2020, 05:50 PM   #1
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 2,147

Rep: Reputation: 275Reputation: 275Reputation: 275
Why does badblocks check more blocks than the disk has?


badblocks finds 80,475,544 bad blocks.

Code:
dumpe2fs -b /dev/sdb1
returns no blocks.

Code:
 e2fsck -L BadBlockList /dev/sdb1
returns
Quote:
Bad block xxxx out of range; ignored
for every entry in BadBlockList.

Code:
 dumpe2fs -x /dev/sdb1
returns
Quote:
Block count 29,304,950
.

The lowest block in BadBlockList is 36,744,256.

I see a problem:
Code:
 badblocks /dev/sdb1
reports
Quote:
Checking blocks 0 to 117219799
- way too many. Where does it get this number?

Last edited by RandomTroll; 04-04-2020 at 10:46 PM. Reason: More explicit
 
Old 04-04-2020, 06:00 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,843

Rep: Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263
Please show us the exact commands you're running. On my 'puter, all of those commands require the specification of a device name, and simply return syntax instructions without one.
I also note this in the dumpe2fs man page
Code:
Note: When used with a mounted filesystem, the printed information may be old or inconsistent.
and
Code:
-x     print the detailed group information block numbers in hexadecimal format
 
Old 04-04-2020, 10:52 PM   #3
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 2,147

Original Poster
Rep: Reputation: 275Reputation: 275Reputation: 275
Quote:
Originally Posted by scasey View Post
Please show us the exact commands you're running. On my 'puter, all of those commands require the specification of a device name, and simply return syntax instructions without one.
I thought anyone could figure that out, but I put them in for you.

Quote:
Originally Posted by scasey View Post
I also note this in the dumpe2fs man page
Code:
Note: When used with a mounted filesystem, the printed information may be old or inconsistent.
The filesystem was not mounted.

Quote:
Originally Posted by scasey View Post
and
Code:
-x     print the detailed group information block numbers in hexadecimal format
[/quote]
group information block numbers, not the summary information. -x was irrelevant to the information I reported.
 
Old 04-05-2020, 01:12 AM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,843

Rep: Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263Reputation: 2263
OK. Not at my ‘puter just now, but please review the man pages about the differences in default block sizes used in the various tools.
 
Old 04-05-2020, 09:05 AM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 2,147

Original Poster
Rep: Reputation: 275Reputation: 275Reputation: 275
Quote:
Originally Posted by scasey View Post
please review the man pages about the differences in default block sizes used in the various tools.
I had to do that in the first place, as I rarely use these tools. The information I reported is correct and in the same base. The question is 'whence gets badblocks the number of blocks to check?' It uses too-high a number for this disk, more than 3 times the number dumpe2fs reports, which corresponds to the size of the disk as reported by the documentation, thus reports 87 million bad blocks, because they aren't there.
 
Old 04-05-2020, 09:35 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,804

Rep: Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224
Read them again, especially the part of the e2fsck manpage that reads:
"Note that the block numbers are based on the blocksize of the filesystem. Hence, badblocks(8) must be given the blocksize of the filesystem in order to obtain correct results."
and the part of the badblocks manpage that reads:
"-b block-size
Specify the size of blocks in bytes. The default is 1024."
and note that "0 to 117219799" is 117,219,800 blocks, which is exactly 4 times the filesystem block count of 29,304,950.
 
2 members found this post helpful.
Old 04-06-2020, 01:05 AM   #7
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 2,147

Original Poster
Rep: Reputation: 275Reputation: 275Reputation: 275
Quote:
Originally Posted by rknichols View Post
Read them again, especially the part of the e2fsck manpage that reads:
"Note that the block numbers are based on the blocksize of the filesystem. Hence, badblocks(8) must be given the blocksize of the filesystem in order to obtain correct results."
and the part of the badblocks manpage that reads:
"-b block-size
Specify the size of blocks in bytes. The default is 1024."
and note that "0 to 117219799" is 117,219,800 blocks, which is exactly 4 times the filesystem block count of 29,304,950.
That portion of the man page of e2fsck goes on to say
Quote:
it is much simpler and safer to use the -c option to e2fsck.
I ran badblocks only because 'e2fsck -c' failed in the same way, tried to correct all 87 million errors. And I had an off-by-one error dividing 117219799 by 29304950. So I really need to use the -B on e2fsck. Thanks.
 
Old 04-06-2020, 01:31 PM   #8
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 2,147

Original Poster
Rep: Reputation: 275Reputation: 275Reputation: 275
dumpe2fs reports the correct block size - how can e2fsck & badblocks get it wrong?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How can disk reporting badblocks>0 suddenly become badblocks==0? kaza Linux - Hardware 2 04-09-2019 07:45 PM
Will badblocks scan results (/tmp/bad-blocks.txt) still be relevant after I reformat the external HD? Squirell_Nutkin Linux - Hardware 10 04-01-2016 09:58 AM
RAM badblocks check. bruse Linux - Newbie 2 07-11-2005 04:45 PM
Badblocks check in Linux ssampurna Red Hat 5 02-28-2005 02:27 AM
badblocks check... wrongman Linux - Hardware 3 05-20-2004 11:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration