Announcement

Collapse
No announcement yet.

XenServer recovery after crash/hack

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XenServer recovery after crash/hack

    In following case the server with XCP 1.6, most of the binaries were corrupted & the server was down. The server was recovered using the backup of metadata/pool.

    Installing XCP on usb drive:

    1) Attach a USB drive to the server & make sure the primary drives are disconnected for safety. Load a DVD with XCP 1.6 ISO & start the installation. We will be installing XCP on the usb drive. The usb drive might not be detected, in this case you will have to add the ‘usb-storage’ . Press ALT-F2 to get the shell prompt & then add the usb-storage with command "modprobe usb-storage". Now you will see the usb drive for installation.

    2) Once XCP is installed on the usb, the server will not boot & it will give kernel panic error in the back & the Panda screen will stuck. To fix this do following steps.

    - Remove the usb drive, boot the server again from XCP 1.6 CD & press ALT-F2 to get shell prompt.
    - Attach the usb drive again & run following commands.

    Code:
    # mkdir /xcp
    # mount -t ext3 /dev/sda1 /xcp
    # mount proc /xcp/proc -t proc
    # mount sysfs /xcp/sys -t sysfs
    # mount --bind /dev /xcp/dev
    # chroot /xcp
    # cd /boot
    # ls –al
    
    # mv initrd-2.6.32.43-0.4.1.xs1.6.10.734.170748xen.img initrd-2.6.32.43-0.4.1.xs1.6.10.734.170748xen.img-bk
    # mkinitrd --with-usb initrd-2.6.32.43-0.4.1.xs1.6.10.734.170748xen.img 2.6.32.43-0.4.1.xs1.6.10.734.170748xen
    # exit
    # sync
    # reboot
    3) Remove the XCP CD & attach the primary drives which were removed earlier.





    Restoring the metadata/pool backup:

    1) Now you will have to introduce the old SR to this new XCP installation. Run pvscan,lvscan to check if
    You can see the PV/LV of the old SR. Active the volume group using “vgchange –ay oldVG”.

    2) Re-introduce the PV using following command.

    Code:
    # xe sr-introduce uuid=173371d7-6de4-898c-97cf-2d3c10fe80af type=lvm name-label=”Local storage” content-type=user
    3) Restore the metadata/pool backup.

    Code:
    # xe pool-restore-database file-name=Pool_Backup_14-06-14 –force
    After running the above command the server will reboot. Once up, all the vm’s will be shown on the server. In case the Local Storage shows inactive, fsck might be running on the storage. Wait till fsck is done & then restart the vm’s.



    Make sure to setup a new server & migrate the vm’s to new server.
    Regards,
    Sam
    System Admin

  • #2
    Re: XenServer recovery after crash/hack

    Excellent article Sam
    eUKhost - eNlight Cloud Hosting || eUKhost Knowledgebase
    Toll Free : 0808 262 0255 || Skype : mark_ducadi

    Comment

    Working...
    X