The MLN ProjectComplex virtual machine management made easy |
Navigation |
Creating Software RAID on your UMLThis example demonstrates how to create a software RAID on your virtual machine. You might wonder why this is interesting, but i can come up with three cases:
The entire example is as root-free as possible, meaning you can try this without root privileges. That is why i don't address network connectivity in this example. You need to have the uml-utillites installed on the system you try this on. This can either be done manually, or through a package management tool. Getting the latest version of MLNThis example will work on 0.73rc3cvs4 and up. If you want to get the lates CVS version, run this command:wget "http://cvs.sourceforge.net/viewcvs.py/*checkout*/mln/mln-cvs/mln" Finding a suitable template and uml versionThe template used here is this: sarge-thick-V0.7.ext2.tar.gzIt contains the mdadm tool needed to administer software RAID in Linux. The uml version is uml-2.6.12-rc2-mm3.tar.gz It has compiled-in support for device-mapper and different RAID types. If you think of using your own uml kernel, make sure it supports device-mapper. Creating the ekstra disksMLN lets you specify more disks, but it does not create them for you, so we'll create the disks manually. I want to create a RAID level 5, so we need three disks for it. I make mine 1.5 GB each:dd if=/dev/zero of=/old-disk/disk1 seek=1500 count=1 bs=1M dd if=/dev/zero of=/old-disk/disk2 seek=1500 count=1 bs=1M dd if=/dev/zero of=/other-disk/disk3 seek=1500 count=1 bs=1MNote, that two of the partitions reside on a different disk. MLN project fileNext, i write the project file:global { project rt } host jumbo { template sarge-thick.ext2 memory 96M term screen free_space 200M mount { /old-disk/disk1 none /old-disk/disk2 none /other-disk/disk3 none } }This is a simple setup. No root password and no network connectivity. Look at the other examples in order to see how you can connect the hosts to the network. Building and startingBuilding and starting is done with these two commands:mln build -f software-raid.mln mln start -p rtYou can now connect to the virtual machine using screen screen -r jumbo.rt Setting up the software raidWe are now inside the virtual machine and are about to create the software raid and to add it to /etc/fstab in order to make it available at every reboot.Creating the arrayjumbo# mdadm -C /dev/md0 --level=raid5 --raid-devices=3 /dev/ubd32 /dev/ubd48 /dev/ubd64Note the strange numbering for the different partitions. Every uml ubd device has a 16 count difference in /dev. Next, you may create a filesystem on the raid device: jumbo: mkfs.ext3 /dev/md0 Writing /etc/mdadm/mdadm.confIn ordder to make the administration tool detect the array next time it boots. Write this into the file /etc/mdadm/mdadm.confDEVICE /dev/ubd32 /dev/ubd48 /dev/ubd64 ARRAY /dev/md0 level=raid5 num-devices=3 devices=/dev/ubd32,/dev/ubd48,/dev/ubd64 Edit /etc/fstabLast, we add the array to fstab and mount it:jumbo# mkdir /raid jumbo# echo "/dev/md0 /raid ext3 defaults 0 0" >> /etc/fstab jumbo# mount -avYou can doublecheck the results with df. You now have a 3.5 GB partition put together by three 1.5 GB partitions in a RAID 5 setup. |