1

Topic: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

GParted Live CD 012.1.-5
After successfully shrinking WinXP partition an unallocated  partition was (expectedly) created which I wish to add to my Ubuntu partition.
I right-click onto the 'extended' File System, move the slider to the maximum size, click the 'Resize/Move' button and then the 'Apply' button (twice).
An error message indicates that: "move partition to the left and grow from 27.77 GiB to 50.17 GiB" failed.
I read the manual and watched various 'You Tube' tutorials and am trying for the last 3 days to overcome this challenge but without success!
Grateful if somebody please give me a helping hand to have these two partition merged successfully. TIA.

2

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Please, try to save GParted details after the end of the operation.
You have to press the Save details button and copy the html file from the ram to an external storage device like usb stick or floppy disk.

Please, attach the output of the command
sudo fdisk -lu
too. It contains useful information on the partitions.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

3

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Thanks for responding!

I am unable (most likely too incompetent) saving the error message. I inserted an USB stick but no response on the monitor whatsoever (pity the 'Help' item on the live cd isn't functioning).

Anyway, I copied the messages by hand...:
"An error occurred while applying the operation"
Details:-
Move /dev/sda2 to the left and grow it from 27.77 GiB to 50.12 GiB 00:00:00 (red disk/white crossbar - failed)

Calibrate /dev/sda2
path: /dev/sda2
start: 9.8,64,382
end: 156,301.311
size: 58.236,930 (27.77 GiB)

Move /dev/sda2 to the left and grow it from 27.77 GiB to 50.12 GiB 00:00:00 (green checkmark - okay)
Calibrate /dev/sda2
path: /dev/sda2
start: 98,064,382
end: 156,301.311
size: 58.236,930 (27.77 GiB)

Move /dev/sda2 to the left and grow it from 27.77 GiB to 50.12 GiB 00:00:00 (red disk/white crossbar - failed)
old start: 98.064.382
old end: 156,301,311
old size: 58,236,930 (27.77 GiB)

requested start: 51.200.000
requested end: 156.299.263
requested size: 105.099.264 (50.12 GiB)

libparted messages:
Unable to satisfy all constraints on the partitions.
Can't have overlapping partitions.
==========
Copied/pasted from terminal:

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        98064384   152109055    27022336   83  Linux

Partition table entries are not in disk order
=======

I sincerely hope that these messages will assist you to determine corrective course of action.
Many thanks in advance!

4

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

libparted messages:
Unable to satisfy all constraints on the partitions.
Can't have overlapping partitions.

I suspect a possible problem: the logical partitions in /dev/sda2 aren't in order.
This isn't a problem for primary partitions, however it can be a problem for many disk tools, including GParted and parted, due to the structure of the extended partition in the "msdos type" partition table.
/dev/sda5 is at the end of the extended partition space, and /dev/sda6 is located before /dev/sda5.

I encounter this problem often lately.
I would recommend a backup before anything further on the drive.
Solutions I think to:

- Try to manually delete and rebuild the partitions in the same positions, in the right order, with fdisk. This means that you have to keep the exact positions for every partition (with sector accuracy). Then you have to reconfigure the ubuntu installation with the new mount points and fix bootup. Of course, this isn't so simple.

- Try to manually edit the partition table data and the extended boot sectors with a disk editor, to recreate the partition structure in the right order with the /dev/sda5 before /dev/sda6. Then, parted could detect the logical partition structure and be able to proceed to resize operations. This is even more complicated for non experienced users, and needs a bigger mastery. 

- Try to use the original tool that created the partitions in this order (although there are many tools that create partitions and few ones that resize them).

- Delete the entire extended partition (after backup of every important file), rebuild it in the right position, and reinstall ubuntu with the partitions located in order (5 before and 6 after), or create the partitions before installation with the GParted livecd and install ubuntu using them. These new partitions can be MiB-aligned, as the ones in the current installation. You have to fix grub and restore user's material from the backup copy.

I'm afraid that, if the 3rd solution doesn't work, the 4th one is the simplest for non experienced users.
Perhaps Gedakc could add some other idea, if I missed anything. smile

*** It is highly recommended to backup any important files before doing resize/move operations. ***

5

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Thanks again for detailed and comprehensive response!

I am more than happy to go with option #4. As you would have guessed by now my level of experience is pretty low.

You see, my original thought was:
a) to shrink the WinXP partition (which I successfully completed and which created an unallocated partition), 
b) to add the unallocated space (partition) to the Ubuntu partition thus increasing Ubuntu's disk space (which I failed to do so), and finally
c) to install Linux Mint Debian (LMDE) over Ubuntu.

