Bug 715114 - fdisk suggests creating extended partition of extremely small size < 1MB rather than a size of many GBs
Summary: fdisk suggests creating extended partition of extremely small size < 1MB rath...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: 15
Hardware: i686
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-21 21:49 UTC by Ken Fuchs
Modified: 2012-02-21 18:03 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Fedora 15 on Tunnel Creek SOC with Top Cliff chipset.
Last Closed: 2012-02-21 18:03:32 UTC
Type: ---


Attachments (Terms of Use)

Description Ken Fuchs 2011-06-21 21:49:52 UTC
Description of problem:

fdisk may suggest poor default values for the start of an extended (or primary) partition for a partition table made by an earlier version of fdisk or another program.

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

2.19.1-1.fc15

How reproducible:

start with this partition table definition:

# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 64.0 GB, 64023257088 bytes
255 heads, 63 sectors/track, 7783 cylinders, total 125045424 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: 0x000a3918

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63      524350      262144   83  Linux
/dev/sda2          524351    17301566     8388608   83  Linux
/dev/sda3        17303552    17827839      262144   83  Linux

#

In other words, start with a partially completed partition table missing one or more primary or its extended partition, created by an earlier version of fdisk or another program.  Add a primary or extended partition, accepting the default values suggested.

For example, 

Steps to Reproduce:
1. fdisk /dev/sda
2. n
3. e
4. Selected partition 4
   First sector (17301567-125045423, default 17301567): 
   Using default value 17301567
5. Last sector, +sectors or +size{K,M,G} (17301567-17303551, default 17303551): 
   Using default value 17303551
  
Actual results:

Command (m for help): p

Disk /dev/sda: 64.0 GB, 64023257088 bytes
255 heads, 63 sectors/track, 7783 cylinders, total 125045424 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: 0x000a3918

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63      524350      262144   83  Linux
/dev/sda2          524351    17301566     8388608   83  Linux
/dev/sda3        17303552    17827839      262144   83  Linux
/dev/sda4        17301567    17303551         992+   5  Extended

Expected results:

An extended partition spanning from the end of partition 3 to the end of the disk.  A 992 sector = 496 KB extended partition between partition 2 and partition 3 should not be suggested, since it would very rarely be useful for creating logical partitions.

Additional info:

One could say that the fdisk functions correctly and it is operator error to accept the useless extended partition default addresses it provides, but it should be clear that when the user creates an extended partition, it should use by the default the largest free area as opposed to the smallest free area, especially when that smallest free area is not even 1MB in size.

Accepting the defaults also creates out of order partitions, which isn't necessarily bad, but isn't what the user or some programs might expect.

Comment 1 Karel Zak 2012-02-21 18:03:32 UTC
(In reply to comment #0)
> One could say that the fdisk functions correctly and it is operator error to
> accept the useless extended partition default addresses it provides, but it

The fdisk command is simple and stupid, and it's expected ;-)

> should be clear that when the user creates an extended partition, it should use
> by the default the largest free area as opposed to the smallest free area,
> especially when that smallest free area is not even 1MB in size.

It uses the first free area without care about partition type. In the "First sector" dialog you can select the right place and skip useless gaps.

Anyway, I have added a note about this issue to util-linux upstream TODO list. I think we can improve the dialog to make it more user friendly. We will see...

Thanks.


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