Install Linux From External USB hard drive
In : system, Posted by admin on Mar.03, 2009
After getting that new USB external hard drive case and installing that new hard drive, you need to get it installed and working with your Linux box. These instructions worked for me on Ubuntu and they should work for those with other distributions.
After putting the drive in the case, connecting it to power and plugging it into the back (or front) of your machine, the first thing you need to do is find out what device it is. USB hard drives usually show up as /dev/sdx (where x is a letter starting from a). If this is the only usb drive you have plugged in, it will most likely be /dev/sda.
To find out what it is look at the output of the command: tail /var/log/messages in your terminal. It will give you some irrelevant stuff, so look for a line that looks like this:
May 16 07:50:26 localhost kernel: Attached scsi disk sdb at scsi6, channel 0, id 0, lun 0
On my machine the drive shows up as /dev/sdb because I have an external DVD burner attached.
Now run fdisk as root and create a partition on the drive. On my Ubuntu box I did this by typing: sudo fdisk /dev/sdb into the terminal.
Once in fdisk press p to display a list of current partitions (there shouldn’t be any) and n to create a new partition. You want to create primary partition #1. fdisk will ask a few questions at this point, but since I was setting up an external drive, I didn’t want to create anything fancy so I just created one big partition for the entire drive, the default answers will do this. Once you get back to the fdisk prompt, press w to write the partition table. Now quit fdisk.
Now that you’ve got your partition set up, run the command mkfs.ext3 /dev/sdb1. I ran it as root (using sudo) on my box. This can take a long time, so if you want it to tell you what it’s doing, use the -v option.
Create a mount point
First create a directory you can use as a mount point. Mount point is a directory in the boot partition into which the drive is mounted. Usually the mount points are created under the /mnt/ -directory. Name the directory as you wish to call the new disk.
# mkdir /mnt/newdisk
You may want to issue the chmod go+x /mnt/newdisk command to grant other users access to the mountpoint. Now you may manually mount the drive by issuing command
# mount -t ext3 /dev/hdb1 /mnt/newdisk
Add hard disk to fstab
Mounting the hard drive manually every time is annoying. To mount the disk automatically, add it to fstab -file located in /etc/fstab. Depending on how you named the mount point, add the following lines to the end of /etc/fstab:
/dev/hdb1 /mnt/newdisk ext3 defaults 0 0
The first set is the partition (1st partition of hdb), second describes the mount point and the third describes the filesystem type. ‘defaults’ tells the options. The first 0 is the ‘dump’. It tells the computer whether the drive should be backed up. a ‘0′ means that it will not be backed up, a ‘1′ enables backup. The last number determines the order in which the filesystems should be checked. If it’s zero, ‘fsck’ won’t check the filesystem.
Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment