Mount 2nd Hard Drive

1. Login to your server and “su -” to root (Do not forget the “-” after su).

2. Verify that the disk is present and there is nothing on it. Make note of the geometry, you will need the size of the disk in megabytes. It may vary slightly depending on drive brand and model.

# parted -s /dev/hdc print
Disk geometry for /dev/ide/host1/bus0/target0/lun0/disc: 0.000-78533.437 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags

3. Initialize the disk and create a partition.

# parted -s /dev/hdc mklabel msdos
# parted -s /dev/hdc mkpart primary ext2 0 78533.437

*** This last number needs to match the size of the drive in megabytes, as reported in Step 2 ***

4. You will need to reboot your server at this point to make sure the partition table is updated properly. If you do not, it is possible that the partition will disappear or be misaligned which will result in data loss.

5. After your server is rebooted, check the partition table and make sure your new partition is there and you do not receive any warnings from parted.

# parted -s /dev/hdc print
Disk geometry for /dev/ide/host1/bus0/target0/lun0/disc: 0.000-78533.437 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031  78528.669  primary

6. Now we can create a filesystem on our new partition.

# mke2fs -j /dev/hdc1

7. Create a mount point and add the new filesystem to the fstab so it is mounted automatically.

# mkdir /mnt/drive2
# echo "/dev/hdc1 /mnt/drive2 ext3 defaults 0 0" >> /etc/fstab

8. Mount your new filesystem and verify that it mounted correctly.

# mount /mnt/drive2
# mount
/dev/hdc1 on /mnt/drive2 type ext3 (rw)       <- make sure you see this line

Leave a Reply