Tuesday, June 5, 2012

Connect external hard disk to Linux


To connect external harddrive in Oracle enterprise linux, please follow the below steps.

1. I connected the external harddrive, but there is no notification of external harddrive in file system explorer window.

I typed fdisk -l , and I saw the boot devices under /dev/sdb
           
                  /dev/sdb1
                  /dev/sdb2

Next I removed the partion and formatted the disk.

                  fdisk /dev/sdb

To get the menu, type m and enter

To remove the existing partion, type d and enter, it will ask us to remove primary partition or extended partion. type p and enter

Again it will prompt about primary partition 1-4. We can give 1 and contiue. This will remove the primary partition 1. Continue these steps until we get there are no partitions yet.

2. After deleting the partitions, we can create new partion. For that type n and enter. This will promt about primary partition and extended partition. Type p and enter, and create the primary partion with 1-4 (I used 1 and 2 with 50 GB and 250GB) and mention the size of the partion at the end file size (+50000M and +250000M). To save the partitions, type w and enter

3. After creating the new partitions, format the partitions

  mkfs.ext3 /dev/sdb1
  mkfs.ext3 /dev/sdb2

4. Now we can mount the file system. Create two directories

mkdir /mnt/usb1
mkdir /mnt/usb2

5. Mount the hardrive file systems to these directories.

mount /dev/sdb1 /mnt/usb1
mount /dev/sdb2 /mnt/usb2

We can copy the files in either usb1 or usb2, will copy in the external harddrive
Befor disconnecting the external harddrive, please unmount the directories.

umount /mnt/usb1
umount /mnt/usb2