Tuesday, August 24, 2010

How to Install a New Hard Disk With an Anuto Mount Point

             Hi guys, The reason why I'm writing this post is to pit all the parts together in a one place so any one can find it and follow the steps with ease. Why thought to do this because I recently got a new 160GB Samsung Hard Disk which I installed in to my desktop which was running Ubuntu Lucid Lynx (10.04 LTS). As every one knows un-like windows which gives a disk management which will let any user to format and use the drive in two or three clicks where in Linux that part still have some caching up to do. So after installing I ran in to the problem where I wanted to format this and create a mount point which will mount it at the boot time automatically and also I didn't want to use the conventional /media folder to create a mount point I wanted it to act just like the partitions created at the system installation. From that thought my big adventure began to find a way to get this done with out using the /media folder. What happens when some one user the /media is the it acts like a external drive all the data the user transfer on to that particular partition get stored inside /media folders mount point and after word get transfered on to the corresponding drive thats why I didn't want to do that.

            To find an answer I turned my self to the best friend I now "GOOGLE" well all the answer turned out was the conventional ways to go through the /media folder now I was getting frustrated. At that point I decided to find a solution my self by using my knowledge which I've gained through out these years I started to experiment which eventually ended up in a success now I'm giving it to you step by step so you want face the same difficulty which I faced.

Step - 1

We need to install a disk management software which can be handled by any user my best choice is Gparted to install this open the terminal and type the below code.



Step - 2

After installing Gparted you need to create a partition and need to format it in a file system which the system supports.
  • Open Gparted follow this path System > Administration > Gparted
  • After that Select your drive which you want to partition as an Ex: sdb (This is SATA drive) hdb(This is IDE drive).
  • Right click on the empty space.
  • Click New
  • Give the amount of space you want to use and the file type as an Ex: ext4 also select the partition type is it primary partition or a extended.
  • Now click on the "Apply" button but this want apply the changes straight away if your absolutely sure about the partition click the green colored apply button to apply the changes permanently.
We have created a partition and also formated it let's move forward.

Note: Other wise you can use $ sudo fdisk -l to get you existing partition list.

Step - 3

Now we're ready to mount our new had drive let's proceed open the terminal and follow the below steps.
  • Create a mount point in /root.
             
  • Make a backup of /etc/fstab file.
             
  • Use sudo to edit the fstab file this will allow us to add new partition to the file
             
  • Now you need to get UUID of your new partition to do that use the command below. This command will list all your UUID's remember to get the one matters to the new partition.
             
  • Enter this line in to your fstab file.
             
  • Just in case you fail to get the UUID you can use format shown below as well.
             
  • Now save everything and close gedit. Pass the below command in the terminal to remount the drives.
             

Step - 4

Let assign proper user rights to the new drive so you can use it with out any trouble.

  •  Run the this to assign the owner and the user group. Ex. sudo chown -R test:test /test2
             
  • Also Run this as well.
             

Step - 5

Almost done now we need to create a symlink to the drive you just created.
  • Use this command to create your symlink in any destination you wan the link to be.
             
NOTE:You can't use hard links to do cross drive linking only symlinks work like that

Alright we're all done now you can use your drive just like you're using all your other partitions which was made during the installation.

Enjoy ;-)