I've looked everywhere (Google, here, a bunch of other sites), and while I have found people with similar problems, I couldn't find a single one with a solution to this.
Last night our xenserver 5.6 box corrupted the /var/xapi/state.db, and I couldn't fix the xml, no matter what I did.
After a good hour fiddling with the file, I figured it would be faster to just reinstall.
The server had one 2tb hard drive running Xen and its VMs, and since Xen's install said it would erase the hard drive it was installed on, I plugged a new harddrive and installed Xen on it, without selecting any hard drives for storage. I Figured I could make it happen after install, using the partition on the old harddrive with all my VMs on it.
After instalation finished and the system booted I did:
#fdisk -l
found the old partition at /dev/sda3
#ll /dev/disk/by-id
found the partition at /dev/disk/by-id/scsi-3600188b04c02f100181ab3a48417e490-part3
#xe host-list
uuid ( RO) : a019d93e-4d84-4a4b-91e3-23572b5bd8a4
name-label ( RW): xenserver-scribfourteen
name-description ( RW): Default install of XenServer
#pvscan
PV /dev/sda3 VG VG_XenStorage-405a2ece-d10e-d6c5-ede2-e1ad2c29c68d lvm2 [1.81 TB / 204.85 GB free]
Total: 1 [1.81 TB] / in use: 1 [1.81 TB] / in no VG: 0 [0 ]
#vgscan
Reading all physical volumes. This may take a while...
Found volume group "VG_XenStorage-405a2ece-d10e-d6c5-ede2-e1ad2c29c68d" using metadata type lvm2
# pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name VG_XenStorage-405a2ece-d10e-d6c5-ede2-e1ad2c29c68d
PV Size 1.81 TB / not usable 6.97 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 474747
Free PE 52441
Allocated PE 422306
PV UUID U03Gt9-WtHi-8Nnu-QB2Q-c7BV-CO9A-cFpYWW
# xe sr-introduce name-label="VMs" type=lvm uuid=U03Gt9-WtHi-8Nnu-QB2Q-c7BV-CO9A-cFpYWW name-description="VMs Local HD Storage" content-type=user shared=false device-config=:device=/dev/disk/by-id/scsi-3600188b04c02f100181ab3a483f9f0ae-part3
U03Gt9-WtHi-8Nnu-QB2Q-c7BV-CO9A-cFpYWW
# xe pbd-create host-uuid=a019d93e-4d84-4a4b-91e3-23572b5bd8a4 sr-uuid=U03Gt9-WtHi-8Nnu-QB2Q-c7BV-CO9A-cFpYWW device-config:device=/dev/disk/by-id/scsi-3600188b04c02f100181ab3a483f9f0ae-part3
adf92b7f-ad40-828f-0728-caf94d2a0ba1
# xe pbd-plug uuid=adf92b7f-ad40-828f-0728-caf94d2a0ba1
Error code: SR_BACKEND_FAILURE_47
Error parameters: , The SR is not available [opterr=no such volume group: VG_XenStorage-U03Gt9-WtHi-8Nnu-QB2Q-c7BV-CO9A-cFpYWW]
At this point I did a
# vgrename VG_XenStorage-405a2ece-d10e-d6c5-ede2-e1ad2c29c68d VG_XenStorage-U03Gt9-WtHi-8Nnu-QB2Q-c7BV-CO9A-cFpYWW
cause the VG name was different, but pdb-plug still gives me the same error.
So, now I'm kinda lost about what to do, I'm not used to Xen and most sites I've been finding are really unhelpful.
I hope someone can guide me in the right way to fix this. I cant lose those VMs (got backups, but from inside the guests, not the VMs themselves).