Now, deleting a partition is easy (like right-click and hit 'delete'), could you kindly please provide me with some pointers as to "rebuild it in the right position" ensuring that the installation process of LMDE runs smoothly.
Cheers...

6

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

What version of GParted are you using?

GParted 0.12.1 includes a fix to ensure Align to MiB does not overlap the following partition.

7

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

As mentioned in my original post, I am using GParted Live CD 012.1.-5 but am unsure how to proceed to ensure aligning to MiB won't overlap the following partition.
Cheers...

8

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

It would be very helpful if you can save the entire gparted_details.htm file and post the contents here.  See Saving GParted Details in the GParted Live Manual for instructions on how to do this.

After that a work around would be to leave 1 MiB of space between the partitions when you perform the resize operation.

9

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Followed GParted Live Manual instructions to the letter (rebooted about 10 times then gave up).

"Error while mounting /dev/sdb on /tmp/myusb: Invalid argument".
Or
"cannot create regular file 'tmp/myusb': No such file or directory".

Your other suggestion leaving 1 MiB of space between the partitions when performing the resize operation did not work either. Though the system allowed me to add free space of 1MiB 'preceding' but not 'following'; Resizing failed.

10 (edited by gedakc 2012-06-23 21:04:41)

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

That is unusual.

Which file system do you have on your USB flash drive?

Another way to approach the problem is to enable networking and use the Netsurf browser (both on the Live image desktop) to directly connect to this forum.

[EDIT]
To learn more about the problem, I have tried to recreate the same partition table using a different tool -- fdisk.  Unfortunately I have not been able to get fdisk to create partition 6.  Following is how far I get:

$ sudo fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): unit s
Changing display/entry units to sectors

Command (m for help): p

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

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First sector (98064445-156301311, default 98064445): 98064384
Value out of range.
First sector (98064445-156301311, default 98064445): 

The fdisk tool can accept a higher starting sector (e.g., 98064445 instead of 98064384) for partition 6, but this is not an accurate recreation of your partition table.

This suggests to me that perhaps more space is required between the start of the extended partition (sda2) and the logical partition nearest this position (sda6).

Perhaps you could try resizing only the start of the sda2 partition so that there is at least 1 MiB of unallocated space before the sda6?

11

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Thanks for informative response and your patience!

The filesystem of all my USB flashdrives is: msdos. And all have more than 50% spare capacity, in fact one drive is brand new. The makes are: Apacer (brand new, 32GB, 100% capacity), 2 x Kingston 4GB & 16Gb respectively, SanDisk 8GB and Sony 8GB.
I've used all of the flashdrives several times with the same result: "Error while mounting /dev/sdb on /tmp/myusb: Invalid argument".

I was able adding 1 MiB of unallocated space before sda6 (Ubuntu partition). The entire operation took about 40 minutes to complete (i.e. "Move /dev/sda6 o the right and shrink it from 25.77 GiB to 25.77 GiB"). Please note that the GiB values are accurately copied.
FYI: The entire operation is comprised of:
1st operation: 25.71 GiB using a block size of 8.00 GiB.
2nd operation: 25.69 GiB using a block size of 8.00 GiB.

The new window looks like this:
Partition------File System---Size------Used-----Unused----Flags
/dev/sda2-------ntfs-------21.41GiB--20.23GiB--4.18GiB----boot
unallocated---unallocated--22.35GiB------------------------------
/dev/sda2----extended----27.77GiB-------------------------------
unallocated---unallocated---1.00MiB-------------------------------
/dev/sda6------ext4-------25.77GiB--15.69GiB--10.08GiB---------
/dev/sda5-----linux-swap--2.00GiB--------------------------------

