Administering Filesystems  «Prev  Next»

Lesson 6 Adding new drives
Objective Add a new hard drive.

Adding new hard drives in Redhat Linux

Eventually, you will need to expand your system's storage capacity. Your users will demand more space for their files or the latest applications will require more space than you've allocated. One way to satisfy this demand is to install additional hard drives. (You could purchase an entirely new machine, but that might be overkill as well as outside your budget.)

Hard Drive Installation

There are several steps involved in installing a new hard drive into your Linux machine. The following table outlines the installment steps::
1. Physically install your hard drive. You will need to turn off your Linux system to do this, so you should notify your users of the expected down time.
2. Prepare the drive according to the manufacturer's guidelines. For a SCSI drive, this might involve low-level formatting of the drive from the SCSI controller's BIOS.
3. Create the hard drive's partition table using the fdisk or cfdisk programs. As you create partitions, you will add both Linux ext2 and swap partitions.
4. Initialize the new ext2 partitions with the mke2fs command. This command places filesystem information onto the partition so that you can store data there. The syntax of this command is mke2fs <partition>; for example, mke2fs /dev/hdb1.
5. Initialize the new swap partitions with the mkswap command. This command prepares the swap space for Linux's use. The syntax of this command is mkswap <partition>; for example, mkswap /dev/hdb2.
6. Edit /etc/fstab, adding new entries for the partitions. For example, to add an automounting floppy drive you would add the line /dev/fd0 /mnt/floppy ext2 noauto,owner 0 0 to the /etc/fstab file.
7. Make the directories for each of the mount points you specified in /etc/fstab. To make a directory, use the command mkdir <directory name>.
8. To gain immediate access to your new filesystems, mount them with the mount command. The syntax of this command is mount <partition>; for example, mount /dev/hdb1.
9. Enable the new swap partitions using swapon -a. The option -a enables all swap found in the /etc/fstab file.

The commands fdisk, cfdisk, and mke2fs are destructive. fdisk and cfdisk update the disk's partition table. If you mistakenly type the wrong device name, you will lose access to all existing data on modified partitions! mke2fs places a new, formatted filesystem onto the partition. If you mistakenly type the wrong partition name, then you will overwrite all existing data!
The Simulation below walks you through adding a 3.2GB IDE hard drive to an existing Linux system.
Add IDE Drive
The next lesson concludes this module.

Install Hard drive


Before moving on to the next lesson, click the Exercise link below to check your knowledge of installing a new hard drive.
Install Hard drive