How do I move this unallocated space to the beginning of the disk?

I need to move a 420GB unallocated space, buried in an extended partition, to the beginning of the disk.

Is there a way to do this using GParted?

Here is the current 'fdisk -l' snapshot:

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0c85ac80

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1992    16000708+  83  Linux
/dev/sda2            1993       60801   472383292+   5  Extended
/dev/sda5            1993        3984    16000708+  83  Linux
/dev/sda6           58810       60801    16000708+  82  Linux swap / Solaris

And in Gparted, it looks like this:

alt text

Unfortunately, when I select the unallocated space, the only operation available form the 'Partition' menu is 'New'.

Is it really impossible to move this partition?

If it is, how do I do this in Gparted?


Solution 1:

Instead of trying to move the unallocated space, you should move partition(s) which are in the wrong place — in your example you need to move at least sda5 to the end of the free space, then you would be able to move the start of the extended partition. Then you can try to move sda1 if it is really required (but note that it might require reinstallation of the bootloader due to absolute sector numbers embedded in boot sectors, so don't touch it unless it's really necessary).

Solution 2:

OK, here is the final verdict: It seems that on Ubuntu 8.0.4 64-bit, using GPart 0.3.5 (or parted) that comes with it, it is impossible to move the extended partition sda2.

When I tried 'resize 467335733760 500105249279', parted refused to perform the operation, claiming the the partition can't have end before start!

So, here is what I did (using GParted 0.3.5):

  1. swapoff for sda6
  2. move sda5 back to the beginning of sda2
  3. move sda6 (swap) right after sda5
  4. resize sda2 to sda5+sda6

I tried moving sda2 to the end but GParted 0.3.5 won't let me! So, my current partitioning snapshot is as follows:


alt text

Note that emphasize GParted version (0.3.5) since this is what comes with the Ubuntu 8.0.4.4 64-bit LiveCD, which is the only one that works with the existing sda configuration, as both the SystemRescueCD and the GPartedLiveCD fail fsck with the false message "Device or resource busy while trying to open /dev/sda5".