As before, I was not able saving anything to the USB drive.

Rebooted the system.

Tried to resize (grow) /dev/sda2----extended----27.77GiB partition.
"An error occurred while applying the operation"
Details:-
Move /dev/sda2 to the left and grow it from 27.77 GiB to 50.12 GiB 00:00:00 (red disk/white crossbar - failed).

Perhaps it would be better loking into a more basic aproach for resizing the partitions.

When booting into WinXP, Computer Management==>Disk Management, the HDD shows:
(C:)
24.41 GB NTFS, Healthy (System)
22.35 GB Unallocated
25.77 GB Healthy (Unknown Partition)
2.00 GB Healthy (Unknown Partition)

Question:
If I were to delete the 2 Healthy (Unallocated [Ubuntu] Partitions - 25.77 GB & 2.00 GB respectively) would they merge with the 22.35 GB Unallocated partition thus creating one big unallocated partitionof 50.12 GB?
If so, I could then easily reinstall Ubuntu.

12

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

And thank you kayman for your persistence.

kayman wrote:

The filesystem of all my USB flashdrives is: msdos. And all have more than 50% spare capacity, in fact one drive is brand new. The makes are: Apacer (brand new, 32GB, 100% capacity), 2 x Kingston 4GB & 16Gb respectively, SanDisk 8GB and Sony 8GB.
I've used all of the flashdrives several times with the same result: "Error while mounting /dev/sdb on /tmp/myusb: Invalid argument".


I finally discovered the bug in the documentation for mounting the USB flash drive.  The problem is that the partition number is missing!!!  My bad.  ;(

The mount command should read:

sudo mount /dev/sdc1 /tmp/myusb

Notice the extra number "1" after the device name "/dev/sdc".

I will add updating the documentation to my todo list.

If you can successfully mount the USB drive, would you please try the operation that fails, save the log file, and post it here?

The log file contains much information that will be useful to troubleshoot this problem.


kayman wrote:

Question:
If I were to delete the 2 Healthy (Unallocated [Ubuntu] Partitions - 25.77 GB & 2.00 GB respectively) would they merge with the 22.35 GB Unallocated partition thus creating one big unallocated partitionof 50.12 GB?
If so, I could then easily reinstall Ubuntu.

If you have your data backed up from these partitions, then yes deleting these partitions is certainly an option for re-installing Ubuntu.  My concern is that you don't lose any of your data, hence the need for a backup.

13

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Okay, adding the partition number '1' did the job!

My mount command was:
sudo mount /dev/sdb1 /tmp/myusb

Maybe I won't have to re-install Ubuntu after all and hope that the 'gparted_details.htm' will assist you helping me. I am more than happy carrying out additional tasks pertaining this issue.

Please find below the log file:

file:///media/WORKFLASH/gparted_details.htm

<!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>

======Cheers...

14

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Thank you kayman for providing this extra information.  Due to your persistence you have found a bug in GParted that definitely needs to be fixed.

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.

Would you be able to open a bug report for this problem, and provide both the gparted_details.htm log file, and the output from fdisk -l -u?

A bug report will help us better track the problem and the steps towards resolution.

15 (edited by kayman 2012-06-26 05:17:28)

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

gedakc wrote:

..., and the output from fdisk -l -u?

Where and how would I find the output from fdisk -l -u?

Here is what I've tried (without success):

kayman@kayman-System-Product-Name:~$ fdisk -l -u
kayman@kayman-System-Product-Name:~$ fdisk
Usage:
fdisk [options] <disk>    change partition table
fdisk [options] -l <disk> list partition table(s)
fdisk -s <partition>      give partition size(s) in blocks

Options:
-b <size>             sector size (512, 1024, 2048 or 4096)
-c[=<mode>]           compatible mode: 'dos' or 'nondos' (default)
-h                    print this help text
-u[=<unit>]           display units: 'cylinders' or 'sectors' (default)
-v                    print program version
-C <number>           specify the number of cylinders
-H <number>           specify the number of heads
-S <number>           specify the number of sectors per track

kayman@kayman-System-Product-Name:~$

Cheers...

[EDIT]

Instead using command 'fdisk -l -u'  I used command 'sudo fdisk -lu' and hope that this was the right course of action.

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:~$

Cheers...

16

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Thank you kayman for persevering.  Adding "sudo" in front of the command was correct.

And thank you for creating the bug report.
Bug 678831 - Partitions Overlapping Problem

I plan to look further into the problem in the next day or so.  Hopefully I can quickly pinpoint the exact problem and come up with a good code fix.

17

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

The crux of the problem is that GParted is requesting an extended partition end that does not encompass the last logical partition on the disk.

156,299,263 requested end sector for sda2 extended partition
156,301,311 end sector of sda5 logical partition

I am working on a code fix for this.

18

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Hi kayman.  A fix for this problem has been committed to the git repository for inclusion in the next release of GParted.

In the meantime, you might try the following steps as a work around:

1)  Shrink sda5 logical partition by 1 MiB so that there is 1 MiB space showing between end of sda5 and end of sda2.  Apply operation.
2)  Enlarge the sda2 extended partition by dragging the left hand side all the way to the left.  Apply operation.
3)  Further enlarge the sda2 extended partition by draggin the right hand side to the right.  Apply operation.
4)  Enlarge sda5 logical partition to recover the space that was freed up in step 1.  Apply operation.

