I recently had to install new 2TB hard drive for my desktop which runs on Red Hat Enterprise Edition (version:2.6.18-238.1.1.el5PAE). I was able to successfully install the hard drive, create a single partition of type ext3. I used parted and mkfs.ext3
First install the hard drive physically. Boot the computer and open a terminal. Check to see the hard drive in the /dev directory. If you installed a sata drive do the following,
for ata drive,
The standard format is that sda/hda is you primary boot hard drive. So you installed drive should be the sdb/hdb. Note that if you already had more than one drive installed then your letter corresponding to the new drive could be different.
Here is the procedure for correctly setting up the hard drive to have ext3 file system
, My new hard drive is sdb
- Open a terminal and log in as super user (use su)
- Then type
and here is the parted terminal
GNU Parted 1.8.1 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands.
- Now create the partition label for the new drive. Since this my drive is 2TB, I’m going to use the label gpt but you could use the label msdos. So type
And follow the steps as given below
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes New disk label type? [msdos]? gpt
Now to check the status use ‘p’ or ‘print’ command
(parted) p Model: ATA Hitachi HDS72202 (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags
If you see this, you are now ready to create a partition in the disk.
- To create a partition type following
(parted) mkpart primary 0 -0
And check the status again
(parted) p Model: ATA Hitachi HDS72202 (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 17.4kB 2000GB 2000GB primary
Now you are done with the parted so exit
- Now you have created a partition in the disk and if you type, ls /dev/sdb* you will notice two entries for the sdb drive. sdb and sdb1.
- To create the file system ext3 on the partition sdb1, use mkfs.etx3 command.
mkfs.ext3 -m 0 /dev/sdb1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 244203520 inodes, 488378637 blocks 0 blocks (0.00%) reserved for the super user First data block=0 Maximum filesystem blocks=0 14905 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, 71663616, 78675968, 102400000, 214990848 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 22 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
Now you are done with setting up the hard drive and only thing left to do is mounting it so the drive can be used.
- Now create a directory to mount the drive and change its owner to your user name
mkdir mount_dir chown username mount_dir
- To mount this drive automatically at the boot time, one have to enter an entry to /etc/fstab file. So I have given below entries in my fstab file
less /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/home /home ext3 defaults 1 2 LABEL=/local /local ext3 defaults 1 2 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 LABEL=SWAP-sda5 swap swap defaults 0 0 /dev/sdb1 /mnt/dd ext3 defaults 1 1
SO you can copy the last entry
/dev/sdb1 /mnt/dd ext3 defaults 1 1
and change to your drive name and mounting directory name
- Now all you have to do is mount the new drive
Use mount to do that
mount /dev/sdb1 /mnt/dd
and check using df to verify the disk is mounted.
df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 9.5G 5.5G 3.6G 61% / /dev/sda6 438G 224G 192G 54% /home /dev/sda2 2.9G 69M 2.7G 3% /local /dev/sda1 251M 27M 212M 12% /boot tmpfs 2.0G 12K 2.0G 1% /dev/shm /dev/sdb1 1.8T 196M 1.8T 1% /mnt/dd
- Now you are ready to use your new disk drive