Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 626374 - fdisk incorrectly checks alignment for non-512-byte *logical* sectors.
fdisk incorrectly checks alignment for non-512-byte *logical* sectors.
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: util-linux-ng (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Karel Zak
Depends On:
  Show dependency treegraph
Reported: 2010-08-23 07:58 EDT by Karel Zak
Modified: 2011-05-19 10:06 EDT (History)
4 users (show)

See Also:
Fixed In Version: util-linux-ng-2.17.2-9.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-05-19 10:06:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0699 normal SHIPPED_LIVE util-linux-ng bug fix and enhancement update 2011-05-18 14:10:13 EDT

  None (edit)
Description Karel Zak 2010-08-23 07:58:20 EDT
Copy & past from upstream:

     # modprobe scsi_debug dev_size_mb=1024 sector_size=4096
     # fdisk /dev/sdb
      Command (m for help): n
      Command action
        e   extended
        p   primary partition (1-4)
      Partition number (1-4, default 1):
      Using default value 1
      First sector (256-262143, default 256): 257
      Last sector, +sectors or +size{K,M,G} (257-262143, default 262143): +100M
      Command (m for help): p
      Disk /dev/sdb: 1073 MB, 1073741824 bytes
      32 heads, 32 sectors/track, 256 cylinders, total 262144 sectors
      Units = sectors of 1 * 4096 = 4096 bytes
      Sector size (logical/physical): 4096 bytes / 4096 bytes
      I/O size (minimum/optimal): 4096 bytes / 262144 bytes
      Disk identifier: 0x16db2bb0
        Device Boot      Start         End      Blocks   Id  System
      /dev/sdb1            257       25855      102396   83  Linux
      Partition 1 does not start on physical sector boundary.
     The warning is nonsense. The logical and physical sector size is the
     same. It means that every LBA is always aligned to physical sector
     Note that this bug does not mean that fdisk produces unaligned
     partitions. The problem is that fdisk forces to use bigger gaps
     between aligned LBAs, for example:
       correctly aligned LBA are: 256, 257, 258, ...  [N+1]
       fdisk assumes:             256, 264, 272, ...  [N+(sector_size/512)]

Bug fix is pretty simple:

-	unsigned long long offset = (lba << 9) & (granularity - 1);
+	unsigned long long offset = (lba * sector_size) & (granularity - 1);
Comment 4 errata-xmlrpc 2011-05-19 10:06:20 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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