Warning! From default installation of XenServer 6.5 modules of raid, nfs and etc in kernel disabled. "Thanks for developers." In this variation: XenServer 6.5 withoud patches and service packs, kernel 3.10.0+2, 2 disks WD 2 TB
- Make module file (change raidX for you raid level):
# echo "modprobe raid1" > /etc/sysconfig/modules/raid.modules
# chmod +x /etc/sysconfig/modules/raid.modules
- Reboot your server.
- Start installation of XenServer.
- During install, don't create storage repository!
- Look for your partition table of bootable disk:
# gdisk -l /dev/sda
...
Number Start (sector) End (sector) Size Code Name
1 2048 8388641 4.0 GiB 0700
2 8390656 16777249 4.0 GiB 0700
3 16779264 3907029134 1.8 TiB 8E00
- Clone partition table from first disk to second:
# sgdisk -R=/dev/sda /dev/sdb
- Randomize GUID on second disk:
# sgdisk -G /dev/sda
- Change code for all future raid partitions to FD00:
# sgdisk --typecode=1:fd00 /dev/sdb
# sgdisk --typecode=2:fd00 /dev/sdb
# sgdisk --typecode=3:fd00 /dev/sdb
- Change bootable flag for all future raid partitions:
# sgdisk /dev/sda --attributes=1:set:2
# sgdisk /dev/sdb --attributes=1:set:2
# sgdisk /dev/sdc --attributes=1:set:2
- Create raid devices with missing drive.
# mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb1
# mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb2
# mdadm --create /dev/md2 --level=1 --raid-devices=2 missing /dev/sdb3
- Make fs on system raid device and mount:
# mkfs.ext3 /dev/md0
# mount /dev/md0 /mnt
- Copy out system to raid device:
# cp -vxpR / /mnt
- Mount system dirs and go to chroot:
mount --bind /dev /mnt/dev
mount -t sysfs none /mnt/sys
mount -t proc none /mnt/proc
chroot /mnt
- Change boot device in fstab:
sed -i 's/LABEL=[a-zA-Z\-]*/\/dev\/md0/' /etc/fstab
Also you can edit file in text editor: Change "LABEL=*******" or "/dev/sdx1**" to "/dev/md0"
- Now create and uncompress initrd with raid support:
# mkdir /boot/raid_initrd
# mkinitrd -v --fstab=/mnt/etc/fstab /boot/raid_initrd/initrd-`uname -r`-raid.img `uname -r`
# cd /boot/raid_initrd
# zcat initrd-`uname -r`-raid.img | cpio -i
# sed -i 's/raidautorun \/dev\/md0/raidautorun \/dev\/md0\nraidautorun \/dev\/md1\nraidautorun \/dev\/md2/' init
# rm -f initrd-`uname -r`-raid.img
- Compress and copy initrd with raid support to boot folder and replace symlink:
# find . -print | cpio -o -Hnewc | gzip -c > /boot/initrd-`uname -r`-raid.img
# rm -f /boot/initrd-3.10-xen.img
# ln -s initrd-`uname -r`-raid.img /boot/initrd-3.10-xen.img
# sed -i 's/LABEL=[a-zA-Z\-]*/\/dev\/md0/' extlinux.conf
- Write MBR to second disk:
# cat /usr/share/syslinux/gptmbr.bin > /dev/sdb
# extlinux --raid -i boot/