Autor Tópico: Raid 1 no Xen Server 6.0  (Lida 117 vezes)

0 Membros e 1 Visitante estão vendo este tópico.

Offline Rodrigo Soares

  • Administrator
  • Jr. Member
  • *****
  • Mensagens: 55
  • Você curtiu? +1/-0
  • Sexo: Masculino
  • Não critique seus adversários, faça melhor!
    • Ver Perfil
    • IPManager
  • Cidade: Varginha
  • Profissão: Diretor IpHosting
  • UF: MG
Raid 1 no Xen Server 6.0
« Online: Fevereiro 19, 2012, 05:30:32 pm »
Detalhe Importante,  Isso aqui não é uma receita de bolo, você deve ter noção do que está fazendo, pois em muitos casos vai ter que improvisar,  na primeira vez eu fiz várias vezes o processo, a segunda vez tive que mudar algumas coisas, mas a referência é boa...


I assume you have installed XenServer on /dev/sda and have NOT configure any local storage (it is easier to do that afterwards). /dev/sda should contain three partitions, verify this with:

Código: You are not allowed to view links. Register or Login
sgdisk -p /dev/sda (Preste atenção no resultado deste comando, você vai usar ele abaixo)

What the second partition is for i am not sure. The second partition is used for backups during a XenServer upgrade. Now we are going to use /dev/sdb as the mirror disk. First clear the partition table.

Código: You are not allowed to view links. Register or Login
sgdisk --zap-all /dev/sdb
Now install a GPT table on it

Código: You are not allowed to view links. Register or Login
sgdisk --mbrtogpt --clear /dev/sdb
The following commands are dependent on your installation. Copy the start and end sectors from /dev/sda.

(você vai alterar conforme mostrou o comando que mandei prestar atenção)

Código: You are not allowed to view links. Register or Login
sgdisk --new=1:2048:8388641 /dev/sdb
Código: You are not allowed to view links. Register or Login
sgdisk --typecode=1:fd00 /dev/sdb
Código: You are not allowed to view links. Register or Login
sgdisk --attributes=1:set:2 /dev/sdb
Código: You are not allowed to view links. Register or Login
sgdisk --new=2:8390656:16777249 /dev/sdb
Código: You are not allowed to view links. Register or Login
sgdisk --typecode=2:fd00 /dev/sdb
Código: You are not allowed to view links. Register or Login
sgdisk --new=3:16779264:976773134/dev/sdb
Código: You are not allowed to view links. Register or Login
sgdisk --typecode=3:fd00 /dev/sdb
Ignore sgdisk complaining about the sector addresses not being aligned. It will correct it automatically. Do pay attention if sgdisk says the kernel is still using the old partition table. You need to reboot if that is the case.

Now it is time to create the software RAID devices.

