Ubuntu – Add two new HDD in Raid 1

12.10fdiskmdadmpartitioningraid

I just made a fresh install of Ubuntu 12.10 on a new SSD (/dev/sda). Now I would like to add two 1TB drives (/dev/sdb /dev/sdc) in RAID 1 but I'm pretty clueless on how to do it.

This is what I came up with (but didn't work):

First created partitions on the new drives:

sudo fdisk /dev/sdb

created primary partition and write table to disk

After that:

sudo mdadm --create --level=1 --name=raidarray --raid-devices=2 /dev/sdb /dev/sdc

However this outputs:

mdadm: device /dev/sdb exists but is not an md array.

Can somebody point me in the right direction on how to do this?

One bonus question: Would it be possible to reserve a part (same size of SSD) of one HDD and create a RAID 1 with the SSD and part of the HDD. And if so, how and can I keep my installation?

Best Answer

The default command should look like this:

mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2

You are not adding a complete disk, you should add a device (use /dev/sdb1 (or2), not just /dev/sdb) as far as I know. The target name (/dev/md0) was also missing.

I always use this cheatsheet: http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/ :D

Related Question