Partition a Hard Disk for Linux |
|
This page covers making hard disk partitions and is part of a beginner's guide to Linux.
MS Windows usually just has the hard disk as one big partition. Linux needs at least 2 partitions (for / and for swap) but can have several, depending on the needs of that system.
On a hard disk, you can have up to four primary partitions, or up to 3 primary partitions and some extended partitions.
In Linux, the hard disk is called hda (for the master IDE drive) and hdb for the second drive, if you have one. Further IDE drives (such as a CD drive) and called hdc and hdd. The partitions are referred to as hda1 for the first partition on the master drive, then hda2, hda3, etc.
|
1. Partition Tools
The layout of partitions on a disk is held in the partition table, and this is edited using special software. In MS Windows, you can use fdisk or a commercial product like
Partition Magic. In Linux, there is a command line tool fdisk and most distros come with a GUI utility for working with partitions, such as gparted. The distro installer will usually have a partitioning tool built in. Most installers can resize Windows NTFS and FAT partitions, as well as work with Linux partitions (etx2, etx3, Reiser, etc). But take care with Vista, and use the partition resize tool, as Vista can't boot if Linux has resized it's NTFS partition.
Before you resize your Windows partition, be sure to backup your data, then run defrag and scandisk.
Reduce the size of the Windows partition to leave enough space for the Linux partitions. Don't worry about formatting the Linux partitions, as the Linux installer will do that.
|
2. Basic Partition Setup
To start with, most people want to try Linux while keeping their Windows system operational. A fairly full workstation install takes up about 2GB of disk space. Allowing some room for the /home directoy, a basic size of 4GB is ok, and 5GB is comfortable for your Linux partition.
Dual boot; Win2k and Linux, 40GB hard disk
| Partition |
Size |
Type |
Linux Mount Point |
| . |
| hda1 |
30GB |
NTFS |
/mnt/windows |
| hda5 |
5GB |
ext3 |
/ |
| hda6 |
400MB |
swap |
swap |
|
3. Other Partition Setups
The arrangement of partitions will depend on what you want to do with that PC. Some examples are given below to provide some ideas.
Dual boot; Win2k and Linux, 40GB hard disk
| Partition |
Size |
Type |
Linux Mount Point |
| Windows can't read or write to Linux partitions, and Linux can read but not write
to NTFS. The FAT32 partition provides a common place that both systems can read and write to, so
you can exchange files between them. |
| hda1 |
20GB |
NTFS |
/mnt/windows |
| hda5 |
15GB |
ext3 |
/ |
| hda6 |
400MB |
swap |
swap |
| hda7 |
2GB |
FAT32 |
/mnt/fat32 |
Linux workstation, 60GB hard disk
| Partition |
Size |
Type |
Linux Mount Point |
| The pub partition is made available to other PCs on the LAN, via nfs. This
enables easy access to exchange files around the LAN. The /home directory is on a separate
partition so that users can't fill up the space used for system files. |
| hda1 |
20GB |
ext3 |
/ |
| hda5 |
15GB |
ext3 |
/pub |
| hda6 |
1GB |
swap |
swap |
| hda7 |
20GB |
ext3 |
/home |
There are other options for partitioning. For example, temporary files like print spools and mail spools are kept in /var, so on server systems /var might be mounted on a separate partition to control how much disk space is used up by these processes.
|
|
Back to the starting page
|