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

Source: Internet
Author: User
Tags new set uuid

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 Fmt Attr psize pfree


/dev/sda3 vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59 lvm2 a--10.87t 8.34t


/DEV/SDB3 xslocalext-0d4b3188-1afd-ecf7-44a4-2d594d966b35 lvm2 a--13.60t 0


[Root@xenserver-ds-testserver1 ~]# VGs


VG #PV #LV #SN Attr vsize vfree


vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59 1 0 wz--n-10.87t 8.34t


Xslocalext-0d4b3188-1afd-ecf7-44a4-2d594d966b35 1 1 0 wz--n-13.60t 0


[Root@xenserver-ds-testserver1 ~]# LVs


LV VG Attr lsize Pool Origi n data% meta% move Log cpy%sync Convert


MGT vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-a-----4.00m


vhd-0dcf2cc7-1065-41db-9e23-148a417fe217 Vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-ri-------9.71g


VHD-0F475F75-96E6-40C3-949B-434952569D20 vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------15.04g


VHD-18B5ED2B-7C53-43CB-B5F6-6CD7150818FC vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------40.09g


vhd-514a4efe-3b67-419b-a5b4-117758b1bb0b Vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-ri-------2.05g


vhd-52ab4b8e-c2cb-409d-b0cd-2d7d3e83d406 Vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-ao----8.00m


VHD-5448D7B8-2D34-4C11-8239-CC73CC2C5FCF vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------100.20g


VHD-68C7616E-2255-4B7D-B466-CEFF675C3DAC vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------40.09g


vhd-70430d5b-81d7-4ef5-97d1-b469ffc68329 vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------1001.96g


VHD-BA7FDF40-8949-49E8-9A8D-3CD82E681D05 vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------15.04g


VHD-C2489598-8C15-46A8-875D-DE330C3A3D45 vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------15.04g


vhd-c9765741-c451-4a58-b90a-b14529b5037b vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------15.04g


VHD-D5BF4179-B9E5-4286-A94D-88C42CB803C4 vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------100.20g


Vhd-db9b028f-9490-40cb-9d14-3099753db6e3 Vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-ri-ao----108.68g


VHD-DE709C9B-12C0-4854-A98D-79868B4A2C2E Vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-ao----751.47g


vhd-e89b9b3d-cc07-456e-bcd0-7630c5d41224 vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------200.40g


Vhd-f680824c-d00a-4233-bbdc-6b935930b5ab vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-------40.09g


VHD-FCC379EE-B7CB-4B47-B349-4FEA5B1B75B5 Vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-ao----120.24g


Local_iso vg_xenstorage-275f0172-dec8-aa20-81a5-5e50cd637f59-wi-a-----20.00g


0d4b3188-1afd-ecf7-44a4-2d594d966b35 Xslocalext-0d4b3188-1afd-ecf7-44a4-2d594d966b35-wi-ao----13.60t


[Root@xenserver-ds-testserver1 ~]#

Here is the zoning information all back, but this is the beginning, the most important is the group let the real data can not come back, continue to




[Root@xenserver-ds-testserver1 ~]# Cat/proc/partitions


Major Minor #blocks name





7 0 56104 Loop0


8 0 11718885376 SDA


8 1 18874368 sda1


8 2 18874368 Sda2


8 3 11675368431 Sda3


8 4 524288 SDA4


8 5 4194304 Sda5


8 6 1048576 Sda6


8 14648606720 SDB


8 18874368 SDB1


8 18874368 SDB2


8 14605089775 SDB3


8 524288 SDB4


8 4194304 SDB5


8 1048576 SDB6


253 20971520 dm-15


253 0 14605074432 dm-0


253 1 4096 Dm-1


253 2 787976192 Dm-2


254 0 786432000 TDA


253 4 113958912 Dm-4


254 4 125829120 TDE


253 8 126083072 Dm-8


253 8192 dm-11


254 6 125829120 TDG


[Root@xenserver-ds-testserver1 ~]# ls-l/dev/disk/by-id/


Total 0


lrwxrwxrwx 1 root Aug 8 03:58 dm-name-vg_xenstorage--275f0172--dec8--aa20--81a5--5e50cd637f59-local_iso->. /.. /dm-15


