Apr 02
Create a software-RAID-1 on a Linux system
This is a short how-to to create and mount a software RAID 1 partitition.
Before you start, it may be helpful to read this
Then begin to mechanically install your new disks. Check the /dev directory. Your new disks should show up. In my case they were automatically labeled "sdb" and "sdc", "s.." as these are SATA drives. Next you need to create a virtual drive, use
sudo mdadm --create /dev/md0 -l 1 -n 2 /dev/sdb /dev/sdc
to create a drive-array with the name "md0", -l is the RAID level (RAID 1 in this case), -n stands for number of disks (two disks here) and that is followed by the names of the drives to use ("sdb" and "sdc" here)
Now, we need to initialise this newly created virtual drive/volume with lvm as physical volume:
sudo pvcreate /dev/md0
The command pvdisplay will show you the result of this command, if you like. Next you need to create a volume group called "storagevg" on the physical volume "md0" (which, as we know, is actually a virtual drive)
sudo vgcreate storagevg /dev/md0
You can see the volume group with vgdisplay. The next step is
sudo lvcreate -L 465G -n onelv storagevg
what creates a logical volume (called "onelv") inside our volume group ("storagevg"). You can see this logical volume with lvdisplay. The last step in the drive preparation is to actually format it. We will use the versatile Ext3 filesystem here:
sudo mkfs.ext3 /dev/storagevg/onelv
Finally, to automatically mount the formated drive/ file system on boot-time (as folder"/var/raiddrive"), you need to add this line to /etc/fstab:
/dev/storagevg/onelv /var/raiddrive ext3 rw,noatime 0 0
Of course, you are free to select another mountpoint. To also mount this new drive in our current session, do this:
sudo mount -a
Now your RAID 1 drive array should be ready for use
Further useful tools:
sudo system-config-lvm
sudo evmsgui
This follow up post describes how you can add more disks, bundle them in RAID arrays and add them to a volume group to extend your storage space.