After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678831 - Partition End Overlap when Resizing Extended Partition
Partition End Overlap when Resizing Extended Partition
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.12.1
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2012-06-26 03:35 UTC by Kyle Horatio Kosmo
Modified: 2012-07-13 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kyle Horatio Kosmo 2012-06-26 03:35:33 UTC
I have been requested by gedakc (GParted Developer) to submit this 'bug report'.
Please refer also to:
http://gparted-forum.surf4.info/viewtopic.php?id=16555

"The overlapping problem occurs when GParted tries to ensure that partitions do not overlap other partitions. At the moment, it is not correctly handling the case where the end of a extended partition matches exactly with the end of a logical partition."

"In your case the sda5 logical partition ends at sector 156,301,311.  GParted then incorrectly subtracts 1 MiB from the sda2 extended partition in an attempt to avoid an overlap.  The requested partition end of 156,299,263 then resides within sda5 logical partition which is indeed an overlap problem."

*******************************************************************

kayman@kayman-System-Product-Name:~$ sudo fdisk -lu
[sudo] password for kayman: 

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 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: 0x0971aa98

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    51199999    25599968+   7  HPFS/NTFS/exFAT
/dev/sda2        98064382   156301311    29118465    5  Extended
/dev/sda5       152111104   156301311     2095104   82  Linux swap / Solaris
/dev/sda6        98066432   152109055    27021312   83  Linux

Partition table entries are not in disk order
kayman@kayman-System-Product-Name:~$ 

**********************************************************************

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-GB' lang='en-GB'>
<head>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
<title>GParted Details</title>
</head>
<body>
<p>GParted 0.12.1</p>
<p>Libparted 2.3</p>
<table border='0'>
<tr>
<td colspan='2'>
<b>Move /dev/sda2 to the left and grow it from 27.77 GiB to 50.12 GiB</b>&nbsp;&nbsp;00:00:00&nbsp;&nbsp;&nbsp;&nbsp;( ERROR )
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
<table border='0'>
<tr>
<td colspan='2'>
calibrate /dev/sda2&nbsp;&nbsp;00:00:00&nbsp;&nbsp;&nbsp;&nbsp;( SUCCESS )
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
<table border='0'>
<tr>
<td colspan='2'>
<i>path: /dev/sda2<br />start: 98,064,382<br />end: 156,301,311<br />size: 58,236,930 (27.77 GiB)</i>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border='0'>
<tr>
<td colspan='2'>
move partition to the left and grow it from 27.77 GiB to 50.12 GiB&nbsp;&nbsp;00:00:00&nbsp;&nbsp;&nbsp;&nbsp;( ERROR )
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
<table border='0'>
<tr>
<td colspan='2'>
<i>old start: 98,064,382<br />old end: 156,301,311<br />old size: 58,236,930 (27.77 GiB)</i>
</td>
</tr>
</table>
<table border='0'>
<tr>
<td colspan='2'>
<i>requested start: 51,200,000<br />requested end: 156,299,263<br />requested size: 105,099,264 (50.12 GiB)</i>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table border='0'>
<tr>
<td colspan='2'>
libparted messages&nbsp;&nbsp;&nbsp;&nbsp;( INFO )
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
<table border='0'>
<tr>
<td colspan='2'>
<i>Unable to satisfy all constraints on the partition.</i>
</td>
</tr>
</table>
<table border='0'>
<tr>
<td colspan='2'>
<i>Can&apos;t have overlapping partitions.</i>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>========================================</p>
</body>
</html>
Comment 1 Curtis Gedak 2012-06-29 14:52:39 UTC
Thank you Kyle for reporting this problem.

I have been able to confirm the overlapping problem when resizing the extended partition using the following steps:

1)  Use fdisk to create the following MSDOS partition table layout:

$ sudo fdisk -l -u /dev/sda

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x000ddf4d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    51199999    25599968+   7  HPFS/NTFS
/dev/sda2        98064382   156301311    29118465    5  Extended
/dev/sda5       152111104   156301311     2095104   82  Linux swap / Solaris

2)  Use GParted to enlarge the sda2 extended partition by dragging
    the LHS boundary all the way to the left to butt up against
    the sda1 primary partition.

    In my case Free space preceding (MiB) was 13.

3)  Apply the operation and you will receive the following libparted
    error message:

    Unable to satisfy all constraints on the partition.

Now that I am able to reproduce the problem, I can begin work towards a fix.
Comment 2 Curtis Gedak 2012-06-30 16:23:37 UTC
The root of the problem appears to be GParted requesting an extended partition end sector that does not wholly encompass all the logical partitions.

Following are some notes I have made to myself regarding this problem.

156,299,263 sector requested end for sda2 extended partition
156,301,311 sector actual end for sda5 logical partition
                   and existing end for sda2 extended partition

For MiB alignment the next lowest and highest values are:

156,299,263 lower end sector MiB alignment boundary
156,301,311 upper end sector MiB alignment boundary

However, since the extended partition does not begin on a MiB boundary (i.e, it is not evenly divisible by 1 MiB = 2,048 sectors x 512 bytes per sector), the size not evenly divible by 1 MiB, and GParted rounds down the ending sector to ensure that it does not overlap any potential following partitions.

98,064,382 sector existing end for sda2 extended partition 

98,064,382 / 2,048 = 47,882.9990234 (hence not evenly divisible by 1 MiB).

Hence we will need to add logic to handle this situation.
Comment 3 Curtis Gedak 2012-06-30 16:25:54 UTC
Rename title from
     Partitions Overlapping Problem.
to
     Partition End Overlap when Resizing Extended Partition
Comment 4 Curtis Gedak 2012-06-30 16:57:20 UTC
A patch to address this problem has been committed to the git repository for inclusion in the next release of GParted.

The relevant git commit can be viewed at the following link:

Avoid end partition overlap when resizing extended partition (#678831)
http://git.gnome.org/browse/gparted/commit/?id=6a6607e1c69728b2fd55faf7927db5c979628514
Comment 5 Curtis Gedak 2012-07-04 16:45:11 UTC
Filing this bug report under "application" as it applies to GParted, and not just GParted Live.
Comment 6 Curtis Gedak 2012-07-13 16:50:22 UTC
The enhancement to address this bug report have been included in GParted 0.13.0 released on July 13, 2012.