Wednesday, April 4, 2012

Adding New Hard Disk Drive onto Ubuntu 10.10

http://essayboard.com/2010/12/19/adding-new-hard-drive-onto-ubuntu-10-10/

Adding a second hard drive or additional hard drive to Ubuntu 10.10 or any other Linux flavor (distribution) can be frustrating sometimes. So here I present you the information of how to do it. Just to be clear, within this post, I do not show you how to physically install second hard drive or additional hard drive to your computer, but it’s rather of how to make your Ubuntu 10.10 system or other Linux flavor to be able to recognize your second hard drive or additional hard drive. So let get started!

Open up a terminal and type in the command [sudo fdisk -l] without the square brackets. Your first hard drive is obviously going to be listed in the standard output printout (i.e., your terminal), and usually the first hard drive should be listed as something of /dev/sda. Linux lists hard drives in the directory which is known as dev. Also, inside dev directory, other partitions of your hard drive may look like /dev/sda1, /dev/sda2, /dev/sda3 and so on. Just like how Windows lists its hard drives such as C:\, D:\, E:\, and so on. Linux is also doing the same thing (i.e., pattern) but with different combination of letters. With that in mind, the second hard drive within Ubuntu 10.10 or any other Linux should be /dev/sdb (i.e., partitions of drive sdb should be sdb1, sdb2, and so on). When you typed in the command [sudo fdisk -l] earlier, you should see /dev/sdb or in the case of a third hard drive you should see /dev/sdc and so on. The whole idea is if you see the new hard drive is on the list of fdisk’s standard output printout, then you can mount the drive permanently or temporary.

There is another scenario when you can’t find your new hard drive on the list of fdisk’s standard output printout, because your new hard drive isn’t yet formatted into the right type of partition table. Another way to clearly explain that is your hard drive won’t be recognized by your operating system such as Ubuntu 10.10 unless the hard drive has been changed into a file system that can be recognized by your operating system. This is not that hard really! For Ubuntu 10.10, go toSystem > Administration > Disk Utility, highlight the new hard drive on the left side panel, and on the right side panel, just click onFormat Drive. Make sure you have backed up all important files on the new hard drive, because format a drive will delete everything on it. Make sure you choose GUID partition table type so it can be recognized by many other operating systems in case you have to switch to another operating system and still wanting to keep the same partition table and files on this specific hard drive. One additional step must be taken care of before your new hard drive can be mounted is to create a partition for it. So after you have format the drive, creating a partition is simply to click on Create Partition button on the right panel of Disk Utility. Make sure you choose the ext4 or ext3 file-system, but I prefer ext4 file-system. Choose the size of the new volume or using the whole drive for the new partition. Label it if you want such as BackupStorage. Check the box which states “Take ownership of filesystem.” ClickCreate button and there you have it, a brand new volume that can be mounted.

Get back into your terminal, type in the command [sudo fdisk -l] to see your new hard drive is on the fdisk list or not. After you confirm that it’s visible on fdisk’s standard output printout, then it’s time to create a mount point. What’s a mount point? It’s a virtual location on your main hard drive (i.e., first hard drive), and your operating system will look at your first hard drive first to see if it can find the list of the partitions. By creating a virtual location of a mount point on the first hard drive, you’re one step closer to permanently mounting your new hard drive. To do this, go to the terminal again, and type in the command [sudo mkdir /media/BackupStorage], and I try to name the new hard drive’s mount point label similar to the new hard drive’s label when we had formatted the drive earlier. Again, inside terminal, type the command [sudo chmod 755 /media/BackupStorage] to ensure correct permission is applying to the new mount point of the new hard drive. Again, inside terminal, type the command [sudo chown -R user:user /media/BackupStorage], but make sure that you replace the user:user part with the real user you want to have control over the new hard drive and mount point. Obviously, don’t try to enter the square brackets inside the commands that you’re going to enter into the terminal since I place the square brackets in this post so the commands would stand out.

Now you have the mount point for the new hard drive or volume. The obvious next step is to do a temporary mount! Remember when you use the command [sudo fdisk -l]? You should have seen the /dev/sdb1 or something of sort as your new hard drive’s newest partition. Let mount that to the new mount point! Inside a terminal, type in the command [sudo mount /dev/sdb1 /media/BackupStorage]. To check to see if your new hard drive is really mounting to /media/BackupStorage mount point, all you have to do is type in the command [sudo df -l]. If you see /dev/sdb1 or something of sort resides on the same row with /media/BackupStorage, then you have successfully mounted your new hard drive.

What we did above is to only temporary mount the hard drive as if we had tested to see how we are doing so far with the process of adding a new hard drive to your system. The last step would be permanently making your new hard drive available after every boot or reboot of your computer. To do this, you need to be inside your terminal, type in the command [gedit /etc/fstab]. An editor will pop up with a file which has the list of all mounting partition tables. Now, go to the very last line (i.e., empty line at the bottom of the file) and type in [/dev/sdb1 /media/BackupStorage ext4 defaults,noexec,nosuid,rw 0 0]. Save the file and exit out of the editor. Obviously, make sure you replace /dev/sdb1 with your actual drive number such as /dev/sdc1 or /sdb2 or whatever; replace /media/BackupStorage with actual label of your mount point; replace ext4 with actual filesystem that you had formatted the hard drive with; make sure 0 0 is not letter o(s) but actual two number zeros with a space in between. Lastly, just reboot the computer and you should be able to use the brand new hard drive. To check to see if everything is alright, you can do this by go toPlaces > Computer. Creating a test file or a test folder inside the new hard drive to see if you can actually do that. There you have it, a brand new hard drive that is working with Ubuntu 10.10 or any Linux flavor that you’re using!

No comments:

Post a Comment