How Do I Partition My Drive For Linux Use? - page 3
Primary, Extended and LogicalYou are allowed up to four primary partitions, and one of these may be replaced by an 'extended' partition. Extended partitions can contain as many logical partitions as you like. In the simplest case for a machine that dual boots Linux and MS Windows you will need three primary partitions: the MS Windows partition, which must be first, a Linux root partition and a swap partition.
Suggested Disk Layout For LinuxOnce you have partitioned some free space, you are ready to boot from a Linux installation disk. Among the first things that Linux installation does is drop you into a disk partitioning program like the Redhat 'disk druid' program or the screen-oriented cfdisk program. I have found that the most reliable disk partitioning system under Linux is the fdisk command line-driven program. Whatever system you choose, you should make a root partition and a swap partition. The root partition under Linux must be of type 'ext2' This is the native Linux disk type. It is a fast type of filesystem and efficient for storage. People often ask me what the best size is for the root partition. The short answer is between 500 MB and 1 GB. A long answer is that it depends what you plan to install. A very basic setup, with limited tools available, but perfectly usable, could fit in 70 MB. This would not leave enough spare room for the Linux graphical user interfaces that run under the (large) X Windows system, however. The baseline for X Windows and a few tools is about 170 MB. These days disks are large, and if you want to experiment with Linux to see just what is available, the best method is to assign about a thousand MB and install a big set of applications off the CD or Internet. However, bear in mind the wise words of Dennis Ritchie, one of the authors of C: "The steady state of disks is full". It doesn't matter how much disk space you have, it will always end up crammed!
SwapSwap is an area of disk that Linux uses for 'swapping out' pages of unused RAM. This may seem odd, but the organization of swap is such that it is often more efficient to keep lots of programs loaded and let them swap out automatically. Around 64 MB is a good size to assign to swap space on a modern machine with 32-64 MB of memory. If you have a lot of memory and are planning to use a memory hungry program like the GIMP then you might want to assign more. The maximum size a single swap partition can be is 128 MB, but you can have as many as you like. One machine I am currently setting up as a high performance Web server has four 128 MB swap partitions. If you really cannot spare another partition for swap, then you can run without it, and even have swap as a temporary file. See the mkswap man (manual) page on Linux once you are up and running.
Using fdiskTo use fdisk you simply make new partitions. With the command line version: press n and then give a partition number. Then give a type (primary or extended). Finally assign a size in 'cylinders' or MB. Cylinders are a low level measure of disk capacity. For efficiency reasons it is best to give your sizes in cylinders. This gives the underlying drivers a performance gain as the size of the partitions matches the physical characteristics of the disk. You can make a partition to approximately the right size by looking at how big a cylinder is in MB and multiplying it up. For instance the disk on the machine I am typing on now says:
Disk /dev/sda: 255 heads, 63 sectors, 275 cylinders
So each cylinder contains about 7.8 MB. To make a new partition of 500 MB that works out at roughly 63 cylinders. The easiest way to get a partition about right is to make it then press p to see what the actual size is. If you are wildly wrong then delete it with the d command and try again. Soon you will have made a root partition and a swap partition of a suitable size. To commit the changes to the disk 'for real' use the w command. If you totally screw up then exit the program and try again. It does not save unless you explicitly tell it to. If you have space left over, my recommendation would be to make a large 'extended' partition to hold the space for later use.