lrwxrwxrwx 1 root Aug 8 04:10 dm-name-vg_xenstorage--275f0172--dec8--aa20--81a5--5e50cd637f59-mgt->. /.. /dm-1


lrwxrwxrwx 1 root Aug 8 06:35 dm-name-vg_ xenstorage--275f0172--dec8--aa20--81a5--5e50cd637f59-vhd--52ab4b8e--c2cb--409d--b0cd--2d7d3e83d406->. /.. /dm-11


lrwxrwxrwx 1 root Aug 8 06:35 dm-name-vg_ Xenstorage--275f0172--dec8--aa20--81a5--5e50cd637f59-vhd--db9b028f--9490--40cb--9d14--3099753db6e3->. /.. /dm-4


lrwxrwxrwx 1 root Aug 8 06:30 dm-name-vg_ XENSTORAGE--275F0172--DEC8--AA20--81A5--5E50CD637F59-VHD--DE709C9B--12C0--4854--A98D--79868B4A2C2E->. /.. /dm-2


lrwxrwxrwx 1 root Aug 8 06:35 dm-name-vg_ Xenstorage--275f0172--dec8--aa20--81a5--5e50cd637f59-vhd--fcc379ee--b7cb--4b47--b349--4fea5b1b75b5->. /.. /dm-8


lrwxrwxrwx 1 root Aug 8 04:08 Dm-name-xslocalext--0d4b3188--1afd--ecf7--44a4--2d594d966b35-0d4b3188--1afd--ecf7--44a4--2d594d966b35->. /.. /dm-0


lrwxrwxrwx 1 root Aug 8 06:35 Dm-uuid-lvm-cb4xlg6peennkksk5gmqts3eoyco0oqe54qz1ihucdsqzgv4ix8yrhlqs6ioazuu- >.. /.. /dm-8


lrwxrwxrwx 1 root Aug 8 06:30 Dm-uuid-lvm-cb4xlg6peennkksk5gmqts3eoyco0oqe9ojbv4bktzgxetephxe1o7n6t40c89hl- >.. /.. /dm-2


lrwxrwxrwx 1 root Aug 8 04:10 dm-uuid-lvm-cb4xlg6peennkksk5gmqts3eoyco0oqeg8pbhdhsvhguxytckxzbj52t75ei0ns6- >.. /.. /dm-1


lrwxrwxrwx 1 root Aug 8 06:35 Dm-uuid-lvm-cb4xlg6peennkksk5gmqts3eoyco0oqeiccxlbeqzj1ksexk2tpmvybrifwupy21- >.. /.. /dm-11


lrwxrwxrwx 1 root Aug 8 03:58 dm-uuid-lvm-cb4xlg6peennkksk5gmqts3eoyco0oqerjh0l0nrx7rcgmcnoioxqcdslklo2fd3- >.. /.. /dm-15


lrwxrwxrwx 1 root Aug 8 06:35 dm-uuid-lvm-cb4xlg6peennkksk5gmqts3eoyco0oqeuavd8ndo1on9yx3bfoxn16ijjssrsyyi- >.. /.. /dm-4


lrwxrwxrwx 1 root Aug 8 04:08 dm-uuid-lvm-tgxgvkcz2nc899cjrqrb6qv55uyc5kr2tdtlqyso0ww4ymezivecpmi7uuwpfa85- >.. /.. /dm-0


lrwxrwxrwx 1 Root 9 Aug 8 06:24 scsi-3600605b000b393401f3a02470682c385->. /.. /sdb


lrwxrwxrwx 1 root Aug 8 06:24 scsi-3600605b000b393401f3a02470682c385-part1->. /.. /sdb1


lrwxrwxrwx 1 root Aug 8 06:24 scsi-3600605b000b393401f3a02470682c385-part2->. /.. /sdb2


lrwxrwxrwx 1 root Aug 8 06:24 scsi-3600605b000b393401f3a02470682c385-part3->. /.. /sdb3


lrwxrwxrwx 1 root Aug 8 06:24 scsi-3600605b000b393401f3a02470682c385-part4->. /.. /sdb4


lrwxrwxrwx 1 root Aug 8 06:24 scsi-3600605b000b393401f3a02470682c385-part5->. /.. /sdb5


