Home Map Index Search News Archives Links About LF
[Top bar]
[Bottom bar]
This article is available in: English  Castellano  Deutsch  Francais  Italiano  Nederlands  Turkce  
convert to palmConvert to GutenPalm
or to PalmDoc

[Photo of the Author]
by

About the author:

Thomas Mangin is a Linux power-user since 1993.
He enjoys his permanently crashing Gnome Desktop which reminds him the Microsoft World. (Only joking folks dont fire me)
You can learn more about him and his hobbies on his weeb site located on http://thomas.mangin.free.fr


Content:

How to partition your hard drive for Linux

[Illustration]

Abstract:

Disk partitioning is still a pain for new Linux users as it is not "magically" done. It is also very much a matter of opinion. If you ask different people how to best partition the disk then you will get different answers. This article presents one approach.

It is up to you to decide how much space you want to remove from your Windows partition to create your new Linux partition.

This paper is oriented toward Desktop users and presents my own installation. it is a practical approach for partitionning your hard drive if you :

  1. Are not sure of keeping Linux (How can this be !)
  2. Don't know the real space you will need for it (Common at a first installation)
  3. Want to backup your user data easily (You *MUST* do it)
  4. Change/Update your distibution easily
  5. Want to be able to recover an erased file on /home safely

I hope this document will help. But be aware that a lot of space can be "lost for use" if a bad partitioning is performed.



 

So let's start

for a practical presentation, here is my fdisk report :

Device Boot Start End Blocks Id System
/dev/hda1 * 1 626 5028313+ b Win95 FAT32
/dev/hda2 627 926 2409750 83 Linux
/dev/hda3 927 942 128520 82 Linux swap
/dev/hda4 943 1024 658665 83 Linux

Ok, shame on me I have four gigabytes for Windows 98, but I really like Baldur's Gate that needs 600 Meg. And all my shared data are on this drive (pictures, Videos, Music, ...).

As you see I haven't created any secondary partition (also called extended partition).
This is done to allow an easy resizing of the created partition but as a drawback this limits the number of partition you can use too.

The limit to the number of primary partitions is unfortunately quite low. You can have only 4 primary partitions. To circumvent this limit the extended partition (secondary partition) was invented and you can think of it as a a big partition which contains other partitions. Early in the history of the PC design theses limits were created and Linux still obeys them to make it possible that other common operating systems can co-exist on the same drive.

So, if you want more than 4 partitions you need an extended one to contain all the other partitions. If are like me and you are happy with a maximum of 4 then you do not need to look into extended partitions.

 

Deeper inside

The partition order is:

  1. The Windows partition (5 GB)
  2. The Linux root partion (2,5 GB)
  3. The Swap partition (120 MB)
  4. The /home partition (640 MB)

As you see, the idea is to create a 640 MB partition at the end of the disk for your user data (/home), so you can easily remove the whole system and keep the important files. I chose 640 MB as it is a good size to backup on a CD, it can be much less if you only want to save "AbiWord" files here ...

As root you can make your /root directory a link toward /home/root to be able to save its content too. I strongly advise you to create a /home/backup directory too in which you will copy all the system file you may have to modify "by hand" (your fstab, automount files, etc) to be able to restore them after an "uninstall".

For the swap, I will advise a minimum of 92Mb Total (RAM and Swap) for a Linux Desktop use and at least 128Mb for picture manipulation and 3D. It is located between the two partitions for performace issues on Big Foot Hard Drive.
Note also that you can have several swap partititions but for Kernel revisions less then 2.2.x each of them may not be bigger than 120Mb.
Install a swap partition, even if you have more than 128 MB of real memory (RAM), both for system safety and performance purpose.

As a general rule, 1GB must be reserved for your Linux system for normal use. This is a safe value, even if you install a lot of packages. You can downsize it to 500 MB if you are planning a small install. Or increase it if you really want to.

Dont be afraid about having to mount the /home as if you setup the system like during your installation the partition will be automaticaly mounted when running Linux.

 

Undelete

Another nice point with this way of processing is that you can recover erased file on /home much easily. (It happend to me !!)

A way of doing it is :

  1. umounting /home (optional, but recomended)
  2. Read the linux undelete HOWTO
  3. Install the needed softwares as this is safe
  4. Apply the howto
If your root partition is big enough (2GB), you can also copy the partition using dd like this : dd if=/dev/hda? of=/tmp/partition to edit it and search for key words.

 

Last words

Some persons may experience problems with very big Hard Drive to boot Linux directly (or old BIOS). I had no problems with lilo (Redhat 6.0, Debian 2.1) to boot my Linux partition directly from the master boot sector.

If this happens a solution is to boot Linux from Windows. The best idea is to install a "DOS config.sys menu" and add a "linux loader" entry in it. I don't know if a Linux FAQ exists about it but this is out of context for this document

 

RedHat Distribution comment

RedHat install gives you the choice to use traditional partitioning with fdisk or via a graphical user interface called disk druid. I was told that the disk druid of RedHat install (6.1) erases your Windows partition without a real warning. So carefully READ their documentation before proceding ...

RedHat's disk druid automatically creates a secondary partition to contain "Linux native" partition to allow for more than 4 partitions in total.

 

Talkback form for this article

Every article has its own talkback page. On this page you can submit a comment or look at comments from other readers:
 talkback page 

Webpages maintained by the LinuxFocus Editor team
© Thomas Mangin, FDL
LinuxFocus.org

Click here to report a fault or send a comment to LinuxFocus

2001-01-27, generated by lfparser version 2.8