(antes de criar, apague se existir:  rm -rf /dev/md0 md1 md2, caso exista o array apague ele:
Código: You are not allowed to view links. Register or Login
mdadm --stop /dev/md0  # to halt the array
Código: You are not allowed to view links. Register or Login
mdadm --remove /dev/md0  # to remove the array)
Faça o mesmo para /dev/md1 e 2, conforme necessidade

Código: You are not allowed to view links. Register or Login
mknod /dev/md0 b 9 0
Código: You are not allowed to view links. Register or Login
mknod /dev/md1 b 9 1
Código: You are not allowed to view links. Register or Login
mknod /dev/md2 b 9 2
Código: You are not allowed to view links. Register or Login
mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb1
Código: You are not allowed to view links. Register or Login
mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb2
Código: You are not allowed to view links. Register or Login
mdadm --create /dev/md2 --level=1 --raid-devices=2 missing /dev/sdb3
Create bitmaps for each RAID device (see Criggie’s comment below). Bitmaps slightly impact throughput but significantly reduce the rebuilt time when the array fails.

Código: You are not allowed to view links. Register or Login
mdadm --grow /dev/md0 -b internal
Código: You are not allowed to view links. Register or Login
mdadm --grow /dev/md1 -b internal
Código: You are not allowed to view links. Register or Login
mdadm --grow /dev/md2 -b internal
Format  the root disk and mount it at /mnt.

Código: You are not allowed to view links. Register or Login
mkfs.ext3 /dev/md0
Código: You are not allowed to view links. Register or Login
mount /dev/md0 /mnt
Copy the root filesystem to the RAID array.

Código: You are not allowed to view links. Register or Login
cp -vxpR / /mnt
Change the root filesystem in /mnt/etc/fstab to /dev/md0.
edit /mnt/boot/extlinux.conf and replace every mention of the old root filesystem (root=LABEL=xxx) with root=/dev/md0.

Install the bootloader on the second hard disk.

Código: You are not allowed to view links. Register or Login
mount --bind /dev /mnt/dev
Código: You are not allowed to view links. Register or Login
mount -t sysfs none /mnt/sys
Código: You are not allowed to view links. Register or Login
mount -t proc none /mnt/proc
Código: You are not allowed to view links. Register or Login
chroot /mnt /sbin/extlinux --install /boot
Código: You are not allowed to view links. Register or Login
dd if=/mnt/usr/share/syslinux/gptmbr.bin of=/dev/sdb
Make a new initrd image which contains a driver for the new root filesystem on the software RAID array.

Código: You are not allowed to view links. Register or Login
chroot /mnt
Código: You are not allowed to view links. Register or Login
mkinitrd -v -f --theme=/usr/share/splash --without-multipath /boot/initrd-`uname -r`.img `uname -r`
Onde esta escrito uname -r, você vai colocar o resultado desde comando do seu sitema, a primeira vez eu coloquei isso ae, deu pau hahahha

Agora como fala o comando abaixo, você tem que carregar o segundo disco para executar os comandos:

Unmount the new root and reboot. Remember to use the boot menu of your BIOS to boot from the second hard disk this time! When XenServer is up again, include /dev/sda in the array with the following commands:

Código: You are not allowed to view links. Register or Login
sgdisk --typecode=1:fd00 /dev/sda
Código: You are not allowed to view links. Register or Login
sgdisk --typecode=2:fd00 /dev/sda
Código: You are not allowed to view links. Register or Login
sgdisk --typecode=3:fd00 /dev/sda
Código: You are not allowed to view links. Register or Login
mdadm -a /dev/md0 /dev/sda1
Código: You are not allowed to view links. Register or Login
mdadm -a /dev/md1 /dev/sda2
(lembro que nessa parte voce tem que remover o local storage do xen para funcionar, vou tentar editar depois)

Código: You are not allowed to view links. Register or Login
mdadm -a /dev/md2 /dev/sda3
Depois você usa o comando:

Código: You are not allowed to view links. Register or Login
xe sr-param-list uuid=e7fe2795-2e29-3f6b-9195-3471627cca78 (uuid do local storage, so da propriedades)
Código: You are not allowed to view links. Register or Login
xe pbd-unplug  uuid=b5e62814-d0c8-8971-f645-be6e5ec4cab5
Código: You are not allowed to view links. Register or Login
xe sr-forget uuid=b5e62814-d0c8-8971-f645-be6e5ec4cab5
==== Reinicie e de o comando abaixo mudando para o uuid respectivo: xe host-list

Código: You are not allowed to view links. Register or Login
xe sr-create host-uuid=78b6ff64-5d9f-4c0f-9e94-ee3ce04a6101 content-type=user type=lvm device-config:device=/dev/sdb shared=false name-label="Local storage 2"
The array needs to complete its initial build/synchronisation. That is gonna take a while. Follow its progress with:

Código: You are not allowed to view links. Register or Login
watch -n 1 cat /proc/mdstat
At last add /dev/md2 as a local SR to XenServer.

Good luck with it.
« Última modificação: Março 15, 2012, 10:56:54 am por Rodrigo Soares »

Tags: