Virtual Box RAID 1
Posted about 1 year ago
I'm setting up a testing environment with a Debian Etch based virtual machine running in Virtual Box. The environment calls for RAID 1 using mdadm and I have already begun setting up for this. I'm cloning a current non-RAID VDI and will document some of my findings and bottlenecks in this blog.
Assuming you are or can get as far as creating a VM...if not try Google or RTFM :)
Cloning a VDI
Move to the directory in which your vdi files are stored. I noticed that the VBoxManage command does not take into consideration that you may not be using the default ~/.VirtualBox directory for this. If you are NOT storing your VirtualBox images in ~/.VirtualBox then you MUST specify the full path as of version 2.1.2r41885. In my case the command would look something like below and I had to ask sudo to bless me with write permission to /opt. Clone as many virtual disks as you wish or your hard drive space will grant you.
VBoxManage clonevdi /opt/debian-web2-vraid1.vdi /opt/debian-web2-vraid2.vdi
Adding the Images
Add these disk images to VirtualBox, this can be done through the Virtual Media Manager in the File menu of VirtualBox. Then open the settings of the VirtualBox that you have hopefully created already and add these images in the hard disks menu. Sorry I'm just too lazy to make screenshots.
RAIDing Linux
I have found software RAID with Linux (specifically Debian) to be rather easy. Simply create an identical partition layout on each disk intended to be used in the RAID 1, instead of using a typical ext3 filesystem use the for RAID device option. Once all your partitions have been created, select the new option at the top of the main disk partitioning menu Configure RAID. Create a new RAID device, select RAID 1, I chose two active devices for the RAID you may be using more. You can also use a spare if you have planned for that. Repeat this for each RAID 1 device you wish to create. Once back at the main disk partitioning menu select each newly created RAID device and you can now set mount points and other options as you would any other device.
If I have left anything major out please let me know. Happy RAIDing! After having all this fun I bought 3x500GB Seagate Barracuda drives to add to the one I am already using to store my movies/music etc on. I plan on setting them up in 2 pairs of RAID 1 and creating one big device using LVM on top of the RAID for a sexy 1TB RAID 1! There is also a chance of a RAID 1+0 but LVM will be more difficult which is what I'm all about.
Sean



