7

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?

2 Answers 2

6

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).

17
  • Thank you very much and +1. I am writing this message from that Ubuntu system so I need to reboot using the Live CD to start implementing the steps you outlined. I will later update how it went. Commented Dec 12, 2010 at 17:03
  • 1
    And if you had already rebooted the system, boot from LiveCD and check the fdisk -l output — there is a change that gparted did not change it before hanging; then your data should still be there, because the new sda5 location at the end of free space does not overlap the original location. (Moving a partition to an overlapping location is much more dangerous.) Commented Dec 12, 2010 at 18:56
  • 1
    You should try to find out why GParted froze. It might be due to flaky hardware (then the installed OS would probably freeze under load too), some bug in your Ubuntu version (this might be fixed by updates), or a problem specific to Live CD environment (such as memory shortage). You can try SystemRescueCD, which requires less memory than a full Ubuntu LiveCD. Also run smartctl -HA -l error /dev/sda to make sure your HDD is OK (there should be no errors, and ideally zero reallocated and pending sectors). Commented Dec 12, 2010 at 19:24
  • 1
    This is strange; you should also compare the fdisk -l output with the snapshot you saved in the question. The unallocated space at the end may appear due to different HPA handling (e.g., Gigabyte motherboards tend to place a BIOS copy for recovery there), but given your disk size there may be at most several megabytes hidden there, not GiB. And, BTW, GParted there is newer, not older. Commented Dec 12, 2010 at 20:13
  • 1
    If you wrote “2.5GiB” instead of “2.5MiB”, then probably the newer GParted is just reporting the partial cylinder at the end of disk (recent versions of partitioning utilities do not try to align partitions to fictitious ”cylinders” for DOS compatibility, instead aligning to 1MiB boundaries for compatibility with 4K-sector hard disks and SSD drives; Microsoft systems since Vista use 1MiB alignment too). Commented Dec 12, 2010 at 20:43
1

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".

1
  • 2
    Please note the "edit" link underneath your post, and that we're not a forum. As posts might not appear in the order in which they were created, adding multiple "anwers" is not working too well here. Thanks!
    – Arjan
    Commented Dec 13, 2010 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .