|Update (12-Feb-2019) – As noted in this posting, the options for disk partitioning while installing Linux can change with both the specific distro being installed and the version of that distro. An updated set of steps to manually partition a hard drive is given in the new tip Manual partitioning revisited. This new page is a how-to that is based on partitioning an actual hard disk (rather than the virtual drive described here) that already has Windows installed.|
Over the years, different versions of the Ubuntu Linux installer have come with a variety of options for disk partitioning. Sometimes the process has seemed clear “Use the largest continuous free space” – which was fine if there was free disk space available. Other useful options for new users of Linux have been “guided” disk partitioning or the availability of an automatic process to install Linux “side-by-side” with an existing Windows installation. A recent release (Ubuntu 11.04) featured a “something else” option when it came to allocating drive space, an option that didn’t seem entirely self explanatory!
The favourite suggestion seems to have been to use the entire disk to set up a single-purpose Linux box. This was accompanied by a scary (to most of us) message – “Erase entire disk – IDE1 master (hda)”. We may not have been sure what hda was but erasing entire disks seemed likely too much of a good thing just to install Ubuntu Linux.
A second option was often something to the effect of “Keep all partitions and use existing free space” or “Use the largest continuous free space”. This option is appropriate for dual-boot systems where, typically, Windows is already installed on a separate disk partition, and the remainder of the hard disk has only unallocated space. This is an attractive option but, as noted earlier, it’s only useful if there is space on the disk that is unallocated.
A third option – that also seemed scary, largely due to it being an unknown quantity – is frequently some form of manual disk partitioning. However, it shouldn’t be that scary. There are good graphical tools available for modifying disk partitions. Individual partitions may be made smaller, thus creating free space. Similarly, if no longer needed, a partition may be deleted in order to free up disk space. And, once we have unallocated space, we are then allowed to create a new disk partition(s) in that space.
This is the basis of the manual partitioning method when installing Ubuntu Linux. (Indeed, it is also the basis of installing Linux either using the entire disk or alongside Windows; these latter options just conduct the required partition modifications automatically.)
A simple manual disk partitioning scheme would be to create both a root partition and a swap partition in an area of unallocated disk space. This is easily undertaken as shown in the following example.
Selecting the manual partitioning option when installing Ubuntu Linux brings up a version of the Gnome Partition Editor (GParted). This utility scans the available hard drives and reports on the disk partitions that are present:
Note that the example uses screenshots taken from an installation of Ubuntu 10.04 LTS inside VirtualBox (a virtual machine). If you are using a “real” hard disk, the display will be different since it will likely show a number of disk partitions that are present on the drive (e.g. Windows (NTFS) drive c:, a recovery partition, etc.)
In our example, no partitions are yet present on the virtual disk drive. Clicking on the “New Partition Table” button essentially configures the entire drive as unallocated space.
Our first real task is to select the line marked “free space” and click on the “Add” button in order to create a disk partition.
In the first instance, we opt to create a 4 GB partition using the ext4 journaling file system. By clicking on the drop-down menu for “Mount point”, we may also select this partition as the root (/) directory for our Linux file system.
Moving on, we can see that we have now established a 4 GB root partition and still have a further 4 GB of free space.
Adding a second partition, we select its size as 1 GB and its type (using the drop-down menu) as “swap area”. This will be Ubuntu’s swap partition.
The final disposition of our manual partitioning operation is shown below – a 4 GB root partition, a 1 GB swap partition, and 3.5 GB remaining as free space.
Now, that wasn’t so scary, was it? Perhaps in future, we will be brave enough to use the stand-alone version of GParted to delete and resize our disk partitions, irrespective of whether or not this is needed for operating system installation.
For example, making the operating system’s partition smaller and creating a separate partition in the free space is an excellent technique for providing a dedicated partition for data files that can easily be backed up independently of the main operating system and its applications.
GParted partitioning software – Full tutorial
Modify Your Partitions With GParted Without Losing Data
Ubuntu-Video-Tutorials Basics: Partitioning
Ubuntu manual partitioning dual booting with XP