[BlueOnyx:02217] Re: Adding a new hard drive

Michael Stauber mstauber at blueonyx.it
Wed Aug 26 13:12:01 -05 2009


Hi Tommy,

> I have added a new hard drive to my raid.  How to I get blueonyx to use it
> as drive space?  This is my 3rd hard drive.

Ok, first check with "/sbin/fdisk -l" to determine which device represents the 
new HD.

If you're using 3x SATA disks and were using RAID1 so far, chances are that 
the third disk will be /dev/sdc, but it could be different.

Based on the report of "fdisk -l" and the reported disk sizes you should be 
able to spot which disk is the new one and which ones belong to the RAID1 
array.

In this small write up I'll assume that the 3rd disk is /dev/sdc. If yours is 
different, then you'll have to change the commands I tell you here 
accordingly.

First of all you need to partition the disk. For that we use fdisk:

/sbin/fdisk /dev/sdc

Press "p" to see if there are any existing partitions on the disk. If there 
are, press "d" and then the number of the partition to delete it. Repeat this 
until all partitions are gone. You ought to be really sure here that this is 
not a disk of the RAID array, though.

Then with "n" you can create a new primary partion. When it asks for start and 
end block, simply press return and use what's suggested. That will create a 
single partition that spans all available space on the disk. Type of the new 
partition should be "Linux". From memory I think it's type 83.

When done, press "w" to write the changes and exit.

Next you need to format the disk with a filesystem of your choice. We use 
"Extended 3":

/sbin/mkfs.ext3 /dev/sdc1

That will format partition one on disk sdc with EXT3. This will take a while.

Next decide under which mountpoint you want mount the disk. In this example 
I'll use /extra. Create the directory first:

mkdir /extra

Now lets mount the disk

mount -t ext3  /dev/sdc1 /extra

That should mount the disk and make it available under /extra. Check with "df 
-h" to see how much space you now have available considering all available 
disk space (RAID1 + the extra disk).

Now after every reboot of the box you'd have to manually mount the disk again 
with the command "mount -t ext3  /dev/sdc1 /extra". This can of course be a 
nuisance.

To let Linux mount the disk automatically during every reboot, add the 
following line to the bottom of your /etc/fstab:

/dev/sdc1	/extra	ext3    defaults	0 0

Save the changes and you're good to go. The disk will be automatically mounted 
after every reboot.

PLEASE NOTE: If the 3rd disk is connected via USB, you do NOT want to mount it 
automatically!

USB disks have the habbit of changing their device ID from time to time. So a 
disk that used to be /dev/sdc1 may suddenly end up being reported as /dev/sdd1 
or thereabouts. This can stop the bootup of your server dead in its tracks as 
it complains about a missing disk.

For USB disks use this instead in /etc/fstab:

/dev/sdc1	/extra	ext3    defaults,noauto	0 0

The "noauto" option means that the disk will not be mounted automatically. 
More importantly: If it's missing, the system won't complain either. The 
benefit beyond that is, that you can mount the disk more easily by then simply 
using "mount /extra" instead of the full syntax.

And if the device ID changes, you simply confirm the new one with "fdisk -l" 
and either fix /etc/fstab, or use the full syntax of "mount -t ext3  /dev/sdX1 
/extra" again.

-- 
With best regards

Michael Stauber




More information about the Blueonyx mailing list