GNOME Bugzilla – Bug 664050
Unable to resize extended partition
Last modified: 2012-04-09 20:13:59 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.
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.
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.
Created attachment 201379 [details] fdisk -l -u output file
Created attachment 201380 [details] parted output file
Created attachment 201381 [details] error
Created attachment 201382 [details] that is what i have
Created attachment 201383 [details] that's what i try to do
Created attachment 201384 [details] error print screen
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.
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?
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.
Thank you for reporting back. I will investigate this problem further to try to determine the root cause.
Re-filing this bug report as "Application" because it occurs on other GNU/Linux distributions.
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.
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
The enhancements for this bug report have been included in GParted 0.12.1 released on April 9, 2012.