After booting from your preferred media, you will need to partition your hard disk. The disk partition is where the Linux filesystem will be created and is where Slackware will be installed. At the very minimum we recommend creating two partitions; one for your root filesystem (/) and one for swap space.
After the root disk finishes loading, it will present you with a login prompt. Log in as root (there is no password). At the shell prompt, run either cfdisk(8) or fdisk(8). The cfdisk program provides a more user-friendly interface than the regular fdisk program, but does lack some features. We will briefly explain the fdisk program below.
Begin by running fdisk for your hard disk. In Linux, the hard disks do not have drive letters, but are represented by a file. The first IDE hard disk (primary master) is /dev/hda, the primary slave is /dev/hdb, and so on. SCSI disks follow the same type system, but are in the form of /dev/sdX. You will need to start fdisk and pass it your hard disk:
# fdisk /dev/hda |
Like all good Unix programs, fdisk gives you a prompt (thought you were getting a menu, right?). The first thing you should do is examine your current partitions. We do that by typing p at the fdisk prompt:
Command (m for help): p |
This will display all sorts of information about your current partitions. Most people pick a free drive to install to and then remove any existing partitions on it to create room for the Linux partitions.
IT IS VERY IMPORTANT THAT YOU BACK UP ANY INFORMATION YOU WANT TO SAVE BEFORE DESTROYING THE PARTITION IT LIVES ON. |
There is no easy way to recover from deleting a partition, so always back up before playing with them.
Looking at the table of partition information you should see a partition number, the size of the partition, and its type. There's more information, but don't worry about that for now. We are going to delete all of the partitions on this drive to create the Linux ones. We run the d command to delete those:
Command (m for help): d Partition number (1-4): 1 |
This process should be continued for each of the partitions. After deleting the partitions we are ready to create the Linux ones. We have decided to create one partition for our root filesystem and one for swap. It is worth noting that Unix partitioning schemes are the subject of many flame wars, and that most users will tell you the best way to do it. At a minimum, you should create one partition for / and one for swap. Over time, you'll develop a method that works well for you.
I use two basic partition schemes. The first is for a desktop. I make 4 partitions, /, /home, /usr/local, and swap. This lets me re-install or upgrade the entire installation under / without wiping out my data files under /home or my custom compiled applications under /usr/local. For servers, I often replace the /usr/local partition with a /var partition. Many different servers store information on that partition and having it kept separate from / has certain performance benefits. For now, we're sticking with just two partitions: / and swap.
Now we create the partitions with the n command:
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4):1 First cylinder (0-1060, default 0):0 Last cylinder or +size or +sizeM or +sizeK (0-1060, default 1060):+64M |
You need to make sure you create primary partitions. The first partition is going to be our swap partition. We tell fdisk to make partition number 1 a primary partition. We start it at cylinder 0 and for the ending cylinder we type +64M. This will give us a 64 megabyte partition for swap. (The size of the swap partition you need actually depends on the amount of RAM you have. It is conventional wisdom that a swap space double the size of your RAM should be created.) Then we define primary partition number 2 starting at the first available cylinder and going all the way to the end of the drive.
Command (m for help):n Command action e extended p primary partition (1-4) p Partition number (1-4):2 First cylinder (124-1060, default 124):124 Last cylinder or +size or +sizeM or +sizeK (124-1060, default 1060):1060 |
We are almost done. We need to change the type of the first partition to type 82 (Linux swap). Type t to change the type, select the first partition, and type 82. Before writing your changes to the disk, you should look at the new partition table one last time. Use the p in fdisk to display the partition table. If everything looks good, type w to write your changes to the disk and quit fdisk.