19 (edited by kayman 2012-07-01 06:46:01)

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

Many thanks for the instructions.
My HDD looks like this:

[start]
------Partition------|------FileSystem-----|------Size------|------Used------|-----Unused-----|------Flags------|
....../dev/sda1........|............ntfs..............|......24.41GiB....|........20.13GiB...|........4.28GiB......|..........boot.......|
....../dev/sda2........|..........extended........|......50.12GiB....|........................|..........................|........................|
....unallocated........|.........unallocated......|......22.35GiB....|........................|..........................|........................|
...../dev/sda6.........|............ext4.............|......25.77GiB....|.......8.69GiB......|.......17.08GiB.....|.........................|
...../dev/sda5.........|......linux-swap..........|......1.97GiB.....|.........................|..........................|........................|
....unallocated........|........unallocared.......|.....27.00MiB....|.........................|...........................|........................|
....unallocated........|........unallocated.......|.......1.09Mib....|.........................|...........................|.......................|
[end]

Evidently, I somehow managed to screw-up again and before trying anything else am rather awaiting the next release of GParted. 

Thanks again, it certainly was an interesting experience.
Cheers...

I hope that this is better to read....

[start]
---Partition---|---FileSystem---|----Size----|---Used---|---Unused---|---Flags----|
....../dev/sda1...|...ntfs.............|...24.41GiB..|..20.13GiB...|...4.28GiB..|...boot.....|
....../dev/sda2...|...extended.....|...50.12GiB..|.............|.....................|............|
....unallocated...|...unallocated..|...22.35GiB...|.............|.....................|............|
...../dev/sda6....|...ext4............|...25.77GiB...|...8.69GiB...|...17.08GiB.|............|
...../dev/sda5....|...linux-swap...|...1.97GiB...|.............|............|............|
....unallocated...|...unallocared...|...27.00MiB...|.............|............|............|
....unallocated...|...unallocated...|....1.09Mib...|.............|............|............|
[end]

20

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

For capturing the layout of the partition table, command line tools like fdisk and parted work well.

For example:

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.

When troubleshooting problems, this extra level of detail is very helpful.

With regards to the next release of GParted, I still have another issue to look into.  Once that is take care of then I can look at creating a new release.  If you are keen, you can always try compiling the version in the git repository.

21

Re: Adding/Merging Partition (dual boot WinXP & Ubuntu 12.04)

All this is just a little too much and complex for me and have decided to wipe the HDD clean and re-install the os. All is working smoothly now.
Thanks again for all your assistance.