Example of recovering data from a xenserver outage that caused the system to crash

Source: Internet
Author: User
Tags new set

Because of the sudden power outage caused the company's internal computer room XenServer host hung up, the system can not start, downtime before the system configuration is
Cpu:e5 2630 v3
Memory: 128GB
Storage: 3T West number Purple Plate 5 block
Array Card: LSI 9361-8i
The disk took 5 blocks to do RAID5, and when the outage failed to start, I took a lsi9361-8i card and 6 3T disks (the importance of hardware spares) and then made a new set of RAID5,
A xenserver system was reinstalled on the new raid, and when I got into the system, I found that the RAID array on the system was out of the partition table without PV VG LV, suddenly I was directly stunned.

But things have been out or to find ways to recover, the first to restore the partition table, so began to slowly climb the pit and try, here does not say take a detour, directly said the settlement process
First look at the details of the current system's partition table.

[Root@xenserver-ds-testserver1 ~]# sgdisk-p/dev/sdb
disk/dev/sdb:29297213440 sectors, 13.6 TiB
Logical Sector size:512 bytes
Disk identifier (GUID): 96873ac9-0736-4edd-b12c-9c64fa674119
Partition table holds up to 128 entries
Usable sector is 29297213406 usable sector
Partitions is aligned on 2048-sector boundaries
Total free spaces is 2014 sectors (1007.0 KiB)

Number Start (sector) end (sector) Size Code Name
1 46139392 83888127 18.0 GiB 0700
2 8390656 46139391 18.0 GiB 0700
3 87033856 29297213406 13.6 TiB 8E00
4 83888128 84936703 512.0 MiB EF02
5 2048 8390655 4.0 GiB 0700
6 84936704 87033855 1024.0 MiB 8200
[Root@xenserver-ds-testserver1 ~]#

Then found that xenserver very good action is the data storage partition although the ID is not the last one, but the partition block is the last one, then the news comes, we can fully use the existing partition information to recover before the table.


[Root@xenserver-ds-testserver1 ~]# sgdisk-p--new=5:2048:8390655-t 5:0700/DEV/SDA
[Root@xenserver-ds-testserver1 ~]# sgdisk-p--new=2:8390656:46139391-t 2:0700/DEV/SDA
[Root@xenserver-ds-testserver1 ~]# sgdisk-p--new=1:46139392:83888127-t 1:0700/DEV/SDA
[Root@xenserver-ds-testserver1 ~]# sgdisk-p--new=4:83888128:84936703-t 4:EF02/DEV/SDA
[Root@xenserver-ds-testserver1 ~]# sgdisk-p--new=6:84936704:87033855-t 6:8200/DEV/SDA
[Root@xenserver-ds-testserver1 ~]# sgdisk-p--new=3:87033856-t 3:8E00/DEV/SDA
Command explanation because it is a disk that is greater than 2T partitions so you need to use it for GPT partitioning
-P is for printing information
--new=x: Start Position: End position (no end position is final)
-T X: Partition type Code
To see if the restored partition table is correct.


[Root@xenserver-ds-testserver1 ~]# sgdisk-p/DEV/SDA
disk/dev/sda:23437770752 sectors, 10.9 TiB
Logical Sector size:512 bytes
Disk identifier (GUID): 589962fd-858d-4789-a026-e08ad53863ff
Partition table holds up to 128 entries
Usable sector is 23437770718 usable sector
Partitions is aligned on 2048-sector boundaries
Total free spaces is 2014 sectors (1007.0 KiB)

Number Start (sector) end (sector) Size Code Name
1 46139392 83888127 18.0 GiB 0700
2 8390656 46139391 18.0 GiB 0700
3 87033856 23437770718 10.9 TiB 8E00
4 83888128 84936703 512.0 MiB EF02
5 2048 8390655 4.0 GiB 0700
6 84936704 87033855 1024.0 MiB 8200
[Root@xenserver-ds-testserver1 ~]# MKDIR/1
[Root@xenserver-ds-testserver1 ~]# MOUNT/DEV/SDA1/1
[Root@xenserver-ds-testserver1 ~]# LS/1
1 bin boot Cli-rt dev etc EULA Home iso_storage Lib lib64 lost+found media mnt opt proc read_me_first.html Root run sbin SRV sys tmp usr var

The partition table is back, now is to do restore PV, because XenServer under the/etc/lvm/backup/have to store the LVM backup information, so directly to operate


[Root@xenserver-ds-testserver1 ~]# ls/etc/lvm/backup/
vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59 xslocalext-0d4b3188-1afd-ecf7-44a4-2d594d966b35
[Root@xenserver-ds-testserver1 ~]# grep-a1 pv0/etc/lvm/backup/vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59 | Head-3 #取之前PV的ID
Pv0 {
id = "xbpmj4-qtr0-i76k-32jy-uikr-eaoh-gdu954"
--
[Root@xenserver-ds-testserver1 ~]# pvcreate/dev/sda3 \
-U xbpmj4-qtr0-i76k-32jy-uikr-eaoh-gdu954--restorefile \
/etc/lvm/backup/vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59
[Root@xenserver-ds-testserver1 ~]# Vgcfgrestore
[Root@xenserver-ds-testserver1 ~]# PVs
PV VG%2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.