by siyb

Over a year ago I installed the first harddrive upgrade on Sycorax, the siyb.de server. (Un)fortunately harddrive space doesn’t last forever, so that recent events forced me to upgrade the storage hardware once more. Due to a lack of money I choose to use mdadm to create a software raid above 4 newly purchased harddrives that have been connected to a PCI SATA II controller, anything else would have force me to buy a new motherboard, CPU and RAM.

Ingredients:

  • 1* SATA Controller PROMISE SATA300 TX4
  • 4* SAMSUNG SATAII 750 GB F1

raid2_1

Although I am really happy with my Seagate harddrives that I have used in the first Raid, I have chosen to use Samsung hdds this time because they are quiet, cool and supposedly last for a long time (we will see :>). This report will feature hardware assembly as well as setup of the encrypted software raid.

First of all I had to prepare the server for the new hardware by connecting an additional cable to my Enermax Liberty ELT400AWT and installing an extra fan, to cool the hdds, that would be placed above one another and therefore require some active cooling.

raid2_2
raid2_3

After installing the controller card the hdds could be connected and the machine was ready to be turned on again

raid2_4
bild-008.jpg
raid2_5
raid2_6

Lets build the raid, I found some good tutorials online that helped me setting up the mdadm raid, they can be found in the appendix. I suggest that you take a look at them if you are planning to create a software raid yourself, my notes are just “guidance” and a small reference, but I will not going to explain any little detail. Anyway, here is what I did (Debian Lenny, standard Debian kernel in use):

Installation of required packages:

apt-get install hashalot cryptsetup mdadm

Software raids consist of partitions rather than physical devices, so naturally the first thing to do was to create partitions on the new drives that I could use to assemble a raid, I choose to use cfdisk for comfort, but you might as well consider fdisk or other tools.

cfdisk /dev/sdb
cfdisk /dev/sdc
cfdisk /dev/sdd
cfdisk /dev/sde

I created one partition per drive, which left me with a total number of 4 partitions to use with my raid5.

mdadm –create /dev/md0 –level=5 –raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

Before formatting the raid device /dev/md0, I took some time to encrypt the device:

cryptsetup –verbose –verify-passphrase luksFormat /dev/md0

After that formatting is a piece of cake

cryptsetup luksOpen /dev/md0 cryptraid
mkfs.ext3 /dev/mapper/cryptraid

Adding the following lines to /etc/fstab and /etc/crypttab allows the device to be mounted automatically when starting the computer

In /etc/crypttab:
cryptraid /dev/md0 none luks

In /etc/fstab:
/dev/mapper/cryptraid /mnt/storage ext3 defaults 0 0

The result:

/dev/mapper/storage 2063G 13G 1945G 0.7 [...................................................................] /mnt/storage