Transfer HDD Software Raid from IB-NAS-4220-B to workstation computer

I'm writing this post because I want to get away from my Raidsonic IB-NAS-4220-B, a dedicated network access storage (NAS) device. Instead I want to put the two S-ATA hard disks into my Ubuntu linux home server. It should use software raid1 just as the NAS did before and I don't want to change anything with the disks. I just want to plug them in and be able to mount them. This is possible with the kernel module md from the package mdadm. Read on if you want to know how it works...

basic configuration

First check if kernel module md is loaded on the Ubuntu server.
If it is not installed then get it (choose not to install an MTA if you do not really want to send warning e-mails in cases of degrading statuses):

sudo apt-get install mdadm
# and load the kernel module
sudo modprobe md

Check again, if the kernel module md is loaded:

sudo lsmod | grep md

Now you can append a new line md to /etc/modules in order to load the module at startup.

move an md raid from one to another computer (or from IB-NAS-4220B to Ubuntu PC)

Just transfer the disks to your new computer, install mdadm (described above) and run

sudo mdadm --assemble --scan

This will add entries to the config file: /etc/mdadm/mdadm.conf

create a new raid 1 instead

create the partitions on the disks you want to use. This can be done using fdisk: choose n for new partition then create a partition taking the whole disk. Start the partitions used as elements of the raid array on cylinder one instead of the default cylinder zero in order to have no problems with disk lables. if the two hdds are of a different size you must create two partitions of same number of cylinders (size). now choose t for type and select fd (Linux RAID). Commit changes with w.

Now create the raid 1 array:

sudo mdadm --create --verbose /dev/md0 --auto=yes --level=0 --raid-devices=2 /dev/hde1 /dev/hdg1

then you can format it (with the ext3 file system for e.g.):

sudo mkfs.ext3 /dev/md0

add a mount point

howto fstab (syntax and fstab options, how to label, examples, references):

Add an entry for the device /dev/md0 to /etc/fstab:

/dev/md0 /mymountpoint ext3 defaults 0 2

If you want the raid array to work with spindown etc. then replace defaults by noatime, or relatime (see for the effects). The second last number tells the dump command (backup) to ignore the file system and the last number tells it to scan the filesystem 2, to do it with priority 1 or to not check it 0.

if mdadm ist not run automatically on startup, then: Create a file in the folder /etc/init.d/ called mdadm-custom, with the same ownership (root/root) and permissions (755) as the other files:

# Custom work for mdadm on boot #
# I don't specify a specific array. This will assemble all.
mdadm --assemble --scan
# Start the monitoring process
#nohup mdadm --monitor --mail=philipp --delay=300 /dev/md1 &

Then, in your /etc/rcS.d create a symlink to this file:

sudo ln -s /etc/init.d/mdadm-custom /etc/rcS.d/

where the S29 is a number smaller then the number in front of the mountall script, actually: and smaller than the filesystem check link number This way, the custom script will run before the mountall.

raid knowledge

howto setup at time of installation and howto replace failed devices:

check status of the raid system:

cat /proc/mdstat


When making use of the linux software raid (mdadm) adjust the values of the physical drives for spindown. Not the device handle /dev/md0! ( )

check status of a hardddisk:

sudo hdparm -C /dev/sda

put a harddisk to standby (spindown):

sudo hdparm -y /dev/sda

to configure spindown time use the next code block where the value -S means the factor x 5s it will take until spindown from the manpage for longer timeouts: "Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values."

# set HD spindown to 5 minutes 
hdparm -S60 /dev/sda
# set HD spindown to 30 minutes
hdparm -S 241 /dev/sda

in case it doesn't work as you wish, take a look at

for spindown to work after reboots save the settings in the file /etc/hdparm.conf

command_line {
       sudo hdparm -S 240 /dev/sdb
command_line {
       sudo hdparm -S 240 /dev/sdc

read out hdd temperature


sudo apt-get install hddtemp smartmontools


sudo hddtemp /dev/sdb

for more see:

sudo smartctl -a /dev/sdb