Commit b6a5c21f authored by Helen Koike's avatar Helen Koike

wip: raid 5/6

parent 8316144c
......@@ -28,12 +28,13 @@ fill_rootfs()
sudo chmod +x dm-mount/bin/init.sh
}
create_raid4()
create_raid()
{
# Create disk
DISK=$1
PREFIX=$2
DM_DEV=dm-raid4
TYPE=${3-raid4}
DM_DEV=dm-raid
if [ -f $DISK -a -f ${DISK}.info ]; then
echo "$DISK already exist, not creating it"
return
......@@ -55,9 +56,11 @@ create_raid4()
sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p2) + $sectors))
sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p3) + $sectors))
if [ "$TYPE" != "raid6_zr" ]; then
sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p3) + $sectors))
fi
table="0 $sectors raid raid4 3 64 region_size 1024 4 - ${LOOP_DEV}p1 - ${LOOP_DEV}p2 - ${LOOP_DEV}p3 - ${LOOP_DEV}p4"
table="0 $sectors raid ${TYPE} 3 64 region_size 1024 4 - ${LOOP_DEV}p1 - ${LOOP_DEV}p2 - ${LOOP_DEV}p3 - ${LOOP_DEV}p4"
echo "$table"
echo "$table" | sudo dmsetup create $DM_DEV
......@@ -69,11 +72,11 @@ create_raid4()
sudo dmsetup table --concise /dev/mapper/$DM_DEV
# Format
sudo mkfs.ext4 -L ROOT-RAID4 /dev/mapper/$DM_DEV
sudo mkfs.ext4 -L ROOT-RAID /dev/mapper/$DM_DEV
mkdir -p dm-mount
sudo mount /dev/mapper/$DM_DEV dm-mount
fill_rootfs "raid4 disk $DISK"
fill_rootfs "raid disk $DISK"
# Umount disk/dm/loopback
sudo umount dm-mount
......@@ -551,14 +554,36 @@ launch_test \
"raid4: with minor" \
"-hda ${DR41}" \
/dev/dm-4 \
"dm-crypt,,4,ro,0 $DR41_sectors raid raid4 3 64 region_size 1024 4 - 8:1 - 8:2 - 8:3 - 8:4"
"dm-raid,,4,ro,0 $DR41_sectors raid raid4 3 64 region_size 1024 4 - 8:1 - 8:2 - 8:3 - 8:4"
launch_test \
"raid5: no minor" \
"-hda ${DR51}" \
/dev/dm-0 \
"dm-raid,,,ro,0 $DR51_sectors raid raid5_ls 3 64 region_size 1024 4 - 8:1 - 8:2 - 8:3 - 8:4"
launch_test \
"raid6: no minor" \
"-hda ${DR61}" \
/dev/dm-0 \
"dm-raid,,,ro,0 $DR61_sectors raid raid6_zr 3 64 region_size 1024 4 - 8:1 - 8:2 - 8:3 - 8:4"
}
DR41=disk-raid4-1.img
create_raid4 $DR41 DR41_
create_raid $DR41 DR41_ raid4
# Load disk info
source ${DR41}.info
DR51=disk-raid5-1.img
create_raid $DR51 DR51_ raid5_ls
# Load disk info
source ${DR51}.info
DR61=disk-raid6-1.img
create_raid $DR61 DR61_ raid6_zr
# Load disk info
source ${DR61}.info
DS1=disk-striped-1.img
create_striped $DS1 DS1_
# Load disk info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment