Ubuntu – How extend linux partition with?(after success to extend : fail to boot computer)

hard-disklinuxpartitionUbuntu

I have Ubuntu and I want to enlarge the disk space of /dev/sda1 from 10GB to 90GB.

gparted Ubuntu 9.04 live cd show:

 Partition    File System   Size
 /dev/sda1    ext4          10GB
 /dev/sda2    linux-swap    4GB
 unallocated  unallocated   146000

I would like to get this disk map:

 Partition    File System   Size
 /dev/sda1    ext4          90GB
 /dev/sda2    linux-swap    4GB
 unallocated  unallocated   56000

I click on /dev/sda1 and option resize only gives the option to reduce and not enlarge disk.

If gparted cannot handle this, are there other tools that would?

(I think that I should merge /dev/sda1 with unallocated but I don't know how to do it.)


Update:failing boot – unable to enter to my ubuntu OS, infinite loop in begining(solve the problem to enlarge partition but blocked to enter to my partition OS):

What I done:

  1. delete /dev/sda2
  2. resize /dev/sda1 to 160GB
  3. create /dev/sda2 with size 4GB primary partition and make it linux-swap
  4. restart PC and remove ubuntu live cd – result: unable to access to my installed before ubuntu OS.

my current map according gparted ubuntu live cd:

 Partition    File System   Size
 /dev/sda1    ext4          156GB
 /dev/sda2    linux-swap    4GB

Update2:

reinstall bootloader(Mat idea – thank you very much)
https://help.ubuntu.com/community/Grub2#Reinstalling_GRUB2
Thanks,

Best Answer

Disk partitions are linear chunks of your disk. You can't have a partition that starts at the top, has a hole in it, and continues somewhere else.


Usual warning: messing with your partition layout is one of the faster ways to lose all your data. Make sure you have a backup of anything important, and take your time - don't rush past warnings or errors the tools report.


Since sda2 is a swap device, it doesn't contain any useful information when the OS is not running; so you can just delete it.

Once that is done, you should be able to extend sda1 to however much you want, and re-create a swap partition.

You should also consider using lvm. It is quite handy and will allow you to control your disk usage more finely. See Setting Up LVM- Without A Clean Install for example.

Related Question