(Transferred from the wiki by Peter)
Okay - You have decided to install Linux and you want to know how to set up the hard drive. This PET will cover installing Linux stand alone or having Linux share a hard drive(s) with other operating systems. Like trying many new things getting over the fear is 90 % of the battle. But if you take this one bit of advice you can set up your hard drive with out worry of loosing any data: BACK UP YOUR HARD DRIVE FIRST.
In order to do this we need to set up partitions, the tool I like to use for this is fdisk Whats a partiton?? A partition is a section of the hard drive which is indepentdent of other areas of the hard drive.
Why all of this partitioning stuff?? If your are reading this then odds are you have tried automatic partitioning and something went horribly wrong.
Why should I use fdisk?? Because it is a tried and true way of setting up you hard drive and you will be able to see how the hard drive is set up which is very useful in diagnosing problems.
Alrighty! With that out of the way of the way we can manipulate the drives all we want because there is no fear of losing any data. There are quite a few ways to do this and to cover all of them would make this document longer than I would like. Here a few tools which are available
Ranish Partition Manager Web site: http://www.users.intercom.com/~ranish/part/This is free and I have heard good things about this partition manager. This runs under windows and can resize FAT16 and FAT32 partitions. Get version 2.4.0. There is even a simulated version which helps one get familiar with the tool before actually committing any changes. This runs under a DOS shell.
FIPS Web site: http://www.igd.fhg.de/~aschaefe/fips/This is also a free utility for for resizing partitions. Be sure to use version 2.0 for FAT32 support. This has been around for years and is included with many distributions. It is released under GNU public license. Red Hat includes this in the directory dosutils and also runs under a DOS shell.
Partition Magic Web Site: http://www.powerquest.com/ This is a commercial release which Mandrake has included with some of its releases. It has support for quite a few different partition types and is reported to be easy to use. This is listed for $69.95 at the Power Quest Web site and there is a demo available.
Assumptions: You are using Linux on a x86 platform (Intel, AMD, or Cyrix processor) and you are installing Linux on the first hard drive of you computer and this is an IDE hard drive. While this PET should work just fine with SCSI I have much more experience with IDE. The other operating systems I have dual booted with are Microsoft DOS 6.0, Microsoft Windows 95 and Microsoft Windows 98.
You are using Linux with another operating systemThe majority of users probably fall into this category for one reason or another. First lets get familiar with the partitions which are going to be needed. This will include a partition for the other operating system and at least two partitions for Linux, one for a swap partition and the other for everything else. Many people (myself included) have more than one partition to be used by Linux, but in the interest of keeping this PET as clear as possible I will only write about using one partition for data and programs. Here are the partitions which will be needed.
The extended the rest of the drive is where both of the Linux partitions will reside. These can all be created with Linux fdisk. If you have chosen to resize you partions then windows is already installed. We are now ready to use the Linux fdisk command, distributions I have used have all had the option to use fdisk at boot up. RedHat has the a small box in the upper right hand corner which says use fdisk or a check box which says manually partition with fdisk (experts only) for the GUI installer and Debian will ask if you would like to prepare you disk and will use fdisk to do this. Please check out your distributions method of accessing fdisk, although odds are it will be available durring installation. Okay now pop that Linux CD in, boot from it and start fdisk when you get a chance too. First lets see what partitions are there, use linux fdisk to check which partitions are there. This is done with the p command. Here is the output from a typical hard drive:
Partition Type Microsoft Designation
/dev/hda1 vfat/fat32 (type b) C:\
/dev/hda4 Extended (type 5) Extended partition - no drive letter
/dev/hda5 swap (type 82, Linux swap file) none
/dev/hda6 ext2 (type 83, Linux file system) none
fdisk tells us that on this drive has 255 heads, 63 sectors and 2096 cylinders, it is the number of cylinders which are of concern to us. We see that there is one partition and it is for Windows 95 and set up for fat32. It starts at cylinder 1 and ends at cylinder 702, this means we can create out extended partition starting at cylinder 703 and end it at cylinder 2096. This is done with the n command with in fdisk. It will ask which number, what type logical or extended, the start cylinder, and the end cylinder. The number should be four, then choose extended for the type. Now we need to create logical partitions for Linux within the extended partitions. Create these, again we use the n command. fdisk will ask if this is to be a logical or primary partition, choose logical, and then select 5, this will create /dev/hda5 which will be out swap partition. next we select how large it is supposed to be, a pretty safe number is 64M , here you can enter +64M. This is much easier than attempting to determine how many megabytes are per cylinder. Now we need to set this to type swap, hit t and then enter 82, you can hit L to list all of the partition types which are supported by Linux.
Disk /dev/hda: 255 heads, 63 sectors, 2096 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 702 5638783+ b Win95 FAT32
Finally we will create the last partition, /dev/hda6. Again we hit n ,select a logical partition and then the number 6. It asks us the start cylinder and the last cylinder, here the defaults can be selected. It will be the next unused cylinder and the last cylinder. Now lets type p to make sure it looks good. If there is any problem you can delete the problem and recreate it or simply quit fdiskby hitting the q key. [i]Writes to the partition table will *only* happen after the w command is entered while in fdisk. Both commands will exit fdisk. Here is a list of commands which are available in fdisk:
After the partitions are created then install away and just follow the instructions.
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Disclaimer and legal stuff
If anything undesirable happens because of these instructions I am not liable for any damage and neither is the forum. Use at you own risk.