lrwxrwxrwx 1 root Aug 8 06:24 scsi-3600605b000b393401f3a02470682c385-part6->. /.. /sdb6


lrwxrwxrwx 1 Root 9 Aug 8 06:42 scsi-3600605b000b394e01f20a4c6273ed3e2->. /.. /sda


lrwxrwxrwx 1 root Aug 8 06:42 scsi-3600605b000b394e01f20a4c6273ed3e2-part1->. /.. /sda1


lrwxrwxrwx 1 root Aug 8 06:42 scsi-3600605b000b394e01f20a4c6273ed3e2-part2->. /.. /sda2


lrwxrwxrwx 1 root Aug 8 06:42 scsi-3600605b000b394e01f20a4c6273ed3e2-part3->. /.. /sda3


lrwxrwxrwx 1 root Aug 8 06:42 scsi-3600605b000b394e01f20a4c6273ed3e2-part4->. /.. /sda4


lrwxrwxrwx 1 root Aug 8 06:42 scsi-3600605b000b394e01f20a4c6273ed3e2-part5->. /.. /sda5


lrwxrwxrwx 1 root Aug 8 06:42 scsi-3600605b000b394e01f20a4c6273ed3e2-part6->. /.. /sda6


lrwxrwxrwx 1 Root 9 Aug 8 06:24 wwn-0x600605b000b393401f3a02470682c385->. /.. /sdb


lrwxrwxrwx 1 root Aug 8 06:24 wwn-0x600605b000b393401f3a02470682c385-part1->. /.. /sdb1


lrwxrwxrwx 1 root Aug 8 06:24 wwn-0x600605b000b393401f3a02470682c385-part2->. /.. /sdb2


lrwxrwxrwx 1 root Aug 8 06:24 wwn-0x600605b000b393401f3a02470682c385-part3->. /.. /sdb3


lrwxrwxrwx 1 root Aug 8 06:24 wwn-0x600605b000b393401f3a02470682c385-part4->. /.. /sdb4


lrwxrwxrwx 1 root Aug 8 06:24 wwn-0x600605b000b393401f3a02470682c385-part5->. /.. /sdb5


lrwxrwxrwx 1 root Aug 8 06:24 wwn-0x600605b000b393401f3a02470682c385-part6->. /.. /sdb6


lrwxrwxrwx 1 Root 9 Aug 8 06:42 wwn-0x600605b000b394e01f20a4c6273ed3e2->. /.. /sda


lrwxrwxrwx 1 root Aug 8 06:42 wwn-0x600605b000b394e01f20a4c6273ed3e2-part1->. /.. /sda1


lrwxrwxrwx 1 root Aug 8 06:42 wwn-0x600605b000b394e01f20a4c6273ed3e2-part2->. /.. /sda2


lrwxrwxrwx 1 root Aug 8 06:42 wwn-0x600605b000b394e01f20a4c6273ed3e2-part3->. /.. /sda3


lrwxrwxrwx 1 root Aug 8 06:42 wwn-0x600605b000b394e01f20a4c6273ed3e2-part4->. /.. /sda4


lrwxrwxrwx 1 root Aug 8 06:42 wwn-0x600605b000b394e01f20a4c6273ed3e2-part5->. /.. /sda5


lrwxrwxrwx 1 root Aug 8 06:42 wwn-0x600605b000b394e01f20a4c6273ed3e2-part6->. /.. /sda6


[Root@xenserver-ds-testserver1 ~]#


[Root@xenserver-ds-testserver1 ~]# Xe Host-list
UUID (RO): 3da0c2a0-e4c5-44ba-bb20-77a2b51198e3
Name-label (RW): Xenserver-ds-testserver1
Name-description (RW): Default Install


[Root@xenserver-ds-testserver1 ~]#

[Root@xenserver-ds-testserver1 ~]# xe sr-create content-type=user \
DEVICE-CONFIG:DEVICE=/DEV/DISK/BY-ID/WWN-0X600605B000B394E01F20A4C6273ED3E2-PART3 \
Host-uuid=3da0c2a0-e4c5-44ba-bb20-77a2b51198e3 name-label= "Local storage 2" Shared=false TYPE=LVM
This time the surprise was found before the VM partitions are back, but there are also imperfections, as shown below

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.