Last active
December 27, 2015 18:49
-
-
Save emyl/7372285 to your computer and use it in GitHub Desktop.
RAID setup for Citrix Xenserver 6.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "o | |
| Y | |
| n | |
| 1 | |
| 2048 | |
| 8388641 | |
| FD00 | |
| n | |
| 2 | |
| 8390656 | |
| 16777249 | |
| FD00 | |
| n | |
| 3 | |
| 16779264 | |
| 488397134 | |
| FD00 | |
| w | |
| Y | |
| " | gdisk /dev/sdb | |
| reboot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| VG=`basename /dev/mapper/VG_XenStorage*` | |
| VG=${VG:0:${#VG}-4} | |
| VG=${VG//--/-} | |
| mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 missing | |
| mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb2 missing | |
| mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sdb3 missing | |
| pvcreate -ff /dev/md2 | |
| vgextend $VG /dev/md2 | |
| pvmove /dev/sda3 /dev/md2 | |
| vgreduce $VG /dev/sda3 | |
| pvremove /dev/sda3 | |
| umount /mnt | |
| mkfs.ext3 /dev/md0 | |
| mount /dev/md0 /mnt | |
| cd / | |
| cp -ax . /mnt | |
| sed -i '1 s/^LABEL.*\//\/dev\/md0 \//' /mnt/etc/fstab | |
| mkdir /mnt/root/initrd-raid | |
| mkinitrd -v --fstab=/mnt/etc/fstab /mnt/root/initrd-raid/initrd-`uname -r`-raid.img `uname -r` | |
| cd /mnt/root/initrd-raid | |
| zcat initrd-`uname -r`-raid.img | cpio -i | |
| sed -i '/raidautorun \/dev\/md0/ a\ | |
| raidautorun /dev/md1' /mnt/root/initrd-raid/init | |
| sed -i '/raidautorun \/dev\/md1/ a\ | |
| raidautorun /dev/md2' /mnt/root/initrd-raid/init | |
| find . -print | cpio -o -Hnewc | gzip -c > /mnt/boot/initrd-`uname -r`-raid.img | |
| rm -f /mnt/boot/initrd-2.6-xen.img | |
| ln -s initrd-`uname -r`-raid.img /mnt/boot/initrd-2.6-xen.img | |
| sed -i 's/root=[^ ]*/root=\/dev\/md0/g' /mnt/boot/extlinux.conf | |
| cat /mnt/usr/share/syslinux/gptmbr.bin > /dev/sdb | |
| cd /mnt | |
| extlinux --raid -i boot/ | |
| cd | |
| umount /dev/md0 | |
| sync | |
| sgdisk /dev/sda --attributes=1:set:2 | |
| sgdisk /dev/sdb --attributes=1:set:2 | |
| echo "" | |
| echo "IMPORTANTE!!" | |
| echo "Al momento del riavvio, impostare sul BIOS il disco secondario come disco di boot." | |
| read -p "Premere [Invio] per riavviare..." | |
| reboot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "t | |
| 1 | |
| FD00 | |
| t | |
| 2 | |
| FD00 | |
| t | |
| 3 | |
| FD00 | |
| w | |
| Y | |
| " | gdisk /dev/sda | |
| sleep 5 | |
| mdadm -a /dev/md0 /dev/sda1 | |
| mdadm -a /dev/md1 /dev/sda2 | |
| mdadm -a /dev/md2 /dev/sda3 | |
| echo "FINISHED! Check out /proc/mdstat for RAID sync status!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment