In this article, I would like to cover a basic HOWTO installing a second hard drive to expland your storage needs.
It's been about a year since I purchased my new Linux System and I feel my 80Gb internal hard drive is running out of space already. So I've decided to purchase a new 160Gb internal hard drive and install it as a second hard drive. But how do I format and mount the second hard drive in existing Fedora Core system? Let's look at the process step by stop.
First, install the NEW hard drive as a slave drive. You might need to remove a jumper from the drvie to make it a slave drive. Also make sure to plug BLACK color connector to your OLD drive which indicates it's a master drive and plug GRAY color connector to your NEW hard drive which indicates it's a slave drive. See the Installation Guide comes with the hard drive for more information.
Don't forget to plugin in 4-pin power connector on both hard drives and power on the computer.
Check the BIOS to make sure your computer detects both drives.
Now, before you format the NEW hard drive, you need to partition it as a Linux file system. Let's use fdisk utility to partition the NEW hard drive.
[root@localhost root]# fdisk /dev/hdb The number of cylinders for this disk is set to 19457. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help):Type m to see the menu first.
Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help):Type p to print the current partition table.
Command (m for help): p Disk /dev/hdb: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help):Notice it has an empty partition table since it's a brand NEW hard drive.
Type n to add new partition and p to choose primary partition
Command (m for help): n Command action e extended p primary partition (1-4) pType 1 for first partition and press enter for first cylinder and enter again for last cylinder to accept the default.
Partition number (1-4): 1 First cylinder (1-19457, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457): Using default value 19457 Command (m for help):Type p again to print current partition table.
Command (m for help): p Disk /dev/hdb: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hdb1 1 19457 156288321 83 Linux Command (m for help):Notice, now we have Linux file system created in the partition table.
To save this new partition table, type w.
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@localhost root]#Notice, you have also exited from fdisk utility.
Now that you have created Linux partition, it's time to format the partition on the hard drive.
Let's use mkfs.ext3 utility to format the partition as EXT3 file system which is EXT2 file system with journaling capabilities.
Also let's label the partition as /home2
[root@localhost root]# mkfs.ext3 -L /home2 /dev/hdb1 mke2fs 1.34 (25-Jul-2003) Filesystem label=/home2 OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 19546112 inodes, 39072080 blocks 1953604 blocks (5.00%) reserved for the super user First data block=0 1193 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@localhost root]#In order to mount new partition labeled /home2 automatically during the reboot, type following line in red in the /etc/fstab file
[root@localhost root]# vi /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 LABEL=/home2 /home2 ext3 defaults 1 2 none /dev/pts devpts gid=5,mode=620 0 0 none /proc proc defaults 0 0 none /dev/shm tmpfs defaults 0 0 /dev/hda6 swap swap defaults 0 0 /dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0 /dev/cdrom1 /mnt/cdrom1 udf,iso9660 noauto,owner,kudzu,ro 0 0 /dev/dvd /mnt/dvd udf,iso9660 noauto,owner,kudzu,ro 0 0 /dev/dvd1 /mnt/dvd1 udf,iso9660 noauto,owner,kudzu,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0 /dev/sda1 /mnt/sda auto noauto,owner,users 0 0 /dev/sdb1 /mnt/sdb auto noauto,owner,users 0 0 /dev/sdc1 /mnt/sdc auto noauto,owner,users 0 0BTW, 1 in the fifth field is used to determine if this filesystem will be backed up by the dump command and 2 in the sixth field is used to determine if this filesystem will be checked by the fsck program at the reboot time. Normally 1 is used for root filesystem (/) and 2 is used for non-root file system (/home2).
It's almost done but before you reboot the system. Make sure to create a directory "/home2" as a mount point.
[root@localhost root]# mkdir /home2 [root@localhost root]#Now, it's done! Reboot the system and see if the partition on the NEW hard drive has been mounted.
[root@localhost root]# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda5 70G 57G 9.7G 86% / /dev/hda3 99M 55M 40M 59% /boot /dev/hdb1 147G 33M 140G 1% /home2 none 252M 0 252M 0% /dev/shm [root@localhost root]#Congratulation, you've added the second hard drive in your Fedora Core system successfully!
[root@localhost root]# cd /home2 [root@localhost root]# mkdir tchung [root@localhost root]# chown -R tchung.tchung tchung