Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Istruzioni per il passaggio a RAID 1 su un server XenServer 6.1 con GPT
- # -----------------------------------------------------------------------
- # STEP 1. Verifica della partition table del disco
- # dove e' installato XenServer (generalmente /dev/sda)
- 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 488397134 224.9 GiB 8E00
- # STEP 2. Verifica della partition table dell'altro disco
- # (/dev/sdb)
- gdisk -l /dev/sdb
- # ***************************************************************
- # Found invalid GPT and valid MBR; converting MBR to GPT format.
- # ***************************************************************
- # Disk /dev/sdb: 488397168 sectors, 232.9 GiB
- # Logical sector size: 512 bytes
- # Disk identifier (GUID): 87B782BD-288B-4C78-8458-DD24DDBC41A0
- # Partition table holds up to 128 entries
- # First usable sector is 34, last usable sector is 488397134
- # Partitions will be aligned on 2048-sector boundaries
- # Total free space is 10541 sectors (5.1 MiB)
- # Number Start (sector) End (sector) Size Code Name
- # 1 2048 206847 100.0 MiB 0700 Linux/Windows data
- # 2 206848 470616063 224.3 GiB 0700 Linux/Windows data
- # 3 470616064 488388607 8.5 GiB 0700 Linux/Windows data
- # STEP 3. Creazione partizioni RAID su /dev/sdb
- gdisk /dev/sdb
- # GPT fdisk (gdisk) version 0.6.10
- # Partition table scan:
- # MBR: MBR only
- # BSD: not present
- # APM: not present
- # GPT: not present
- # ***************************************************************
- # Found invalid GPT and valid MBR; converting MBR to GPT format.
- # THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
- # you don't want to convert your MBR partitions to GPT format!
- # ***************************************************************
- # Command (? for help): ?
- # b back up GPT data to a file
- # c change a partition's name
- # d delete a partition
- # i show detailed information on a partition
- # l list known partition types
- # n add a new partition
- # o create a new empty GUID partition table (GPT)
- # p print the partition table
- # q quit without saving changes
- # r recovery and transformation options (experts only)
- # s sort partitions
- # t change a partition's type code
- # v verify disk
- # w write table to disk and exit
- # x extra functionality (experts only)
- # ? print this menu
- # STEP 3/1. Eliminazione delle partizioni esistenti
- Command (? for help): d
- Partition number (1-3): 1
- Command (? for help): d
- Partition number (2-3): 2
- Command (? for help): d
- Using 3
- Command (? for help): p
- # Disk /dev/sdb: 488397168 sectors, 232.9 GiB
- # Logical sector size: 512 bytes
- # Disk identifier (GUID): 0F0F7742-7696-41A6-8733-219F8F5790AB
- # Partition table holds up to 128 entries
- # First usable sector is 34, last usable sector is 488397134
- # Partitions will be aligned on 2048-sector boundaries
- # Total free space is 488397101 sectors (232.9 GiB)
- # Number Start (sector) End (sector) Size Code Name
- # STEP 3/2. Creazione delle partizioni come /dev/sda, di tipo FD00 (Linux RAID)
- Command (? for help): n
- Partition number (1-128, default 1): 1
- First sector (34-488397134, default = 34) or {+-}size{KMGT}: 2048
- Last sector (2048-488397134, default = 488397134) or {+-}size{KMGT}: 8388641
- Current type is 'Linux/Windows data'
- Hex code (L to show codes, 0 to enter raw code, Enter = 0700): FD00
- Changed type of partition to 'Linux RAID'
- Command (? for help): n
- Partition number (2-128, default 2): 2
- First sector (34-488397134, default = 8388642) or {+-}size{KMGT}: 8390656
- Last sector (8390656-488397134, default = 488397134) or {+-}size{KMGT}: 16777249
- Current type is 'Linux/Windows data'
- Hex code (L to show codes, 0 to enter raw code, Enter = 0700): FD00
- Changed type of partition to 'Linux RAID'
- Command (? for help): n
- Partition number (3-128, default 3): 3
- First sector (34-488397134, default = 16777250) or {+-}size{KMGT}: 16779264
- Last sector (16779264-488397134, default = 488397134) or {+-}size{KMGT}: 488397134
- Current type is 'Linux/Windows data'
- Hex code (L to show codes, 0 to enter raw code, Enter = 0700): FD00
- Changed type of partition to 'Linux RAID'
- Command (? for help): p
- # Disk /dev/sdb: 488397168 sectors, 232.9 GiB
- # Logical sector size: 512 bytes
- # Disk identifier (GUID): 0F0F7742-7696-41A6-8733-219F8F5790AB
- # Partition table holds up to 128 entries
- # First usable sector is 34, last usable sector is 488397134
- # Partitions will be aligned on 2048-sector boundaries
- # Total free space is 6042 sectors (3.0 MiB)
- # Number Start (sector) End (sector) Size Code Name
- # 1 2048 8388641 4.0 GiB FD00 Linux RAID
- # 2 8390656 16777249 4.0 GiB FD00 Linux RAID
- # 3 16779264 488397134 224.9 GiB FD00 Linux RAID
- # STEP 3/3. Scrittura della tabella delle partizioni su disco (ATTENZIONE!)
- Command (? for help): w
- Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
- PARTITIONS!!
- Do you want to proceed, possibly destroying your data? (Y/N): Y
- OK; writing new GUID partition table (GPT).
- # The operation has completed successfully.
- # STEP 4. Riavvio del server
- reboot
- # STEP 5. Creazione driver MD (multiple devices, in pratica sono i driver di Linux per il RAID software)
- mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 missing
- # mdadm: array /dev/md0 started.
- mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb2 missing
- # mdadm: array /dev/md1 started.
- mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sdb3 missing
- # mdadm: array /dev/md2 started.
- # STEP 6. Spostamento della partizione dedicata alle macchine virtuali sul volume RAID
- # NOTA: il nome del Volume Group e' casuale, viene indicato come VG_<TAB> dal momento che il tasto TAB
- # puo' essere utilizzato per espandere il nome automaticamente.
- pvcreate /dev/md2
- # Physical volume "/dev/md2" successfully created
- vgextend VG_<TAB> /dev/md2
- # Volume group "VG_XenStorage-a387dae6-291d-34d3-dd74-7e35ad937048" successfully extended
- pvmove /dev/sda3 /dev/md2
- # /dev/sda3: Moved: 0.0%
- # /dev/sda3: Moved: 2.3%
- # /dev/sda3: Moved: 4.5%
- # ...
- # /dev/sda3: Moved: 96.8%
- # /dev/sda3: Moved: 98.6%
- # /dev/sda3: Moved: 100.0%
- # STEP 7. Rimozione della vecchia partizione dal Volume Group
- vgreduce VG_<TAB> /dev/sda3
- # Removed "/dev/sda3" from volume group "VG_XenStorage-a387dae6-291d-34d3-dd74-7e35ad937048"
- pvremove /dev/sda3
- # Labels on physical volume "/dev/sda3" successfully wiped
- # STEP 8. Formattazione di /dev/md0 e copia del sistema operativo su di esso
- mkfs.ext3 /dev/md0
- # mke2fs 1.39 (29-May-2006)
- # Filesystem label=
- # OS type: Linux
- # Block size=4096 (log=2)
- # Fragment size=4096 (log=2)
- # 524288 inodes, 1048304 blocks
- # 52415 blocks (5.00%) reserved for the super user
- # First data block=0
- # Maximum filesystem blocks=1073741824
- # 32 block groups
- # 32768 blocks per group, 32768 fragments per group
- # 16384 inodes per group
- # Superblock backups stored on blocks:
- # 32768, 98304, 163840, 229376, 294912, 819200, 884736
- # Writing inode tables: done
- # Creating journal (16384 blocks): done
- # Writing superblocks and filesystem accounting information: done
- # This filesystem will be automatically checked every 34 mounts or
- # 180 days, whichever comes first. Use tune2fs -c or -i to override.
- mount /dev/md0 /mnt
- cd /
- cp -axv . /mnt
- # ...
- # `./cli-rt/gtserver/gtmessages.ml' -> `/mnt/./cli-rt/gtserver/gtmessages.ml'
- # `./cli-rt/gtserver/gtserver_linux.ml' -> `/mnt/./cli-rt/gtserver/gtserver_linux.ml'
- # `./media' -> `/mnt/./media'
- # STEP 9. Modifica del file /mnt/etc/fstab
- # Nella prima colonna dell prima riga e' necessario inserire il valore /dev/md0
- nano /mnt/etc/fstab
- # PRIMA DELLE MODIFICHE:
- # LABEL=root-slwymfnm / ext3 defaults 1 1
- # DOPO LE MODIFICHE:
- # /dev/md0 / ext3 defaults 1 1
- #
- # Il salvataggio si effettua con CTRL + Lettera O + Invio. Per uscire da nano invece si usa CTRL + X.
- # STEP 10. Creazione di una nuova immagine di boot e relativo scompattamento
- mkdir /mnt/root/initrd-raid
- mkinitrd -v --fstab=/mnt/etc/fstab /mnt/root/initrd-raid/initrd-`uname -r`-raid.img `uname -r`
- # Creating initramfs
- # Modulefile is /etc/modprobe.conf
- # Looking for deps of module ehci-hcd: usbcore
- # ...
- # Adding module dm-mirror
- # Adding module dm-zero
- # Adding module dm-snapshot
- cd /mnt/root/initrd-raid
- zcat initrd-`uname -r`-raid.img | cpio -i
- # 14097 blocks
- # STEP 11. Modifica del file init
- # E' necessario cercare la riga che contiene il testo:
- # raidautorun /dev/md2
- # ed inserire nelle due righe superiori il testo
- # raidautorun /dev/md0
- # raidautorun /dev/md1
- nano init
- # Per salvare e uscire vedere step 9
- # STEP 12. Copia del nuovo ramdisk e modifica del menu di boot
- find . -print | cpio -o -Hnewc | gzip -c > /mnt/boot/initrd-`uname -r`-raid.img
- # 20401 blocks
- 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
- nano /mnt/boot/extlinux.conf
- # Modificare tutte le voci "root=LABEL=root-xyz" con "root=/dev/md0".
- # Per salvare e uscire vedere step 9
- # STEP 13. Impostazione MBR su /dev/sdb
- cat /mnt/usr/share/syslinux/gptmbr.bin > /dev/sdb
- cd /mnt
- extlinux --raid -i boot/
- # boot/ is device /dev/md0
- # STEP 14. Unmount di /dev/md0
- cd
- umount /dev/md0
- sync
- # STEP 15. Impostazione del flag di boot sui dischi
- sgdisk /dev/sda --attributes=1:set:2
- # Warning: The kernel is still using the old partition table.
- # The new table will be used at the next reboot.
- # The operation has completed successfully.
- sgdisk /dev/sdb --attributes=1:set:2
- # Warning: The kernel is still using the old partition table.
- # The new table will be used at the next reboot.
- # The operation has completed successfully.
- # STEP 16. Spegnimento
- # IMPORTANTE: Prima del riavvio e' necessario impostare sul BIOS il boot dal SECONDO Hard Disk!
- poweroff
- # STEP 17. Cambio del tipo di partizioni per /dev/sda
- gdisk /dev/sda
- # GPT fdisk (gdisk) version 0.6.10
- # Partition table scan:
- # MBR: protective
- # BSD: not present
- # APM: not present
- # GPT: present
- # Found valid GPT with protective MBR; using GPT.
- # Command (? for help): t
- # Partition number (1-3): 1
- # Current type is 'Linux/Windows data'
- # Hex code (L to show codes, 0 to enter raw code, Enter = 0700): FD00
- # Changed type of partition to 'Linux RAID'
- # Command (? for help): t
- # Partition number (1-3): 2
- # Current type is 'Linux/Windows data'
- # Hex code (L to show codes, 0 to enter raw code, Enter = 0700): FD00
- # Changed type of partition to 'Linux RAID'
- # Command (? for help): t
- # Partition number (1-3): 3
- # Current type is 'Linux LVM'
- # Hex code (L to show codes, 0 to enter raw code, Enter = 0700): FD00
- # Changed type of partition to 'Linux RAID'
- # Command (? for help): p
- # Disk /dev/sda: 488397168 sectors, 232.9 GiB
- # Logical sector size: 512 bytes
- # Disk identifier (GUID): 94FD44E7-05E0-41C4-90DD-409B329C78CB
- # Partition table holds up to 128 entries
- # First usable sector is 34, last usable sector is 488397134
- # Partitions will be aligned on 2048-sector boundaries
- # Total free space is 6042 sectors (3.0 MiB)
- # Number Start (sector) End (sector) Size Code Name
- # 1 2048 8388641 4.0 GiB FD00
- # 2 8390656 16777249 4.0 GiB FD00
- # 3 16779264 488397134 224.9 GiB FD00
- # Command (? for help): w
- # Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
- # PARTITIONS!!
- # Do you want to proceed, possibly destroying your data? (Y/N): Y
- # OK; writing new GUID partition table (GPT).
- # The operation has completed successfully.
- # STEP 18. Aggiunta delle partizioni di /dev/sda all'array RAID
- 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
- # STEP 19. Verifica del processo di ricostruzione dell'array RAID
- # La configurazione e' pressoche' completata. Per verificare lo stato dell'array eseguire il comando:
- cat /proc/mdstat
- # Se l'array e' in ricostruzione l'output sara' simile a:
- # -------------------------------------------------------
- # Personalities : [raid1]
- # md1 : active raid1 sda2[2] sdb2[0]
- # 4193216 blocks [2/1] [U_]
- # resync=DELAYED
- # md2 : active raid1 sda3[2] sdb3[0]
- # 235808832 blocks [2/1] [U_]
- # [>....................] recovery = 1.3% (3166784/235808832) finish=34.2min speed=113099K/sec
- # md0 : active raid1 sda1[1] sdb1[0]
- # 4193216 blocks [2/2] [UU]
- # unused devices: <none>
- # Al termine della ricostruzione invece si avra' il seguente output:
- # ------------------------------------------------------------------
- # Personalities : [raid1]
- # md1 : active raid1 sda2[1] sdb2[0]
- # 4193216 blocks [2/2] [UU]
- # md2 : active raid1 sda3[1] sdb3[0]
- # 235808832 blocks [2/2] [UU]
- # md0 : active raid1 sda1[1] sdb1[0]
- # 4193216 blocks [2/2] [UU]
- # unused devices: <none>
- # STEP 20. Copia della configurazione RAID
- mdadm --detail --scan >> /etc/mdadm.conf
- # STEP 21. Restore del Volume Group
- cd /etc/lvm/backup
- vgcfgrestore --file VG_<TAB> VG_<TAB>
- # Restored volume group VG_XenStorage-a387dae6-291d-34d3-dd74-7e35ad937048
- # Configurazione RAID 1 completata. Congratulazioni!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement