Partitioning A Disk

If you want to install Linux on a hard drive that is occupied by another operating system such as Windows, or perhaps you prefer to set up your hard drive manually then you should follow this rough guide.

The procedure is a little different for most people, because no two hard drives are set up the same.

If you are using this guide to set up Linux and Windows on the same drive, then it is assumed that you have already resized Windows on the drive to allow space for Linux by the use of QTParted or similar tools. See Chapter 4 for more information.

All of the images here can be clicked to see further detail. The partitioning here was done with the Ubuntu 5.10 text mode installer so may look a little different to your software, however the principals are the same. Please leave a comment below if you wish to see some changes to the page, or have it updated to reflect a specific installer.

Select free space

This particular drive does not have any other partitions on it, however if you had Windows on your drive, it would show it here. If you are installing Linux alongside Windows, make sure you select the partition on the hard drive that you have cleared out as ‘Free space’, rather than your Windows partition.

Create a new partition for Linux

Linux needs to allocate the ‘Free space’ you selected in the previous screen so select the default option here, Create a new partition.

 

Setting up the first partition (/boot)

In this example, we are going to create four hard disk partitions to put Linux into. You can do it with less, but the way we will set up the partitions allow you to have one partition for booting, documents and settings, system programs and swap space, as follows:/boot (booting the system)
/home (for your own documents and settings)
/ (all the system data and programs)
swap (which helps out your memory).

This partition we are setting up is for booting Linux, and it contains very little data, so type 250 M in the text box, to allocate 250 Mega bytes to /boot.

 

Primary, or Logical?

If you are completely new to setting up disks, then you will need to know that for mainly historic reasons, hard drives can be split into Primary and Logical Partitions.
Two things to note about Primary partitions:

  • Primary partitions should be used to boot your O/S.
  • There is a limit of four primary partitions to any drive

 

Due to these restrictions, we will use Logical partitioning for our last partition, and Primary for our first three, if you have another O/S such as Windows installed, you should take this into account also. The only partition that must be Primary is the one that contains /boot.

 

If you have a windows partition as the first partition on your drive, perhaps this is the ideal setup for a first time Linux user, who still wants Windows to fall back to:

 

Partition Number Partition Type Logical or Primary? Partition Use (name) % Taken up of Disk
1 Windows Primary C: 50%
2 Linux EXT3 Primary /boot 1% (or approximately 200MB)
3 Linux EXT3 Logical / 20%
4 Linux EXT3 Logical /home 25%
5 Linux SWAP Logical Not Applicable 4% (or, typically double the size of your RAM)
Beginning or End?All of the partitions we are setting up in this exercise will be contiguous. Each partition will come one after another, from the beginning of the drive, to the end of it. As this is the case, all of our partitions will start from the Beginning of the freespace.
Summarising so far…So far, we have created a new 250MB partition on our free space. This screen summarises just this, however it shows a few things that are not to our liking – the mount point is set for ‘/’, and we want to use ‘/boot’, therefore, use the cursor keys to select ‘Mount point’ and hit return to change it.
Mount Point NameAs we wish to delegate this 250MB partition to /boot, select /boot from the menu with the cursor keys and hit return.
A last check…If everything looks good now, then select ‘Done setting up the partition’ and hit return. Note that the size of our 250MB partition is slightly smaller than 250MB (246.7MB to be precise), this is due to drive information occupying the remaining 3.3MB space.
Back at the main partition menu…Once the partition is set up, we are returned to the main partition menu, where we can see that our newly made partition has been added to the list. If you are happy with this arrangement, proceed on to allocate the remaining free space by selecting ‘FREE SPACE’ with the cursor keys and pressing return.
Choose the sizeThe partition that we will be setting up now is called the / (or, root) partition. This is the main partition of any Linux system, as all system data will be held under here, such as your program files and system settings. If you have a large hard drive and lots of space to spare, give this a good amount of space, but be sure to leave space for your home and swap partitions.
Just like before, the partition is at the beginning of the free space…Select ‘Beginning’, and hit return.
Summary of the root partitionIf you are happy with your size allocation for /, then Select ‘Done’.
Selecting Free Space for /homeIn our example, we have a seperate partition for home, this is where we will define how much space to provide your own files (documents, music etc), and your preference files.Select ‘FREE SPACE’ and press return.
Select the size for /homeOnce again, give your own data area as much space as you can, whilst leaving space for the smaller swap partition.
Primary or Logical?In our example, this will be our third partition, so we will make it a logical partition.
Just like before, the partition is at the beginning of the free space…Select ‘Beginning’, and hit return.
Happy at home?If you are ok with the settings for /home, then confirm by selecting ‘Done setting up this partition’.

 

Time to swap..Before we go on to set up swap, you can see that the numbering of the partitions on this drive are as follows:
1 – Primary (/boot)
2 – Primary (/)
5 – Logical (/home)

Why does it go from 2 to 5? Has Linux lost the ability to count? The answer is no! As the Primary partitions can occupy up to four partitions, the PC reserves these first four for the Primary allocation.Ok, Where were we?…
If you are happy with your /home partition, select the remaining free space and hit return.

 

Create another new partitionIf you don’t intend on using the drive for anything else, you can use up the rest of the drive for the swap, but a good guideline for the size of your swap partition should be around twice the size of your system RAM (memory), so if you have 512MB RAM, then your swap space would be 1024MB (1GB).
Logical, again..How did you guess?! Another logical partition.
/usr – but I want swap!The Ubuntu installer tries to be clever again, allocating /usr to this partition type, however, /usr will actually appear under /, so we don’t want a seperate partition for it.The steps for changing /usr into swap are different from the time before, so watch closely as we change the partition type from ext3 to swap.

Select the ‘Use as’ line and press return.

What type?As it’s a swap partition we want, change the partition type to ‘swap area’ and hit return.
Anything else?Next you will be asked if there are any amendments for this partition, and as the swap partition type is pretty simple, there is nothing to do. Select ‘Done setting up the partition’ and press return.
A good job done well!We’ve filled this hard drive up with Linux partitions and it’s now time to commit these changes to the disk.If you are happy with all of your changes, select ‘Finish’ and press return.
Warning!Anything you have done before this point is fully reversable, but once you Finish the partitioning here, there is no going back!Select Yes, and your partitions will be formatted and readied for Linux.

Note: only new partitions you have set up will be formatted, partitions which you have left will not be touched.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.