Tuesday, February 19, 2013

In this tutorial I am going to tell you how to add an another hard disk to my ubuntu server.

To add the second hard drive into Ubuntu, open up the terminal window and type

sudo fdisk -l

The above command will report something like

/dev/sda1 * 1 18709 150280011 83 Linux
/dev/sda2 18710 19457 6008310 5 Extended
/dev/sda5 18710 19457 6008278+ 82 Linux swap / Solaris

But will include a listing for your new drive. If you only see listings for /dev/sda* then your new drive has not been recognized and there is a problem with the physical installation.

sudo mkdir  /Data
Once you know where your drive is located (again we’ll use /dev/sdb for our example) it’s time to create a new directory where this drive will be mounted. We are mounting our drive to the directory /Data so we’ll create this directory with the following command

Now  make it available to all users

sudo chmod -R 777 /Data

With a place to mount the drive, it’s time to format the new drive. The formatting will be done with the command

sudo mkfs.ext3 /dev/sdb

When this is complete you are ready to mount the drive. Before you edit fstab entry (so the drive will be automatically mounted) make sure it can be successfully mounted with the command

sudo mount /dev/sdb  /Data

 If this is successful let’s create an entry in /etc/fstab. open that file with the command

sudo /etc/fstab

Now add the following entry at the end of that file

/dev/sdb /data ext3 defaults 0 0

Once you save that file, mount the drive (without having to reboot) with the command

sudo mount -a

To make sure the drive mounted successfully issue the command

df -h

The above should include in the report

/dev/sdb /Data

If that’s the case, success! You can run one file test by trying to write a file to the new drive with the command

touch /Data/test

If you can write that file all is well.....................

Thats it secondary drive added.........................



Post a Comment