To give more space to Ubuntu, you'll need to do a few things:
- Resize the extended partition (
/dev/sda3) to include the space freed up by the previous step.
- Decide whether the space is for system applications (those installed by
Software Centre, etc.) or user applications (those installed by you from source, precompiled binaries, etc.
- If the former, resize root (
/dev/sda5); if the latter, make a partition in the free space and mount it somewhere convenient. I'll cover the former for now, and the latter if anybody requests it.
To accomplish the first step, you have two options:
- Shrink using GParted or
- Shrink using the Disk Management section in Windows' Computer Management.
With GParted, you can shrink to free up as much space as available, but the operation will be slow. With Windows, shrinking will be very fast, but you may not be able to free up as much space as is shown to be unused. This is because the Windows utility only shrinks upto the last used sector, whereas GParted moves around files. I recommend that you see how much Windows is willing to free up, and if it is satisfactory, use it, or else use GParted. And if you do choose to use GParted, use a live CD/USB to do so. I'll assume a live environment for any Linux operations henceforth.
- To shrink in Windows, right click My Computer and select Manage. Go to the Disk Management section, select the C: partition, right click it and choose Shrink Volume:
- To do so in GParted: Unmount the partition first if it is mounted (the key icon shows it is mounted) by right clicking
/dev/sda2 and selecting Unmount. Choose Resize/Move, and drag the right end of the slider (or enter in values manually) until enough free space is shown at the end of the partition.
- Right click the root partition and select Information. You'll get a window that looks like this:
Copy the UUID to somewhere (open a file in
gedit and paste it there, if you will).
- Repeat the above step with the extended partition and the root partition, but this time dragging the slider to fill up the free space at the beginning.
- Click on the green tick to apply.
Once the operations have finished, you'll probably have to change the UUID values of the partitions (as used in
/etc/fstab, GRUB, etc.). For this, we will set up a
chroot. But first, repeat step 2 to get the new UUID of the root partition. If they are the same, no worries, skip the next section. You are done. If not:
Now open a terminal and do the following steps:
sudo mount /dev/sda5 /mnt
sudo mount -o bind /dev /mnt/dev
sudo mount -t devpts none /mnt/dev/pts
sudo mount -t proc none /mnt/proc
sudo mount -t sysfs none /mnt/sysfs
sudo chroot /mnt /bin/bash -l
Now, you will be inside a
chroot environment in your installed Ubuntu, as opposed to the live Ubuntu used to get there. We must replace the UUID value for root in
/etc/fstab, so use your choice of editor to open it and change the value to the one you copied a few steps ago (if you aren't familiar with
(You are root within the
chroot, so you don't need
Or use the
sed -i 's/OLD_UUID/NEW_UUID/' /etc/fstab
NEW_UUID with the appropriate values.)
Finally, update GRUB:
If this finished without errors, you can exit the chroot (
exit) and reboot. Done!