Home page
Articles for Windows, Linux, OS X
Mac tips and articles
Mac tips
Windows 8 tips and articles
Windows 7 tips and articles
Vista Tips
XP Tips
Linux tips and articles
Read the blog
Online store
Windows, Linux, OS X programs

Partition the disk for Linux

A hard disk drive can be hundreds or even thousands of gigabytes. You might think that when files are stored on it they are placed at the start and slowly fill it up, a bit like pouring water into a glass. This doesn't happen. The disk space is divided into sections called partitions and when Linux is installed it puts some files on one partition, some on another, one is used as temporary workspace and so on.

Some Linux distros automatically create disk partitions when they are installed and they just work. It's nice when this happens, but others require you to manually create and format partitions yourself before the OS can be installed. If you must create them yourself, what partitions are required, what size should they be, and how do you actually do it?

To show you what sort of situation you might come across and what the solution is, I'm going to use Chakra. Linux distros are under constant development, so the version I downloaded a couple of weeks ago might have been updated by the time you read this. It doesn't matter because it's still a good lesson in disk preparation for Linux.

Install Chakra Linux and you'll get to a point where it asks you which disk drive it should unstall to. You won't be able to proceed until you select a disk and partition it. Clicking the Advanced button in Chakra (it may be named differently in other Linux installers), starts KDE Partition Manager.

Select the disk in the Devices list and click Device, New Partition Table.

KDE Partition Manager

There are two options and you can choose either MS-Dos or GPT. These are different methods of creating partitions and each has pros and cons. GPT isn't common and isn't compatible with Windows, but if Chakra is the only OS on the disk then it has advantages. A GPT disk allows you to create as many primary partitions as you want, whereas the MS-Dos option only allows four. (The fourth can be divided into any number of logical partitions though, but that's another story. Let's focus on Chakra.)

KDE Partition Manager

You'll see the disk on the right and the unformatted unallocated free space. Select it and click the New button to create a new partition. Chakra needs an 8Mb unformatted partition right at the start of the disk for Grub. Grub has two functions and one is to start the OS and the other is to choose which OS to start when there are several on the disk, as in a dual-boot system. Click Apply afterwards.

KDE Partition Manager

There are many options when partitioning a disk for Linux, but we'll choose the simplest. This uses one partition to store the OS and software and another partition to store your own files - the home folder. There's one more and that's the swap partition, which is workspace the OS needs when running.

Select the free unformatted unallocated space on the disk and click New to create a new partition. It needs to be big enough for Linux and any software you might install. Around 10Gb (10000Mb) should be sufficient, but feel free to make it a bit larger. The file system should be set to ext3 or ext4, which are the two most common types for Linux. Click Apply afterwards.

KDE Partition Manager

Select the remaining free space on the disk and create another partition. This will be the swap partition and the file system must be set as linuxswap. It needs to be 2x the amount of memory in the computer, so if you have 1Gb of RAM then make the partition 2Gb (2000Mb). Click Apply afterwards.

KDE Partition Manager

The last partition is for your home folder. This will contain all your documents, music, videos, photos and so on. You might need a lot of disk space to store these, so whatever free space is left on the disk, use that for the last partition. Set the file system to ext3 or ext4. Click Apply afterwards.

Now that the partitions are made, the first 8Mb partition for Grub needs to have the bios_grub flag set. Right click the partition and select Properties. Tick the bios_grub flag. Click Apply afterwards.

KDE Partition Manager

After creating the partitions required you can quit KDE Partition Manager and back in Chakra installer you then set what each partition is to be used for from a drop-down list. I set:

Partition 1 - 8Mb unformatted - bios_grub flag set
Partition 2 - 1.5Gb formatted linuxswap - swap partition (2x RAM)
Partition 3 - 10Gb formatted ext3 - Linux and software
Partition 4 - Rest of disk space formatted ext3 - home folder

KDE Partition Manager

It is possible to create separate partitions for the /usr, /var, /tmp, /opt, /etc folders that Linux creates, but I've just created / which stores everything on one partition. It's simpler. You don't need to use the exact same partitioning scheme as this, but hopefully you now have enough information to try manually partition a Linux disk yourself.

Partitioning problems
Partitioning tools do not perform the selected action straight away. Instead they add the action to a queue. This enables you to do something, change your mind, undo it, experiment and get things just right. Then when your are happy you click Apply and the actions are carried out in the order they are listed.

Installing Chakra Linux requires the first partition to be 8Mb unformatted, but this generated an error and no more actions were applied. I had to create this first partition and apply it before adding the other actions.

I also had a problem setting the bios_grub flag and no matter how I tried in Chakra's KDE Partition Manager, the flag just wouldn't set. Perhaps there was a bug. I ended up quitting the Chakra installer, booting up GParted Live, a mini Linux distro that runs the GParted disk partitioner, and setting the bios_grub flag in there. I then quit GParted, re-ran Chakra and continued the installation. Hopefully this bug has been fixed in the latest Chakra release, or maybe it was just my PC.

Please note that I've used a GPT partition scheme and I'm not dual booting Windows. The above instructions will wipe the disk, including Windows! Only use it in VirtualBox or a PC that you want to wipe and install Linux. There's still a lot more to partitioning than I've covered here, but that's another article.