Thursday, January 3, 2008

How to add a new hard disk to Linux

Yesterday night I was planning to add a new hard drive to my Linux machine ( Ubuntu ), I thought it would be a difficult task, but to my surprise it was almost like a walk in the park.
here are the simple steps that made me through.
  1. Physically added the new hard drive ( Not yet partitioned )
  2. ls /dev/sd*
    1. This will give you a list of devices, you should be able to identify the device which you have recently added, it was easy for me as I saw something like this
    2. /dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb
    3. As /dev/sda seems to be portioned /dev/sdb is the new hard drive.
  3. Partition the new hard disk
    1. cfdisk /dev/sdb
    2. I created just 1 partition, you may have your own preferences.
  4. Format the partition
    1. mkfs -t ext3 /dev/sdb1
  5. Configure the system so as to auto mount the drive ever time you boot the system.
    1. Edit the /etc/fstab file
      1. vi /etc/fstab
    2. add the following line
      1. /dev/sdb1 /storage ext3 defaults 1 2
  6. Just to check if the file was correctly edited, type "mount -a" if no error is shown you are done.
  7. no need to reboot you new hard disk is accessible through /storage

No comments: