Contents [hide] * 1 Adding a new hard drive o 1.1 Internal ATA hard drive + 1.1.1 Partition hard disk + 1.1.2 Format hard disk + 1.1.3 Create a mount point + 1.1.4 Add hard disk to fstab o 1.2 Internal SATA hard drive o 1.3 Internal SCSI hard drive o 1.4 External USB hard drive [edit] Adding a new hard drive This section will guide you through with manually setting up a hard disk for your computer running Linux. There are also more automatic tools for the job, like the DiskDrake. Knowing the basics helps using these tools too and gives you some clue if something goes wrong. THESE INSTRUCTIONS ARE YET UNFINISHED See also: Adding Another Hard Drive which recommends WHERE you might logically mount your new drive [edit] Internal ATA hard drive The ATA bus can usually handle only two devices per bus. If you are attaching two devices to the same bus, you need to configure one as master and one as slave. This is done with jumpers on the hard disks. If you have several disks, check the jumper settings on all disks. Check the top of the hard disks for information. (The third option is to use cable select, but it won't be discussed here.) Next you need to open the computer case, if you have not yet done so. There are usually several bays inside your computer where you can attach the hard drive. You will need screws to secure the drive to the bay. Then connect the hard disk to the ribbon cable and to the power cable. The power cable will fit only in one way. Usually the ribbon cable will have a red side, which is supposed to connect next to the power connector on the hard-disk. Then close the case. Boot the computer. During boot, check the BIOS settings so that the new drive is recognized correctly. If you can see your new harddisk, when the kernel startsup, but you can't finde the harddisk in /dev Then use the /dev/MAKEDEVICE /dev/hdX where X marks the location of your harddisk, when the kernel startsup. This happends, when you have attached +8 devices to your computer, via the motherboard, or via a controler card. [edit] Partition hard disk Main article: partition a hard drive Partition the hard disk by using eg. fdisk. Depending on which bus the disk was attached and whether it disk was configured as slave or master, it will be mapped differently (IDE tree mapping). As root enter the following command (assuming hdb is the drive you are installing). # fdisk /dev/hdb You should make at least two partitions, one Linux partition and one Linux Swap partition, if you intend to use the disk as your primary disk. [edit] Format hard disk Main article: create a file system Format the hard disk by using eg. mkfs. You should now choose the filesystem for the new hard disk. Most common filesystems are ext2 and ext3. [edit] 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 [edit] 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. Finally reboot the system to ensure that the operation is trouble free. You are finished now. [edit] Internal SATA hard drive [edit] Internal SCSI hard drive Adding a new SCSI hard drive should work pretty much like adding an ATA drive. Mapping of the hard drives differs and one does not need to worry about the master/slave configuration, you just need to set an unique SCSI-ID for each device. [edit] External USB hard drive This is based off of a forum posting over at The Linux Pimp. The original posting can be found here. 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. Category: hardware, hardware configuration