3

Okay, so I like how my drives are looking:

gparted gui

Well, almost. But I have two unallocated sections that I want to get rid of.

How do I do this? I click sda1 with a view to expanding it into 1 MB of unallocated space and sda1 I already as large as it can go.

I click sda5 with a view to expanded it into 1 MB of unallocated space and sda5 is already as large as it can go.

I click sda2 and it's already as large as it will go. Everything's as large as it can go! How can I expand into this unallocated space?

3

There are a number of issues which are probably going to make this difficult for you:

  • Traditionally, partitioning software liked to align partitions to logical tracks, so if you have 63 sectors per track, this meant aligning partitions to multiples of 63 sectors. In practice this is a small amount of data much smaller than a megabyte.

    However, hard drives have been using logical (ie, fake) addressing where the tracks and sectors are meaningless, for a long time. In reality hard drives now use a variable number of sectors per track from the outside to the inside of each disc.

    Nowadays, with flash and SSD drives being popular, partitioning software tends to prefer aligning partitions to multiples of 1MB.

  • The first partition cannot be at the very start of the drive because that space is reserved, so the first partition can only be either 63 sectors in (if aligning the old way) or 1MB in (if aligning the new way).

  • If you first partition was created with older partitioning software, it probably starts at the 63rd sector. If your subsequent partitions were created with newer partitioning software, it probably starts on a multiple of 1MB. Because these don't align, there will be a space between them of <1MB.

  • There is absolutely nothing wrong with this, particularly on a traditional hard drive (eg non-SSD) or as in your case, a virtual one. You can align however you like with no performance penalty. In addition, a space penalty of less than 1MB on a 50GB drive is so miniscule as to be ignorable. Don't put yourself through the trouble just to save less than 1MB. Your only issue is that it looks kinda ugly in Gparted.

  • Your other partition (sda5) is within an extended partition. Gparted is currently unable to move the boundaries of an extended partition. In addition, due to the space required at the start of an extended partition I have a feeling it's impossible to align it to a 1MB boundary and not have a very small amount of wasted space around it.

  • The other partition is a swap partition. Gparted may not be able to resize swap partitions, but that's no problem, since it's expendable data anyway so you can just trash it and create a new swap partition a different size.

That said, I can solve your problems. sda5 is only swap, so instead of resizing it, trash it, then trash that extended partition around it. That will consolidate all the free space into one blob.

Then, create a new swap partition occupying all that unused space.

You may still have <1MB gaps between partitions for the reasons highlighted elsewhere, but Gparted usually don't even show these if they are just around normal partitions.

| improve this answer | |
  • Thanks very much. I was just getting very ocd about it :P – Starkers Dec 12 '14 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.