Saturday, January 17, 2015

Partitioning a disk to install Ubuntu

One of the biggest stumbling block for a newbie to install Linux on a machine with Windows on it is partitioning the hard drive. Partitioning a disk is tricky without the added pressure of knowing that if you mess something up, you risk losing a working installation of Windows as well. Here's the good news - Ubuntu has made it really easy. Apart from the partitioning window, things don't get too complicated when installing Ubuntu. Here's how to go about it.

First off, we need to understand the basic difference between a Windows filesystem and a Linux filesystem. Think of Windows as a block diagram where the various partitions of a hard drive sit at the same level. Your C drive and your D drive are the parent folders of their own heirarchies, something like this - 

Basically, the logical partitions of a windows hard drive are masters of their own domains (no puns intended). They command their own trees like feudal lords, so to say. Their respective drives form their own folder structures and the root folder of each logical partitiom is the beginning of the structure. Linux is a bit different, something like this - 

The folder structure itself acts as a organizing system for logical partitions in Linux whereas the partitions act as the base for the folder structure in Windows. This means that teh entire hard disk (the physical partition) needs a mount point too. This is the root folder (/). In the root folder, you will find mount points for the other logical partitions (they could be a folder in the root folder or a sub-folder within a folder too). In the example above, /home is the mount point for a logical partition and becomes the root folder for that particular partition.

Coming back from theory, what we need to remember when installing Linux and when we come to the dreaded "Something Else" option when we are installing Windows is that each partition in a Linux drive needs a mount point. In essence, we need part of the hard drive that is formatted using Windows NTFS file-system and part of the drive handed over to Linux ext4 file-system where each of its partitions have a mount point. A standard dual-boot hard drive will be configured as follows - 

When the time comes to choose partitioning (Step 4 in the installation process outlined in one of our previous posts here), and if you're thinking of being a dare-devil and choosing the "Something Else" option, understanding these concepts will give you an idea of how your hard drive needs to be structured. A sample partition table is as below - 

  • The first partition is the one allocated for Windows with 50GB labelled "Windows". 
  • We then have an extended partition which contains the following logical partitions 
    • A root partition for Linux of about 50GB with / as the mount point. 
    • A swap partition of about 4GB
    • A data partition with "/media/observer/data" as the mount point but partitioned as NTFS which both Windows and Linux can use for storing data.
This is the only tricky portion in installing Linux. The rest is as easy as falling off a log! 

For more detailed information, check Ubuntu's official documentation on partitioning your hard drive. This document provides a clear explanation of what partitions are, how to use them and what to do when installing Ubuntu. I also found a very useful and very easy instructable on doing this, which you can access here. This includes a very detailed and step-by-step process on dual-booting Ubuntu with Windows 7. 

Happy computing!