dslreports logo

Using Fdisk to Prepare for a Linux Install

This will just go into the basics of setting up your partitions. If you want in depth info on fdisk man fdisk J Before using FDISK you need to identify which drive it is that you are going to partition. Here is a short listing that should help you out.

hda = first drive attached to ide 1
hdb = second drive attached to ide 1
hdc = first drive attached to ide 2
hdd = first drive attached to ide 2

And if you have a Promise or other PCI IDE controller those are

hde = first drive attached to ide 1 on the card
hdf = second driver attached to ide 1 on the card
hdg = first drive attached to ide 1 on the card.

The same scheme goes for SCSI hard drives. The only difference is that the drives name will start with an S

sda = first hard drive attached to the scsi interface

Now that you know which drive you are going to partition type

fdisk /dev/hda

You will now be in the fdisk interface.

Type p and press enter.

This will print out the current partition scheme. It is a GOOD idea to write this info down. It can help you out later if something screwy happens.

Now these instructions are going to assume that you want to wipe out the entire drive and prepare it for linux.

Type d and press enter.

You will now be asked for the partition number that you want to delete. You should have the number of partitions from the print function we did one step ago. Enter the partition number and press enter. Repeat until there are no longer any partitions

1. Now that the old partition table is gone we need to create a new one.

Type n and press enter.

This tells fdisk that you are going to create a new partition. It will now ask you to select Primary or Extended partition type. The first partition that we are going to create is for the /boot directory so we make it Primary. Next fdisk will ask you for a partition number 1-4. Since this is the first partition press 1 and press enter.

Now Fdisk is going to ask you for the cylinders to use. Just press enter once to accept the default first cylinder. Now it will ask you for the ending cylinder. You do not have to know how many cylinders are in a MB. Just type in the size that you want in MB. Lets say for example that I want the partition to be 25 MB. I would type +25M and that would create a 25 MB partition.

Now since this first partition is going to be for /boot we only need to make it 25 MB max. Some people will tell you to make it bigger. It all depends on your tastes. I personally keep mine at 25 MB.

2. Now we need to create a swap partition. Again this is a personal preference. I usually just use 2x ram up to 512 MB.

Next step is to type n and press enter. Select the partition type and number. Primary and partition number 2. Fdisk again is going to ask you for the cylinders to use. Just press enter once to accept the default first cylinder. At the second prompt enter the size in megabytes. +512M

3. If you are going to be creating a workstation all you really need is one more partition. Have this partition just take up the rest of the hard drive. Next step is to type n and press enter. Select the partition type and number. Primary and partition number 3. Fdisk again is going to ask you for the cylinders to use. Just press enter once to accept the default first cylinder. At the second prompt just press enter if you want to use the rest of the free space on the drive.

4.Now we need to set which partition is Active. The active partition will always be /boot. In our previous steps we set hda to be the /boot partition. So

type a and press enter

Fdisk will now ask you which partition you want to make active. Enter 1 to select partition number 1.

5.Now we need to change the partition type of the swap partition.

Press t and press enter. This will ask you which partition you want to change. Press 2. It will now ask you for the partition type. Type in 82 and press enter. This changes the partition type to swap.

6.Type p again to see the new partition table. You should see an a next to partition number one and partition number 2 should say linux swap.

7.If you are happy with the partition scheme press w. W tells fdisk to write the new partition table and exit fdisk. If you are not happy with the scheme and want to start over type q and press enter. Q tell fdisk to exit and not save any changes.

Next step after fdisking is to format these newly created partitions. That is for another FAQ :)


Expand got feedback?

by elboricua See Profile edited by hacheelle See Profile
last modified: 2002-08-15 06:11:10