You are installing a new hard drive to provide extra storage space on your Web server. You will need to add only a single partition called /webfiles. You decide to allocate 1.0GB of space to this partition and leave the remainder for future expansion.
However, now that you have a second hard drive, you also want to add a new swap partition to maximize your swap performance. You decide to allocate 128MB to this new swap partition. Type cfdisk /dev/hdb, then press Enter. (You know to use /dev/hdb, because the first hard drive is /dev/hda, so alphabetically hdb is next.)
You are now inside of cfdisk, and you're ready to add your partitions by editing the partition table. Press N on your keyboard to create a new partition.
Press P on your keyboard to create a primary partition. Because this is an IDE drive, you can have only four primary partitions.
You need only two (one for /webfiles and one for swap), so you will add only primary partitions.
Type 1024, which is 1024MB or 1.0GB, then press Enter.
Type B to place the new partition at the beginning of the free space.
Press the down arrow key to move the highlighted selection to the free space entry.
Press N on your keyboard to create a new partition.
Press P on your keyboard to create a primary partition.
Type 128, which is what you decided your swap size would be in megabytes.
Type B to place the new partition at the beginning of the free space.
Now, press T on your keyboard to change the type of the new 128MB partition to swap. Notice the highlighted selection is on the 128MB partition, or hdb2.
cfdisk presents the first half of its filesystem types list. The Linux swap identification number isn't there, but it will be on the next screen. Press the Enter key to continue.
Notice that the Linux swap type identification is 82. cfdisk automatically defaults to this value, so you only need to press Enter to continue.
Press W to write your changes to the partition table.
Type yes to confirm the partition table write.
cfdisk notifies you that it's writing the partition table. Press Q to quit.
Reboot your Linux system by typing shutdown -r now and pressing Enter. When the system reboots, you start another terminal window and continue the hard drive installation process.
Type mke2fs /dev/hdb1 and press Enter to initialize the Linux partition you created earlier.
Type mkswap /dev/hdb2 and press Enter to initialize the Linux swap partition you created earlier.
The next step is to edit the /etc/fstab file and add /dev/hdb1 /webfiles ext2 defaults 0 0 and /dev/hdb2 swap swap defaults 0 0 to the entries. Press Enter to proceed to the next step.
Type mkdir /webfiles and press Enter to make the mount point.
Type mount /dev/hdb1 and press Enter to mount the new partition.
Type swapon -a and press Enter to enable the new swap.
You notice the error message about /dev/hda7 being busy. This is okay, because this is your first swap partition. It is currently active, so you can't make it active again. This completes the Simulation.