Bug 839458

Summary: fdisk does not working properly when creating extended partition on rhel6.2
Product: Red Hat Enterprise Linux 6 Reporter: mjin <mjin>
Component: util-linux-ngAssignee: Karel Zak <kzak>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: azelinka, mzheng, rvokal, wili
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-07 19:39:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 782183, 840685    

Description mjin 2012-07-12 02:19:50 UTC
Description of problem:

when create extended partition on rhel6 via fdisk. start sector for newly created partition(default) is not exictly the end sector for last partition just created. 
there is a gap(2049 sectors) between partitions. 

/dev/sda5 109467648 151410687
/dev/sda6 151412736 172384255
/dev/sda7 172386304 193357823

after they have created some extended partitions, they only can allocate 1024 blocks for newly created partition,(say on /dev/sda10 in this case). after they have allocated 1024 blocks for that partition, they could allocate block size as they wanted if they add a new partition continueously, 

[root@localhost ~]# fdisk -cu /dev/sda

Command (m for help): p

Disk /dev/sda: 299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders, total 584843264 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000961bc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    67520511    33554432   82  Linux swap / Solaris
/dev/sda3        67520512   109463551    20971520   83  Linux
/dev/sda4       109463552   584843263   237689856    5  Extended
/dev/sda5       109467648   151410687    20971520   83  Linux
/dev/sda6       151412736   172384255    10485760   83  Linux
/dev/sda7       172386304   193357823    10485760   83  Linux
/dev/sda8       193359872   214331391    10485760   83  Linux
/dev/sda9       214333440   235304959    10485760   83  Linux

Command (m for help): n
First sector (109465600-584843263, default 109465600): 
Using default value 109465600
Last sector, +sectors or +size{K,M,G} (109465600-109467647, default 109467647): 
Using default value 109467647

Command (m for help): p

Disk /dev/sda: 299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders, total 584843264 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000961bc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    67520511    33554432   82  Linux swap / Solaris
/dev/sda3        67520512   109463551    20971520   83  Linux
/dev/sda4       109463552   584843263   237689856    5  Extended
/dev/sda5       109467648   151410687    20971520   83  Linux
/dev/sda6       151412736   172384255    10485760   83  Linux
/dev/sda7       172386304   193357823    10485760   83  Linux
/dev/sda8       193359872   214331391    10485760   83  Linux
/dev/sda9       214333440   235304959    10485760   83  Linux
/dev/sda10      109465600   109467647        1024   83  Linux

Partition table entries are not in disk order

Command (m for help): 

Command (m for help): n
First sector (235307008-584843263, default 235307008): 
Using default value 235307008
Last sector, +sectors or +size{K,M,G} (235307008-584843263, default 584843263): 
Using default value 584843263

Command (m for help): p

Disk /dev/sda: 299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders, total 584843264 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000961bc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    67520511    33554432   82  Linux swap / Solaris
/dev/sda3        67520512   109463551    20971520   83  Linux
/dev/sda4       109463552   584843263   237689856    5  Extended
/dev/sda5       109467648   151410687    20971520   83  Linux
/dev/sda6       151412736   172384255    10485760   83  Linux
/dev/sda7       172386304   193357823    10485760   83  Linux
/dev/sda8       193359872   214331391    10485760   83  Linux
/dev/sda9       214333440   235304959    10485760   83  Linux
/dev/sda10      109465600   109467647        1024   83  Linux
/dev/sda11      235307008   584843263   174768128   83  Linux

Partition table entries are not in disk order
-----------------------------------------------------------------------


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

fdisk (util-linux-ng 2.17.2)
IBM x3650 M4 ( sas 300GB ) and DELL R710 ( sas 300GB )
kernel 2.6.32-220.el6.x86_64
Red Hat Enterprise Linux Server release 6.2 (Santiago)

How reproducible:

always

Steps to Reproduce:
1.
2.
3.
  
Actual results:

there is a 2049 sectors gap between extended partitions, and could only allocate 1024 blocks for uncertion partition somehow.


Expected results:

there should be no gap between extended partitions, and should allocate blocks as we wanted.

Additional info:

Comment 2 mjin 2012-07-12 02:38:11 UTC
i cannot repreduce this issue in my test environment, it seems like this issue only happens with specific device...

Comment 3 Karel Zak 2012-07-12 15:02:49 UTC
It's expected behavior.

For each logical partition is there a special partition table, see http://en.wikipedia.org/wiki/Extended_boot_record, it means that there has to be at least 1 sector gap between logical partitions.

.. but because the default grain for non-DOS mode (-cu options) is 1 MiB (2049 sectors) to align partitions for compatibility with 4K disks, RAIDs, ... the gap is 1MiB.

It's better to have gaps between logical partitions than misaligned partitions :-)

Sorry, not a bug from my point of view.

Comment 5 Karel Zak 2012-08-07 19:39:47 UTC
Closing.