Skip to content

Instantly share code, notes, and snippets.

@efmde
Created September 10, 2015 08:43
Show Gist options
  • Save efmde/230e61d9aa1c8931da81 to your computer and use it in GitHub Desktop.
Save efmde/230e61d9aa1c8931da81 to your computer and use it in GitHub Desktop.
Install XenServer 6.5 on softraid

Install XenServer 6.5 on softraid

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

Turn on raid support##

  • 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.

Preparing the disks##

  • 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

Preparing system and make raid##

  • 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/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment