Navigation

Personal tools

Adding drives to your HDA

From Amahi Wiki

Jump to: navigation, search
Msgbox.update.png Update Needed
The contents of this page have become outdated or irrelevant. Please consider updating it.


Warning.png WARNING
This is recommended only for advanced users, proceed with caution.


Adding a second hard drive is another how to on doing this same thing. It goes a bit more in depth on other things also. This guide is a quick and dirty short version.

Contents

Prequisites

This is assuming that you've physically put the hdd into the system already, and just need to add it to greyhole now.

Partition the drive

First we need to find which drive we need to work on, this will run the command fdisk which will tell us what drives are in the system. Each drive is known as /dev/sdX and each partition is known as /dev/sdXX, so /dev/sda1 is partition "1" on drive "A"

bash code
​fdisk -l

Take note of the drive letter that we are working on, this is crucial later that we not get this wrong, in my example below, sda is my main boot drive, sdb is my first storage drive, and sdc is my new drive. Now we're going to run the program cfdisk on the drive and partition it.

bash code
​cfdisk /dev/sdc​

Note in this program we mainly use the up and down arrows to select the partition or areas of the partition we are going to work on, and left and right arrows to select which command to run. So first I want to delete the partitions on /dev/sdc until it says nothing but free space. Then highlight the "free space" and select "new" and hit enter 3 times to go with the defaults, primary and max size available. Then go right to "write" and hit enter, and confirm it saving.

Format the new drive

Now we must format the drive so it's prepared for new files, to do this we use a variant of the mkfs command, thankfully fedora has a useful scripts for doing this with minimal options. Just make sure to replace /dev/sdc1 with the drive you were using because it will wipe the drive. You can also use ext3 but for the example I am using ext4, it really makes very little difference.

bash code
​mkfs.ext4 -j /dev/sdc1​

Backup the current fstab

bash code
cp /etc/fstab ~/fstab.backup​

Make a dummy fstab

This is going to copy fstab to our homedir and then we're going to output the block id's into the dummy fstab, which saves us a bunch of copying and pasting and troubles with mistyping the block id's later.

bash code
cp /etc/fstab ~

blkid >> ~/fstab​

You should have something like this now, take note I already have a drive1, and I am currently adding drive2, so you won't have that, but it's good for the example.

     #
     # /etc/fstab
     # Created by anaconda on Wed Apr 13 12:20:11 2011
     #
     # Accessible filesystems, by reference, are maintained under '/dev/disk'
     # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
     #
     UUID=2811d23f-c105-4d0a-bcf5-596efa494548 /                       ext4    defaults        1 1
     UUID=5665c306-fb8b-44f9-8448-6ad05b85eef2 /boot                   ext4    defaults        1 2
     UUID=ec2057dc-fe19-4a1c-b28c-86bbbb387564 swap                    swap    defaults        0 0
     UUID=89865097-6b6b-4a6c-ba54-e9765e8fa141 /var/hda/drives/drive1  ext4    defaults        1 1
     tmpfs                   /dev/shm                tmpfs   defaults        0 0
     devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
     sysfs                   /sys                    sysfs   defaults        0 0
     proc                    /proc                   proc    defaults        0 0
     /dev/sda1: UUID="5665c306-fb8b-44f9-8448-6ad05b85eef2" TYPE="ext4" 
     /dev/sda2: UUID="ec2057dc-fe19-4a1c-b28c-86bbbb387564" TYPE="swap" 
     /dev/sda3: UUID="2811d23f-c105-4d0a-bcf5-596efa494548" TYPE="ext4" 
     /dev/sdb1: UUID="89865097-6b6b-4a6c-ba54-e9765e8fa141" TYPE="ext4"
     /dev/sdc1: UUID="b8d0c85b-c40e-4ebd-a6cb-2ff8a57acd95" TYPE="ext4"

Edit the dummy fstab

Now we're going to use the program nano, which is a console based text editor, you'll mainly be using the up,down,left and right arrows in this to get around.

bash code
nano ~/fstab​

First we want to cursor down untill we get to the /dev/sdxx lines near the bottom. Delete any lines that are drives already in the system. You might notice that the drive starting with /dev/sda1: UUID="566... is also up near the top as my /boot drive. So I'm going to move the cursor to this line and press CTRL+K to delete that entire line, and any other lines that are also in the above section. when I'm done it should look like this.

     #
     # /etc/fstab
     # Created by anaconda on Wed Apr 13 12:20:11 2011
     #
     # Accessible filesystems, by reference, are maintained under '/dev/disk'
     # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
     #
     UUID=2811d23f-c105-4d0a-bcf5-596efa494548 /                       ext4    defaults        1 1
     UUID=5665c306-fb8b-44f9-8448-6ad05b85eef2 /boot                   ext4    defaults        1 2
     UUID=ec2057dc-fe19-4a1c-b28c-86bbbb387564 swap                    swap    defaults        0 0
     UUID=89865097-6b6b-4a6c-ba54-e9765e8fa141 /var/hda/drives/drive1  ext4    defaults        1 1
     tmpfs                   /dev/shm                tmpfs   defaults        0 0
     devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
     sysfs                   /sys                    sysfs   defaults        0 0
     proc                    /proc                   proc    defaults        0 0
     /dev/sdc1: UUID="b8d0c85b-c40e-4ebd-a6cb-2ff8a57acd95" TYPE="ext4"

The last line is the new drive, now we're going to use the arrows, and basically copy the line to look just like the other lines by removing the /dev/sdxx at the start and the quote marks, which in the end should look like this.

     #
     # /etc/fstab
     # Created by anaconda on Wed Apr 13 12:20:11 2011
     #
     # Accessible filesystems, by reference, are maintained under '/dev/disk'
     # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
     #
     UUID=2811d23f-c105-4d0a-bcf5-596efa494548 /                       ext4    defaults        1 1
     UUID=5665c306-fb8b-44f9-8448-6ad05b85eef2 /boot                   ext4    defaults        1 2
     UUID=ec2057dc-fe19-4a1c-b28c-86bbbb387564 swap                    swap    defaults        0 0
     UUID=89865097-6b6b-4a6c-ba54-e9765e8fa141 /var/hda/drives/drive1  ext4    defaults        1 1
     tmpfs                   /dev/shm                tmpfs   defaults        0 0
     devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
     sysfs                   /sys                    sysfs   defaults        0 0
     proc                    /proc                   proc    defaults        0 0
     UUID=b8d0c85b-c40e-4ebd-a6cb-2ff8a57acd95 /var/hda/drives/drive2  ext4    defaults        1 1

You can copy and paste this line up higher and make this file "pretty" but for the purposes of this howto, I am just going to leave it as is because it really makes no difference where in this file the new drives are at. Press CTRL+X to exit and verify it saving.

Preview the file

Preview your fstab, and be very careful that everything is right, if it's not, just use the nano command from earlier to go back in and edit it. It is crucial this file is correct.

bash code
less ~/fstab​

Once your satisfied, continue on.

Copy the dummy for use

Now we need to use the following command to delete the current fstab and replace it with the new one.

bash code
rm /etc/fstab

mv ~/fstab /etc/fstab​

Make the empty folders

I already have a /var/hda/drives folder, so I didn't need to do this, but you may have to.

bash code
mkdir /var/hda/drives​

Now we make the individual drive folder or folders if we need multiple.

bash code
mkdir /var/hda/drives/drive1​

You are going to have to reboot to apply these changes. Then just goto your hda and add the new drive into the greyhole pool. If you get an error, it can stop your system from booting normally, so I again ask that you verify the file is written correctly.