Till today I was using ubuntu 13.04 in my windows7/ubuntu dual boot. Just now I have upgraded to ubuntu 14.04. My software updater showed an updates available message. I proceeded with Install Now . Soon I got the following window.

'Not enough free disk space' message

Then I tried sudo apt-get clean as recommended. Nothing happened! Not even a window opened. Teach me deleting the temporary packages.

Deleting temporary files may not be highly helpful in case of further updates and installs for I don't have too much space left in my /. I wanna extend my / partition with the help of the unallocated space in my HD. The following is my Gparted window.

Gparted window

I got an answer here. But it wasn't useful for me. I had two choices. But the answer wasn't working for both my chioces.

Choice 1: I may use the 4.25 GiB unallocated space to extend my /dev/sda10. To do so, I must need to move my linux-swap partition. But my Resize/Move option is disabled for the linux-swap partition. Choice 1 failed!

Choice 2: I may use the 14.35 GiB unallocated space instead. In this case I must move more than one partition. /dev/sda4 partition is the first on the list. Even that partition has the same problem. Resize/Move option is disabled. Choice 2 failed!

I am out of choices now.

What shall I do? Help me to extend my / with Gparted.

| improve this question | | | | |
  • 2
    Why does it says 1.96 GiB unused in your root? You actually have space, no? What's the output of df? – Braiam Jul 6 '14 at 0:20
  • 1
    apt-get clean doesn't pop-up a window or even echo to the command line what it did. It just does it, but the now freed 1.96 gb space shows it did something. – chaskes Jul 6 '14 at 0:25
  • 1
    Possible duplicate of How to resize partitions? – David Foerster May 12 '16 at 21:56

You actually can use the 4.25 GiB at the end without any reboot, because Linux supports on-line partition resizing since kernel 2.6 (meaning you can resize partitions while they're mounted, even the root partition, without any reboot).

I'll show you how to remove the swap partition and extend the root partition with all the free space at the end. Then I'll use the unallocated space in the beginning (14.35 GiB) for a new swap partition. Of course 14.35 GiB is a bit much so you can also choose to use some to extend your NTFS partition.

  1. Open GParted

  2. Right click on /dev/sda11 and select Swapoff

  3. Right click on /dev/sda11 and select Delete

  4. Click on Apply All Operations

  5. Open a terminal

  6. Extend the root partition:

    sudo resize2fs /dev/sda10
  7. Go back to GParted

  8. Open the GParted menu and click on Refresh Devices

  9. Right click on the unallocated space and select New

  10. Select linux-swap as file system

  11. Click on Add

  12. Click on Apply All Operations

Initially I wrote this using the command line only, but then I decided to try to use GParted as much as possible as this may be easier for you to see what's going on. You may even extend the root partition using GParted. But you need to unmount your root partition before you work on it. I mean you should work offline (using a liveUSB). In some cases your grub may get damaged. So do reinstall your grub before you leave out from your offline working.

I believe GParted will automatically enable the new swap partition but I'm not sure. You can always check by right clicking on it and then selecting Swapon. If this option is not available the swap partitions is probably already enabled.

Also the Refresh Devices step is probably unnecessary, but you should follow it just to be sure.

We cannot resize the extended partition (sda4, in this case) as it has a mounted logical partition within it. So we need to boot into the live mode of an Ubuntu USB/CD drive. From there, start GParted, turn off swap if necessary, right click on the extended partition and resize it to suit your needs. Then, follow the steps mentioned as needed to resize root and add back swap. In the event that your root partition UUID gets changed, you can update Grub by executing these steps in the live mode:

sudo mount /dev/sda10 /mnt 
sudo mount -o bind /dev/ /mnt/dev 
sudo grub-install --root-directory=/mnt /dev/sda 
sudo chroot /mnt /bin/bash 
# Now within the chroot
sudo update-grub
# Now outside chroot

The first command couple of commands mount the root partition (sda10, in this case) and sets up /dev/ for use within a chroot environment. (Other partitions that can be similarly mounted for a more functional chroot are /proc, /sys and /dev/pts.) Then we reinstall grub (not really necessary). Then, we enter the chroot and update grub. This causes grub to use the new UUIDs where necessary. After exiting the chroot, reboot and we should get the grub menu back.

| improve this answer | | | | |
  • @muru: Yes it have worked. Got my grub back! Thanks a bunch. Where to learn these things? I wanna learn. – Ramvignesh Jul 8 '14 at 0:10
  • 2
    @Ramvignesh - There's no single guide, but if you stick around on Ask Ubuntu, you'll find a lot of information. People here link to a lot of informative sites, and you see all sorts of problems and see how people wiser than you or I fix them. In this case, I learned about GRUB from help.ubuntu.com/community/Grub2/Installing. – muru Jul 8 '14 at 0:16
  • 4
    These instructions are incorrect: running resize2fs without first changing the size of the partition somehow will have no effect. You also have no need to run things from the command line as gparted takes care of this for you. Simply resize the root partition in gparted. – psusi Mar 22 '15 at 20:53
  • This worked fine for me, but I would note that per this askubuntu.com/a/600017/223089, you can extend the partition directly in Gparted. So I agree with @psusi above that it is easier at step 6 to extend the partition in Gparted. – John Creamer Feb 28 '16 at 11:22
  • @JohnCreamer, the main point I was making in my prior comment was that these instructions omit the step where the partition is actually enlarged, and without that, you can not enlarge the filesystem ( since it can not exceed the size of the partition containing it ) and so these instructions can not work for you if you follow them exactly. – psusi Feb 29 '16 at 23:30

You can't modify the systems's partitions (and parent extended partitons, like /dev/sda4) when the system is using them - so you need to modify the partitions from outside the system - the Ubuntu install disk should do for that. So first you need to boot from the disk, and open GParted.

  • If the partitions have a key next to them, they are in use - you need to right click on them and select unmount.
  • For the actual re-sizing, there are two fairly easy things you should be able to do:

    • Extend the extended partition /dev/sda4 to end of the disk, move the swap partition to the right, then expand the /dev/sda10 partition.

    • Reduce the size of the /dev/sda9 /home partition, and , then expand the /dev/sda10 partition.

Though moving all the partitions in /dev/sda4 to left, then moving the swap and expanding the partition, should work as well.

Though it is possible to have a running system with 5~GB of space in the / partition, it is likely to work better with at least 7-10GB of space.

As you should always do, you should backup your data before doing anything. Also, ss you are only using 4GB on the installed Ubuntu system, you could back this up elsewhere and do a fresh install, which means the packages from the old system won't be using space.

| improve this answer | | | | |
  • 4
    When suggesting the OP move partitions (vs expanding them), you should mention that it could take a very long time and that he will need to reinstall/fix grub2 from live media. – chaskes Jul 6 '14 at 0:31

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