Bug 1306522 - badblocks only supports 32bit int for number of device blocks
badblocks only supports 32bit int for number of device blocks
Product: Fedora
Classification: Fedora
Component: e2fsprogs (Show other bugs)
Unspecified Linux
unspecified Severity low
: ---
: ---
Assigned To: Eric Sandeen
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2016-02-11 02:33 EST by Yasuo Ohgaki
Modified: 2016-02-11 09:29 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-02-11 09:29:12 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Yasuo Ohgaki 2016-02-11 02:33:29 EST
Description of problem:

It's not a bug strictly speaking, but 32 bit int for number of blocks is not large enough for current systems.

badblocks command only supports 32 bit int for number of device blocks. This limitation could work around by specifying start/end block option. There are many large disks that exceeds 32 bit int blocks today.

Version-Release number of selected component (if applicable):

How reproducible:

Use badblocks for large disks

[root@dev ~]# LC_ALL=C badblocks /dev/md0 
badblocks: Value too large for defined data type invalid end block (11720540160): must be 32-bit value

Actual results:

badblocks: Value too large for defined data type invalid end block (11720540160): must be 32-bit value

Expected results:

badblocks works for large disks

Additional info:

After disk failure, I got large number of bad blocks on mdadm RAID5 disk even if resync reports no errors. It seems there is something wrong in mdadm RAID5 also.
Comment 1 Eric Sandeen 2016-02-11 09:29:12 EST
badblocks is pretty much deprecated at this point, and is almost certainly the wrong tool to be using for a situation like this.  It was designed in the floppy disk days, when loss of sectors was expected; today if you have user-visible bad blocks, your storage is bad, likely to get worse, and needs to be replaced immediately.  Tracking bad block locations won't do any good.

For example, from the upstream maintainer, on the mailing list:

"I think badblocks is vestigal at this point, and for huge disk
arrays, almost certainly block replacement will be handed at the LVM,
storage array, or HDD level.  So it might be better simply to have
mke2fs throw an error if there is an attempt to hand it a 64-bit block


The 32-bit limit is intentional:

        /* ext2 badblocks file can't handle large values */
        if (last_block >> 32) {
                com_err(program_name, EOVERFLOW,
                        _("invalid end block (%llu): must be 32-bit value"),

which came from:

commit d87f198ca3250c9dff6a4002cd2bbbb5ab6f113a
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Wed Oct 23 19:43:32 2013 -0400

    libext2fs: reject 64bit badblocks numbers
    Don't accept block numbers larger than 2^32 for the badblocks list,
    and don't run badblocks on them either.

If you *really* want to try your luck, you can specify a larger block size for testing, i.e. badblocks -b 16384.  But I wouldn't really trust badblocks on large devices; it wasn't designed for this purpose.

Note You need to log in before you can comment on or make changes to this bug.