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 664050 - Unable to resize extended partition
Unable to resize extended partition
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.9.0
Other All
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2011-11-14 15:54 UTC by The_Bonus
Modified: 2012-04-09 20:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
saved log file (2.04 KB, application/octet-stream)
2011-11-14 15:54 UTC, The_Bonus
Details
fdisk -l -u output file (1.13 KB, text/plain)
2011-11-14 16:51 UTC, The_Bonus
Details
parted output file (578 bytes, text/plain)
2011-11-14 16:52 UTC, The_Bonus
Details
error (1.96 KB, text/html)
2011-11-14 16:52 UTC, The_Bonus
Details
that is what i have (45.39 KB, image/png)
2011-11-14 16:53 UTC, The_Bonus
Details
that's what i try to do (50.31 KB, image/png)
2011-11-14 16:54 UTC, The_Bonus
Details
error print screen (47.54 KB, image/png)
2011-11-14 16:54 UTC, The_Bonus
Details

Description The_Bonus 2011-11-14 15:54:14 UTC
Created attachment 201376 [details]
saved log file

I have one primary partition with fat32 file system and one extended partition with two ntfs partitions.
I have reduce size of firs ntfs partition and move it to right - ok.
then i try to reduce size of extended partition (my target - increase size of primary fat32 partition) but i have an error here. log file attached.
this same error at 0.10 version.
Comment 1 Curtis Gedak 2011-11-14 16:25:31 UTC
When you resize the extended partition, are you using alig to "MiB", or align to "Cylinder"?

Would you be able to provide the output from the following two commands?

   fdisk -l -u

where one of the options is a lower case "L" and not the number one.

   parted /path-to-your-device unit s print

where /path-to-your-device is something like /dev/sda.
Comment 2 The_Bonus 2011-11-14 16:50:05 UTC
I using alig to MiB
OK, here is output:
Welcome - Parted Magic (Linux 3.0.0-pmagic)

root@PartedMagic:~# fdisk -l -u

Disk /dev/sdb: 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: 0xcc8dcc8d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63    16803989     8401963+   c  W95 FAT32 (LBA)
/dev/sdb2        16803990   156296384    69746197+   f  W95 Ext'd (LBA)
/dev/sdb5        21000192    86573055    32786432    7  HPFS/NTFS/exFAT
/dev/sdb6        86574348   156296384    34861018+   7  HPFS/NTFS/exFAT

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0xa5043cef

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63   976768064   488384001    7  HPFS/NTFS/exFAT
root@PartedMagic:~# 


Welcome - Parted Magic (Linux 3.0.0-pmagic)

root@PartedMagic:~# parted /dev/sdb unit s print
Model: ATA WDC WD800JB-00FS (scsi)
Disk /dev/sdb: 156301488s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start      End         Size        Type      File system  Flags
 1      63s        16803989s   16803927s   primary   fat32        boot, lba
 2      16803990s  156296384s  139492395s  extended               lba
 5      21000192s  86573055s   65572864s   logical   ntfs
 6      86574348s  156296384s  69722037s   logical   ntfs

root@PartedMagic:~# 

see log file attached. log saved in 0.9 version. this error also present in 0.10 version, but i don know how attach my device and save log in 0.10. for me 0.9 version have more useful tools with GUI.
Comment 3 The_Bonus 2011-11-14 16:51:17 UTC
Created attachment 201379 [details]
fdisk -l -u output file
Comment 4 The_Bonus 2011-11-14 16:52:05 UTC
Created attachment 201380 [details]
 parted output file
Comment 5 The_Bonus 2011-11-14 16:52:35 UTC
Created attachment 201381 [details]
error
Comment 6 The_Bonus 2011-11-14 16:53:33 UTC
Created attachment 201382 [details]
that is what i have
Comment 7 The_Bonus 2011-11-14 16:54:15 UTC
Created attachment 201383 [details]
that's what i try to do
Comment 8 The_Bonus 2011-11-14 16:54:47 UTC
Created attachment 201384 [details]
error print screen
Comment 9 Curtis Gedak 2011-11-14 17:29:44 UTC
Thank you for the additional detail.

