Bug 682336 - First created logical partition created by parted is not of the user specified size
Summary: First created logical partition created by parted is not of the user specifie...
Keywords:
Status: CLOSED DUPLICATE of bug 623268
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: parted
Version: 5.5
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Brian Lane
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-04 21:24 UTC by Dwight (Bud) Brown
Modified: 2018-11-26 19:23 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-03-05 01:01:37 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Dwight (Bud) Brown 2011-03-04 21:24:02 UTC
Description of problem:
when parted is used to create the first logical partition within an extended partition, the created partition is of a different size than requested.  Seems to end up as a single cylinder group partition when the requested size is 1MB. This only happens on the 1st logical partition, works as expected if you create a primary partition or a non-first logical partition.


Version-Release number of selected component (if applicable):
parted-1.8.1-27.el5

How reproducible:
100%


Steps to Reproduce:
1. Create extended partition at <start>
2. parted -s mkpart logical <start> <start+1MB>
3. parted -s print
  
Actual results:

Starting point:

Number  Start   End     Size    Type      File system  Flags
 1      0.51kB  21.2MB  21.2MB  primary   ext2              
 2      100MB   200MB   100MB   primary                     
 4      600MB   1000MB  400MB   extended                    

Show primary partition creation end up as one expects:

# /sbin/parted /dev/sdb -s mkpart primary 200 201
# /sbin/parted /dev/sdb -s print

Number  Start   End     Size    Type      File system  Flags
 1      0.51kB  21.2MB  21.2MB  primary   ext2              
 2      100MB   200MB   100MB   primary                     
 3      200MB   201MB   1044kB  primary         <<<<            
 4      600MB   1000MB  400MB   extended                    

Do the same thing, except as a logical partition.

# /sbin/parted /dev/sdb -i mkpart logical 600 601
# /sbin/parted /dev/sdb -s print


Number  Start   End     Size    Type      File system  Flags
 1      0.51kB  21.2MB  21.2MB  primary   ext2              
 2      100MB   200MB   100MB   primary                     
 3      200MB   201MB   1044kB  primary                     
 4      600MB   1000MB  400MB   extended                    
 5      600MB   600MB   130kB   logical     <<<<


Expected results:
 5      600MB   601MB   1044kB   logical     <<<<

Additional info:
Customer reported issue, except in their case the created 
partition was 31.7kb instead of 1MB as requested.

It doesn't seem to matter where the extended partition starts, I moved the extended partition around a bit and still ended up with 130kb partition 
instead of the expected 1MB.

We may need just an explanation of how constraints are applied within
parted to effect the first logical partition size.  From fdisk, it looks
like just 1 cylinder group is allocated to the partition.  In all cases I tried
this seemed to be true.


Output of fdisk showing 1 cylinder group being allocated for 1MB partition 
request in parted:
Units = cylinders of 255 * 512 = 130560 bytes

/dev/sdb4            4598        7662      390787+   5  Extended
/dev/sdb5            4598        4598         127   83  Linux


Create a series of 1MB partitions, 2nd one backs up to abut the first one so no hole is created and rest are +/- .5*cylinder group size which I suspect is grain
size in parted so partitions 6-9 look as expected, leaving just partition 5, the first 1MB partition created, as odd.

# /sbin/parted /dev/sdb -s print

Number  Start   End     Size    Type      File system  Flags
 1      0.51kB  21.2MB  21.2MB  primary   ext2              
 2      100MB   200MB   100MB   primary                     
 3      200MB   600MB   400MB   primary                     
 4      600MB   1201MB  600MB   extended                    
 5      600MB   600MB   130kB   logical                     
 6      600MB   602MB   1566kB  logical                     
 7      602MB   603MB   1044kB  logical                     
 8      603MB   604MB   913kB   logical                     
 9      604MB   605MB   1044kB  logical     

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 1 sectors/track, 2451539 cylinders
Units = cylinders of 255 * 512 = 130560 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         162       20654+  83  Linux
/dev/sdb2             767        1532       97665   83  Linux
/dev/sdb3            1533        4598      390915   83  Linux
/dev/sdb4            4599        9196      586245    5  Extended
/dev/sdb5            4599        4599         127   83  Linux
/dev/sdb6            4600        4611        1529+  83  Linux
/dev/sdb7            4612        4619        1019+  83  Linux
/dev/sdb8            4620        4626         892   83  Linux
/dev/sdb9            4627        4634        1019+  83  Linux

Comment 1 Dwight (Bud) Brown 2011-03-04 21:29:24 UTC
I didn't know this, but the command line seems to accept floating point,
walking the end MB point by +0.1MB I found the specifying 601.4 jumps the created partition size by 1MB... no idea why and it still feels broken.

# /sbin/parted /dev/sdb -s mkpart logical 600.000 601.3
# /sbin/parted /dev/sdb -s print

Number  Start   End     Size    Type      File system  Flags                 
 3      200MB   600MB   400MB   primary                     
 4      600MB   1201MB  600MB   extended                    
 5      600MB   600MB   130kB   logical                     


# /sbin/parted /dev/sdb -s rm 5
# /sbin/parted /dev/sdb -s mkpart logical 600.000 601.4
# /sbin/parted /dev/sdb -s print

Number  Start   End     Size    Type      File system  Flags                   
 3      200MB   600MB   400MB   primary                     
 4      600MB   1201MB  600MB   extended                    
 5      600MB   601MB   1044kB  logical

Comment 2 Brian Lane 2011-03-05 01:01:37 UTC

*** This bug has been marked as a duplicate of bug 623268 ***


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