Move free space from end of the drive to first partition with gparted

28,538

It is recommended that, before making any changes, you make backups of any data you do not want to lose in case anything goes wrong.

Before you start, both partitions will need to be unmounted– if you cannot unmount one of them (e.g. because it is your root partition), use a live CD with GParted (e.g. the GParted live CD or the Ubuntu live CD) and resize them that way.

Select the second (extended) partition, and click on Resize/Move. Use the right handle to extend the partition to the end of the free space, and then click on Resize/Move. Select the contained swap partition, and click on Resize/Move. Drag the partition to the end of the extended partition, and then click on Resize/Move. You can safely click OK on this warning message, as we are only moving a swap partition. Warning message: "Moving a partition might cause your operating system to fail to boot[. ...] Failure to boot is most likely to occur if you move the GNU/Linux partition containing /boot, or if you move the Windows system partition C:. [...]" Select the extended partition again and click on Resize/Move. Use the left handle to shrink the partition to the end of the free space, and then click on Resize/Move. Then, select the first partition, and click on Resize/Move. Use the right handle to extend the partition to the end of the free space, and then click on Resize/Move. Finally, click on Apply and your partitions should be reformatted.

Share:
28,538

Related videos on Youtube

Tomáš Zato - Reinstate Monica
Author by

Tomáš Zato - Reinstate Monica

It might be easier to hire new management than to get a new community of volunteers. - James jenkins If you play League of Legends, check my repository: http://darker.github.io/auto-client/ I no longer play and I am actively looking for someone to maintain the project. It helped thousands of people, literally.

Updated on September 18, 2022

Comments

  • Tomáš Zato - Reinstate Monica
    Tomáš Zato - Reinstate Monica over 1 year

    I am in a frustrating situation - no matter how I try, gparted won't let me assign the empty space to the first partition:

    image description

    The middle partition is blocking me from expanding /dev/sda1. I need to move partition /dev/sda2 to the end of the drive, like so (fabricated image):

    image description

    Then I will be able to expand first partition:

    image description

    How to do that? I assume data from /dev/sda2 must be physically copied to end of the drive.

  • Alessio
    Alessio about 8 years
    +1. also, gparted.org has a downloadable CD / USB image that can be used.
  • Joe
    Joe about 8 years
    Good point - might be more suited for this job
  • frytaz
    frytaz over 5 years
    How to do the same with text mode parted or any other console tool ?
  • Michael Burr
    Michael Burr about 5 years
    Thanks for the great tutorial! I don't think I would have been able to figure this out on my own.