How To Correctly Partition Ubuntu

Following on from my recent article about Linux File System defragmentation, people have asked me how to correctly partition their machines to run Ubuntu. In particular, to do things like dual boot with Windows and other Linux Distributions. So I thought I would write a quick article on how to do it for you guys. In the examples below I will be partitioning a 100GB example Hard Disk Drive (HDD) in three different ways – Ubuntu only, Ubuntu/Windows dual boot & multiple Linux Distributions with Windows.

This is how I would personally partition a HDD in these scenarios. There is no real right and wrong answers, but this is what works for me and partitioning your HDD in this fashion has some advantages which I will come on to later. Ok, let’s get started…

 

Ubuntu Alone

So there are four partitions on this drive, they are as follows:

  • /dev/sda1 - This is the /boot partition. It will contain GRUB and doesn’t need to be any bigger than 100MB. Note: It’s shown as 98MB in the image above because of the file system format. Once it’s formatted you will lose some space. This is the same on all partitions.
  • /dev/sda5 - This is the / (root) partition. It will contain all of your system files such as Operating System files and installed application. I personally make this partition 10GB as this is enough for my needs. If you intend on installing a lot of applications then you may want to consider 15GB. Any more than this would usually be a waste considering that Ubuntu only takes around 4GB when installed.
  • /dev/sda7 - This is the /home partition. It will contain all of your user files and settings. This is for all users and will be the biggest partition on the drive. I usually create this partition last and use all remaining space on the drive.
  • /dev/sda6 - This is the swap area. It is utilised when all of your RAM is full. The general rule of thumb is that if you have 4GB of RAM or more then you don’t need swap. Personally, if I am on a machine that has less than 4GB RAM then I create a swap partition that takes it up to 4GB. So, if the system has 2GB RAM, I create a 2GB swap. If it has 1GB then I create a 3GB swap etc. Some people say that it should be double your RAM, but if you only have 1GB then this may not be enough and if you have 3GB RAM then you may be wasting space.

 

Ubuntu/Windows Dual Boot

When dual booting with Windows, you should always install Windows first. This is because of the Windows MBR (Master Boot Record). It’s basically Windows version of GRUB. If Windows is installed second, it will overwrite GRUB and the MBR will not see your Linux partitions. Once you have installed Windows you can load the Ubuntu installer up, resize your Windows partition (if needed) and create the same partitions as outlined above.

Note: When you load the Ubuntu installer and Windows is installed, you will see 2 partitions already on the drive (only 1 if you use Windows XP). Do not delete either of these as it will stop Windows from working. The big partition can be resized to whatever you want but the 100MB ‘system reserved’ partition (Windows Vista/7 only) has to remain untouched.

 

Multiple Linux Distributions with Windows

The reason we have added a separate /boot and /home is because it gives us more flexibility on the drive. Now, if we want to add more Linux Distributions it can easily be achieved. All you need to do is create another / (root) partition during the install and use the already existing /boot and /home partitions. This will mean that the additional Linux Distribution will be added to GRUB (using the existing /boot partition) and all of your files, users and settings will be available by the use of the existing /home partition.

Note: Make sure that the format button isn’t ticked when selecting the existing partitions. Otherwise all data on these partitions will be erased.

The separate /home partition also helps when doing things like upgrading Ubuntu. Personally, I don’t use the Ubuntu Upgrade tool when changing to a newer version, I install the newer version fresh, but use my existing home partition. This means that I have all my users, files and settings but any of the rubbish that has accumulated whilst I’ve been using that version of Ubuntu (like applications that don’t get used) are all cleaned up. So I then have a fresh install of Ubuntu with all my files & settings ready to go.

I hope this quick guide on partitioning helps, like I said earlier – there is no ‘right way’ of partitioning your drive, but this way works for me and has a lot of flexibility. If you have a different way of doing things, or a question then why not leave a comment.

 

How To Correctly Partition Ubuntu
User Rating: 4.5 (1 votes)