SHOW:
|
|
- or go back to the newest paste.
1 | - | Instructions for switching to RAID 1 for XenServer 6.0 with GPT |
1 | + | Instructions for switching to RAID 1 for XenServer 6.1 with GPT |
2 | --------------------------------------------------------------- | |
3 | ||
4 | Check /dev/sda partition table | |
5 | # gdisk -l /dev/sda | |
6 | (...) | |
7 | Number Start (sector) End (sector) Size Code Name | |
8 | 1 2048 8388641 4.0 GiB 0700 | |
9 | 2 8390656 16777249 4.0 GiB 0700 | |
10 | 3 16779264 1953525134 923.5 GiB 8E00 | |
11 | ||
12 | ||
13 | Check /dev/sdb partition table | |
14 | # gdisk -l /dev/sdb | |
15 | ||
16 | ||
17 | Create RAID partitions on /dev/sdb | |
18 | # gdisk /dev/sdb | |
19 | ||
20 | ||
21 | Replicate the partition table sectors. Choose fd00 as code for partition type. | |
22 | ||
23 | The result should look something like this: | |
24 | Number Start (sector) End (sector) Size Code Name | |
25 | 1 2048 8388641 4.0 GiB FD00 Linux RAID | |
26 | 2 8390656 16777249 4.0 GiB FD00 Linux RAID | |
27 | 3 16779264 1953525134 923.5 GiB FD00 Linux RAID | |
28 | ||
29 | ||
30 | Create MD devices | |
31 | # mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 missing | |
32 | # mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb2 missing | |
33 | # mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sdb3 missing | |
34 | ||
35 | ||
36 | Copy Store Manager Data to RAID | |
37 | # pvcreate /dev/md2 | |
38 | # vgextend VG_<TAB> /dev/md2 | |
39 | # pvmove /dev/sda3 /dev/md2 | |
40 | ||
41 | ||
42 | Remove /dev/sda3 from the SR volume group | |
43 | # vgreduce VG_<TAB> /dev/sda3 | |
44 | # pvremove /dev/sda3 | |
45 | ||
46 | ||
47 | Mount /dev/md0 and copy the filesystem to it | |
48 | # mkfs.ext3 /dev/md0 | |
49 | # mount /dev/md0 /mnt | |
50 | # cd / | |
51 | # cp -axv . /mnt | |
52 | ||
53 | ||
54 | Modify /mnt/etc/fstab and change the root= parameter to /dev/md0. (Do NOT include the LABEL=) | |
55 | ||
56 | ||
57 | Create a new boot image and uncompress it: | |
58 | # mkdir /mnt/root/initrd-raid | |
59 | # mkinitrd -v --fstab=/mnt/etc/fstab /mnt/root/initrd-raid/initrd-`uname -r`-raid.img `uname -r` | |
60 | # cd /mnt/root/initrd-raid | |
61 | # zcat initrd-`uname -r`-raid.img | cpio -i | |
62 | ||
63 | ||
64 | Edit 'init' and insert the below test after 'raidautorun /dev/md0': | |
65 | raidautorun /dev/md1 | |
66 | raidautorun /dev/md2 | |
67 | ||
68 | ||
69 | Copy the new ramdisk to the /mnt/boot folder and modify boot menu | |
70 | # find . -print | cpio -o -Hnewc | gzip -c > /mnt/boot/initrd-`uname -r`-raid.img | |
71 | # rm /mnt/boot/initrd-2.6-xen.img | |
72 | rm: remove symbolic link `/mnt/boot/initrd-2.6-xen.img’? y | |
73 | # ln -s initrd-`uname -r`-raid.img /mnt/boot/initrd-2.6-xen.img | |
74 | # vi /mnt/boot/extlinux.conf | |
75 | Replace "root=LABEL=root-xyz" by "root=/dev/md0" in all menu entries. | |
76 | ||
77 | ||
78 | Set up MBR for GPT on /dev/sdb | |
79 | # cat /mnt/usr/share/syslinux/gptmbr.bin > /dev/sdb | |
80 | # cd /mnt | |
81 | # extlinux --raid -i boot/ | |
82 | ||
83 | ||
84 | Unmount /dev/md0 | |
85 | # cd | |
86 | # umount /dev/md0 | |
87 | # sync | |
88 | ||
89 | ||
90 | Make sure the bootable flag is set on the partitions | |
91 | # sgdisk /dev/sda --attributes=1:set:2 | |
92 | # sgdisk /dev/sdb --attributes=1:set:2 | |
93 | ||
94 | ||
95 | Reboot (IMPORTANT: Set your server to boot from the SECONDARY HDD before booting!) | |
96 | # reboot | |
97 | ||
98 | ||
99 | After the reboot is (hopefully) complete, it's time to switch /dev/sda's partitions to RAID | |
100 | # gdisk /dev/sda | |
101 | Press 't' select partition number and type in fd00. | |
102 | Repeat for all your partitions. Then 'w' to write changes. | |
103 | Your partition table should look something like this: | |
104 | ||
105 | (...) | |
106 | Number Start (sector) End (sector) Size Code Name | |
107 | 1 2048 8388641 4.0 GiB FD00 | |
108 | 2 8390656 16777249 4.0 GiB FD00 | |
109 | 3 16779264 1953525134 923.5 GiB FD00 | |
110 | ||
111 | ||
112 | You are now ready to add these partitions into the RAID arrays | |
113 | # mdadm -a /dev/md0 /dev/sda1 | |
114 | mdadm: added /dev/sda1 | |
115 | # mdadm -a /dev/md1 /dev/sda2 | |
116 | mdadm: added /dev/sda2 | |
117 | # mdadm -a /dev/md2 /dev/sda3 | |
118 | mdadm: added /dev/sda3 | |
119 | ||
120 | ||
121 | To check how the RAID sync is going look at: | |
122 | # cat /proc/mdstat | |
123 | ||
124 | ||
125 | When it's done on all three arrays, copy the RAID setup to /etc/mdadm.conf | |
126 | # mdadm --detail --scan >> /etc/mdadm.conf | |
127 | ||
128 | Finally restore the Volume Group | |
129 | - | You should now have a fully functional RAID 1 XenServer 6.0 Setup! |
129 | + | # cd /etc/lvm/backup |
130 | - | |
130 | + | # vgcfgrestore --file VG_<TAB> VG_<TAB> |
131 | ||
132 | You should now have a fully functional RAID 1 XenServer 6.1 Setup! |