in Articles

Partitioning – one of the hardest steps in a Linux installation

If you happen to use a Microsoft operating system you are most likely to be familiar with finding your partitions using drive letters, such as C: and D:. When you pop in your brand new Ubuntu CD and start the installation, you will notice that there are no C and D drives, but instead lots of letter and number combinations. Do you feel lost? Let’s work it out.

First of all it is important to grasp the idea behind partitions. Standard computers usually only have one partition on the hard-drive which is called C: in Windows. A partition is simply a way of grouping information on your drive into chunks. If you only see one drive in Windows, you probably have a partition which spans the entire disk.

When looking at the drive and partitions in Linux, it will look somewhat different. There is first of all no concept of drive letters, but instead device names and mount points.

A Linux system has a root file-system called / and there other file-systems may be added, such as a /home for user files, similar to Documents and Settings in Windows. The drives are represented in file-form like /dev/hda. This means that this drive is the primary master. Primary slave is hdb, secondary master, hdc and secondary slave hdd. Don’t worry if you didn’t understand that, because drives are most often on the primary master, which is /dev/hda.

On each of these drives, partitions are accessed adding numbers in the end of the drive, where 1 is the first partition of the drive. Examples of this is /dev/hda1, /dev/hda2 and so on.

So what does this mean for me, you might ask? Well, when installing modern distributions such as Ubuntu, the Linux partitions can be created automatically for you by shrinking your big Windows partition, but it might be more interesting to manage this yourself, either for curiosity or just for plain ol’ control.

If you have Windows installed, it will most likely be installed on /dev/hda1, which is the first partition on the first disk. In the Ubuntu installer you can shrink this partition to make way for two Linux partitions. One for the root file-system (/) and one for the swap, which is a virtual memory used when you are out of RAM.

I would say that giving around 10GB for your Linux partition is reasonable, and maybe 500MB for the swap. When creating these partitions your 10GB partition which you will select as root (/) will be /dev/hda2 and the swap, which should be marked as swap will be /dev/hda3.

By now you should hopefully be able to get past the dreaded partitioning screen of the Linux installation procedure.

The following is an example where there is one Windows partition (hda1), one root Linux partition (hda2), one swap (hda3) and a large storage partition (hda4), which can be read both in Linux and Windows using the NTFS-3G driver for Linux.
As you can see, there is not much to partitioning once you get the idea of different chunks and that a drive can have multiple chunks, under which names they are represented etc.

Leave a Reply

  1. Partitionning is the main reason why I choose mandriva.

    They provide a wonderfull tool : DiskDrake.

    As a newbie, I let the installer (and DiskDrake) do the job for me. But later, I have to admit that DiskDrake saved me from several critical situations.


  2. Ubuntu also has an automatic mode, which works fine for simple disk layouts like one single NTFS partition spanning the entire disk. When the layout is more complex however, it sometimes makes weird decisions.

    I have not tried DiskDrake, or Mandriva for that matter, in a long time. Maybe its logic is better when managing more complex disk layouts.

    It is still great that it works for simple layouts, since most novice users will be coming from a Windows environment with a single partition.

  3. I am about to install one of the Linux systems. My computer has ME and 2000 installed and the discs are formatted FAT32. I wanted to know if that will work. I have to get away from Windows and look forward to a Windows free PC. I want to be sure I can work with Linux, then delete ME and 2000.

  4. Ed, you can download the Ubuntu installation CD and boot it. It will start a live-cd environment where you can play around with Ubuntu before installing it, and see whether everything works or not.

    You could also leave your Windows 2000 partition intact and just delete Me. In that case you still have Windows 2000 left if you need it.

    Good luck.

  5. Thanks, I’ll give it a try. Can’t wait to be able to get rid of all the windows clutter on my PC.

    I’m going to see which iteration of Linux works best for me.

    Thanks again.

  6. FYI, the rule of thumb for swap for all Debian-based distros is three times the physical RAM.

    Also, it’s 2006, and there’s very little reason not to use LVM2. In the above example, you would simply add your disk (“physical volume”) to a single “volume group” and then divide that into partitions (“logical volumes”). Try it sometime by selecting “use LVM” in your automatic partitioner.

    The advantage is that you can later add other disks to your volume group(s) and resize your partitions at will. Forget re-partitioning and reinstalling.

  7. Yes, I have to agree with you that LVM2 is a good thing and I might bring it up in a future article, so thanks.

    And yes, it is 2006 now and RAM prices are low. The rule of thumb that the swap should be three times the size of physical RAM is somewhat void. If you have 1GB of RAM, you will never need a 3GB swap. Even with 256MB of RAM, you will rarely need 768MB of swap.

    In my opinion, 512MB of ram is sufficient for most needs. If you have very special needs then sure, more swap might be necessary.