DistributedNetworks DistributedNetworks


Administering Filesystems  «Prev 

Adding new IDE Drive

  1. 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.)
  2. 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.
  3. 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.
  4. Type 1024, which is 1024MB or 1.0GB, then press Enter.
  5. Type B to place the new partition at the beginning of the free space.
  6. Press the down arrow key to move the highlighted selection to the free space entry.
  7. Press N on your keyboard to create a new partition.
  8. Press P on your keyboard to create a primary partition.
  9. Type 128, which is what you decided your swap size would be in megabytes.
  10. Type B to place the new partition at the beginning of the free space.
  11. 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.
  12. 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.
  13. Notice that the Linux swap type identification is 82. cfdisk automatically defaults to this value, so you only need to press Enter to continue.
  14. Press W to write your changes to the partition table.
  15. Type yes to confirm the partition table write.
  16. cfdisk notifies you that it's writing the partition table. Press Q to quit.
  17. 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.
  18. Type mke2fs /dev/hdb1 and press Enter to initialize the Linux partition you created earlier.
  19. Type mkswap /dev/hdb2 and press Enter to initialize the Linux swap partition you created earlier.
  20. 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.
  21. Type mkdir /webfiles and press Enter to make the mount point.
  22. Type mount /dev/hdb1 and press Enter to mount the new partition.
  23. Type swapon -a and press Enter to enable the new swap.
  24. 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.