GIT – Instructions for switching to 1 for 6.0 with GPT , with 2 HDD 1TB

Check /dev/sda partition table

# 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 1953525134 923.5 GiB 8E00

Check /dev/sdb partition table

# gdisk -l /dev/sdb

Create RAID partitions on /dev/sdb

# gdisk /dev/sdb

Replicate the partition table sectors. Choose fd00 as code for partition type.

The result should look something like this:

Number Start (sector) End (sector) Size Code Name
1 2048 8388641 4.0 GiB FD00 RAID
2 8390656 16777249 4.0 GiB FD00 Linux RAID
3 16779264 1953525134 923.5 GiB FD00 Linux RAID

Create MD devices

# 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

Copy Store Manager Data to RAID

# pvcreate /dev/md2
# vgextend VG_XenStorage-97a6bfb2-30bf-6398-8ae7-a1567623eb95 /dev/md2
# pvmove /dev/sda3 /dev/md2

Remove /dev/sda3 from the SR volume group

# vgreduce VG_XenStorage-97a6bfb2-30bf-6398-8ae7-a1567623eb95 /dev/sda3
# pvremove /dev/sda3

Mount /dev/md0 and copy the filesystem to it

# mkfs.ext3 /dev/md0
# mount /dev/md0 /mnt
# cd /
# cp -axv . /mnt

Modify /mnt/etc/fstab and change the root= parameter to /dev/md0. (Do NOT include the LABEL=)
Create a new boot image and uncompress it:

# 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

Edit ‘init’ and insert the below test after ‘raidautorun /dev/md0‘:

raidautorun /dev/md1
raidautorun /dev/md2

Copy the new ramdisk to the /mnt/boot folder and modify boot menu

# find . -print | cpio -o -Hnewc | gzip -c > /mnt/boot/initrd-`uname -r`-raid.img
# rm /mnt/boot/initrd-2.6-xen.img
rm: remove symbolic link `/mnt/boot/initrd-2.6-xen.img’? y
# ln -s initrd-`uname -r`-raid.img /mnt/boot/initrd-2.6-xen.img
# vi /mnt/boot/extlinux.conf

Replace “root=LABEL=root-xyz” by “root=/dev/md0” in all menu entries.
Set up MBR for GPT on /dev/sdb

# cat /mnt/usr/share/syslinux/gptmbr.bin > /dev/sdb
# cd /mnt
# extlinux –raid -i boot/

Unmount /dev/md0

# cd
# umount /dev/md0
# sync

Make sure the bootable flag is set on the partitions

# sgdisk /dev/sda –attributes=1:set:2
# sgdisk /dev/sdb –attributes=1:set:2

Reboot (IMPORTANT: Set your server to boot from the SECONDARY HDD before booting!)

# reboot

After the reboot is (hopefully) complete, it’s time to switch /dev/sda’s partitions to RAID

# gdisk /dev/sda
Press ‘t’ select partition number and type in fd00.
Repeat for all your partitions. Then ‘w’ to write changes.
Your partition table should look something like this:

(…)
Number Start (sector) End (sector) Size Code Name
1 2048 8388641 4.0 GiB FD00
2 8390656 16777249 4.0 GiB FD00
3 16779264 1953525134 923.5 GiB FD00

You are now ready to add these partitions into the RAID arrays

# mdadm -a /dev/md0 /dev/sda1
mdadm: added /dev/sda1
# mdadm -a /dev/md1 /dev/sda2
mdadm: added /dev/sda2
# mdadm -a /dev/md2 /dev/sda3
mdadm: added /dev/sda3

To check how the RAID sync is going look at:

# cat /proc/mdstat

When it’s done on all three arrays, copy the RAID setup to /etc/mdadm.conf

# mdadm –detail –scan >> /etc/mdadm.conf

You should now have a fully functional RAID 1 XenServer 6.0 Setup!

Print Friendly

Comments

comments

Bài viết liên quan