From the gparted_details.htm log file, it appears gparted is trying to move the extended partition sda2 to sector 21,000,192.  However, logical partition sda5 begins at sector 21,000,192 and requires a few sectors in front for the Extended Boot Record (EBR).  An EBR is required for every logical partition.

This does indeed sound like a bug that I will need to investigate further.

In the mean time I can think of two work arounds:

A)  When shrinking the extended partition sda2, leave at least 1 MiB of space between the extended partition sda2 and logical partition sda5.

B)  When shrinking the extended partition sda2, use the align to "Cylinder" option.
Comment 10 Curtis Gedak 2011-11-14 17:56:17 UTC
Hmmm... I thought I would be able to easily reproduce this problem.  So far I have had no success.

Would you be able to report back if either of the work arounds allow you to resize the extended partition?
Comment 11 The_Bonus 2011-11-14 18:05:06 UTC
I use the align to "Cylinder" option when shrinking the extended partition sda2
and it's help me. Thank you. Maybe gparted must show additional information
when resizing extended partition or in other situation? Anyway thank you.
Comment 12 Curtis Gedak 2011-11-14 18:14:06 UTC
Thank you for reporting back.  I will investigate this problem further to try to determine the root cause.
Comment 13 Curtis Gedak 2012-01-21 19:55:49 UTC
Re-filing this bug report as "Application" because it occurs on other GNU/Linux distributions.
Comment 14 Curtis Gedak 2012-03-15 21:48:44 UTC
Finally, I have been able to recreate this problem.  :-)

I set up a drive with similar partition boundaries:

$ 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: 0x00098712

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    16803989     8401963+   c  W95 FAT32 (LBA)
/dev/sda2        16803990   312576704   147886357+   5  Extended
/dev/sda5        21000192    86573055    32786432    7  HPFS/NTFS
/dev/sda6        86574348   156296384    34861018+   7  HPFS/NTFS
$

Then I used GParted to resize/move the extended partition sda2 by dragging the left hand side of partition to but up against the edge of sda5.  I left the default settings (e.g., Align to MiB).  When I apply this operation it fails with output similar to the gparted_details log file in the initial post.

The amount of the "Free space preceding (MiB)" is 2048 in this above experiment.


Interestingly enough if I play with the "Free space preceding (MiB)" value by first shrinking sda1 to give me some room to play, I can get the sda2 resize operation to succeed.


For example if I move the start of sda2 left by 3 cylinders (~ 24 MB) and apply this operation I will have the following 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: 0x00098712

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    16755794     8377866    c  W95 FAT32 (LBA)
/dev/sda2        16755795   312528509   147886357+   5  Extended
/dev/sda5        21000192    86573055    32786432    7  HPFS/NTFS
/dev/sda6        86574348   156296384    34861018+   7  HPFS/NTFS
$


Then when I move sda2 left to butt up against sda5, the "Free space preceding (MiB)" value will be 2071.  When applied this operation will succeed.  The final layout is as follows:

$ 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: 0x00098712

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    16755794     8377866    c  W95 FAT32 (LBA)
/dev/sda2        20998144   312528895   145765376    5  Extended
/dev/sda5        21000192    86573055    32786432    7  HPFS/NTFS
/dev/sda6        86574348   156296384    34861018+   7  HPFS/NTFS
$


The conclusion I can draw from this is that I must have some rounding error in the partition boundary calculations that is invoked in certain circumstances.


Now that I have a repeatable test, I should hopefully be able to resolve this problem.
Comment 15 Curtis Gedak 2012-03-18 15:51:11 UTC
Two enhancements to address this problem have been committed to the GNOME repository for inclusion in the next release of GParted.

The relevant git commits can be viewed at the following links:

Add requested partition details to log when resize/move fails
http://git.gnome.org/browse/gparted/commit/?id=57ee0a1638b940de7f06e42affd426efd2defeac

Ensure space for EBR when resizing Extended partition (#664050)
http://git.gnome.org/browse/gparted/commit/?id=bee2a643e2040ab1664c4db7ad709063a8841c9a
Comment 16 Curtis Gedak 2012-04-09 20:13:59 UTC
The enhancements for this bug report have been included in GParted 0.12.1 released on April 9, 2012.