Disk: Partitions and File Systems

Disk: Partitions and File Systems

linux-logo debian-logo

Creating partitions and file systems on a Linux system

In order to create partitions on a new PC with blank disks, we recommend to first boot with a Knoppix CD.

Partitions can easily be created using the program 'fdisk'. Assuming your primary disk is /dev/hda (on systems with serial ATA [S-ATA] disk, this may be /dev/hde), enter the command: fstab /dev/hda

For each new partition, you have to enter 'n' and to enter the start and end cylinder. You may also - instead of giving the 'end cylinder' - enter the size of your partition. Should you want the new partition having a size of 5.5 Gigabytes, enter +5500M on the prompt for the last cylinder.

Important note: You may have only 4 so-called primary partitions; should you wish to have more than four partitions, you must define a so-called 'extended partition'. Here it is important to know, that you have to specify the complete rest of the disk as extended partition; so use the default values given for the first an last cylinder of an extended partition!

The following (extended) partitions may then also be created using the command 'n' (for a new partition) and the procedure is just like mentioned above.

After having created the partitions, it is necessary to define the type of the partitions you have created. You may have a look at what you did so far using the command 'p' (print the partition table). The 'Id' of the partitions created will usually already have the hex-code '83', standing for a linux partition (see the command 'l' within fdisk, displaying all the codes for partition types).
One of the partitions should be a 'swap- partition' and it needs to be defined that way. So, say, your second partition should be reserved for the swap area, enter 't' to change the partions id and the enter '2' for the second partition and then enter '82' (without quotes), the hex code for Linux swap partitions.

Once you are satisfied with you partition layout (enter 'p' to view it), you have to enter 'w' in order to write the partition table to disk and to exit.

Now, that we have created all the partitions needed, we also need to install files systems on these partitions.
For the swap partion we simply enter: mkswap /dev/hda2 should the swap partition be on the second partition.
For the Linux partitions we recommend to create the journaled file system 'ext3'. So, if this file system should be installed on the first partition of your first disk, enter the following: mkfs.ext3 /dev/hda1
Do the same for all the other partitions, where you want to install a Linux partition.

Now you have prepared the disk with partiotions and file systems and you may now install a Debian or any other Linux distribution on the appropriate partitions, e.b. using rsync.

A useful webpage about partitioning your disk can be found on http://community.linux.com/howtos/Partition/partition-5.shtml.

Last Update: 18Jul2004 uk   -   Created: 18Jul2004

Go to our Linux homepage