#!/bin/sh

# Make some blank files for the physical devices
/bin/dd if=/dev/zero of=loop0.img bs=1M count=256
/bin/dd if=/dev/zero of=loop1.img bs=1M count=256
/bin/dd if=/dev/zero of=loop2.img bs=1M count=256
/bin/dd if=/dev/zero of=loop3.img bs=1M count=256
/bin/dd if=/dev/zero of=loop4.img bs=1M count=256

# You'll need loopback capabilities in the kernel
/sbin/modprobe loop

# Associate the loopback devices with the files
/sbin/losetup /dev/loop0 loop0.img
/sbin/losetup /dev/loop1 loop1.img
/sbin/losetup /dev/loop2 loop2.img
/sbin/losetup /dev/loop3 loop3.img
/sbin/losetup /dev/loop4 loop3.img

# Create the array on the files via the loopback devices
/sbin/mdadm -C /dev/md0 -l 5 -n 5 /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4

# You'll need ext3
/sbin/modprobe ext3

# Format/Label the raid array
/sbin/mke2fs -cj -i 1024 -L MyRaid   /dev/md0



