How to Re-attach an SR
-
This is what showed up:
uuid ( RO) : 6dccd15c-2682-460c-9049-bdd210288c74 name-label ( RW): Control domain on host: vm power-state ( RO): running
I think I may have had some VMs on the SSD drive...but I guess the drive was wiped during the re-install?
Also, when I login to Xen Orchestra, the SR I just re-attached shows as "disconnected".... so, I'm guess that's why I don't see any VMs.
-
VM metadata isn't stored in the SR but in XAPI DB. If you removed it, then you lost all the VM metadata (VM name, description, number of disks, CPU, RAM etc.)
However, if you don't formatted the SR itself, you should be able to find the actual data, then "just" recreate the VM and attach each disk to your recreated VM.
Now the question is: do you have formatted your SR? If yes, you also lost data, not just metadata. If not, you need to re-introduce the SR and then recreate the associated PBD (the PBD is the "link" between your host and the SR, telling how to access data, eg the path of the local drive in your case)
-
@Chrome As M. Lambert says, you may be able to sue pbd-plug to re-attach the SR if you can sr-introduce the old SR back into the system.
If not, and if your LVM configuration has not been wiped out, here are some steps t try to recover it (it's an ugly process!):- Identify the LVM configuration:
Check for Backups: Look for LVM metadata backups in /etc/lvm/archive/ or /etc/lvm/backup/.
Use vgscan: This command will search for volume groups and their metadata.
Use pvscan: This command will scan for physical volumes.
Use lvs: This command will list logical volumes and their status.
Use vgs: This command will list volume groups. - Restore from Backup (if available):
Find the Backup: Locate the LVM metadata backup file (e.g., /etc/lvm/backup/<vg_name>).
Boot into Rescue Mode: If you're unable to access the system, boot into a rescue environment.
Restore Metadata: Use vgcfgrestore to restore the LVM configuration. - Recreate LVM Configuration (if no backup):
Identify PVs: Use pvscan to list available physical volumes.
Identify VGs: Use vgscan to identify volume groups if they are present.
Recreate PVs: If necessary, use pvcreate to create physical volumes.
Create VGs: If necessary, use vgcreate to create a new volume group.
Create LVs: If necessary, use lvcreate to create logical volumes. - Mount and Verify:
Mount the Logical Volumes: Mount the restored LVM volumes to their respective mount points.
Verify Data: Check the integrity of the data on the restored LVM volumes. - Extend LVM (if adding capacity):
Add a new disk: Ensure the new disk is recognized by the system.
Create PV: Use pvcreate on the new disk.
Add PV to VG: Use vgextend to add the PV to the volume group.
Extend LV: Use lvextend to extend the size of an existing logical volume.
Extend Filesystem: Use e2resize (for ext4) or resize2fs (for ext3) to extend the filesystem on the LV.
- Identify the LVM configuration:
-
@olivierlambert said in How to Re-attach an SR:
VM metadata isn't stored in the SR but in XAPI DB. If you removed it, then you lost all the VM metadata (VM name, description, number of disks, CPU, RAM etc.)
However, if you don't formatted the SR itself, you should be able to find the actual data, then "just" recreate the VM and attach each disk to your recreated VM.
Now the question is: do you have formatted your SR? If yes, you also lost data, not just metadata. If not, you need to re-introduce the SR and then recreate the associated PBD (the PBD is the "link" between your host and the SR, telling how to access data, eg the path of the local drive in your case)
Thanks for your reply! I wanted to get back to you yesterday, but had family obligations.
I did not format the SR, in fact, I was hoping after the re-install of XCP-ng (I re-installed to get IPv6 enabled), xcp-ng would just "pickup" the SR. I obviously didn't understand that there's much more to it than that.
-
This post is deleted! -
Thank you for the detailed reply, I will need much hand holding through this process! I waned to respond yesterday to your helpful instructions, but I was with the family. So, I am going to try these commands now:
/etc/lvm/backup: -rw------- 1 root root 1330 May 30 19:53 XSLocalEXT-de0e7bd7-e938-78a8-1c1f-2eac2639298d
/etc/lvm/archive/: Nothing in this directory
vgscan: Reading all physical volumes. This may take a while... Found volume group "XSLocalEXT-de0e7bd7-e938-78a8-1c1f-2eac2639298d" using metadata type lvm2
pvscan: PV /dev/nvme0n1 VG XSLocalEXT-de0e7bd7-e938-78a8-1c1f-2eac2639298d lvm2 [931.50 GiB / 0 free] Total: 1 [931.50 GiB] / in use: 1 [931.50 GiB] / in no VG: 0 [0 ]
lvs: LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert de0e7bd7-e938-78a8-1c1f-2eac2639298d XSLocalEXT-de0e7bd7-e938-78a8-1c1f-2eac2639298d -wi------- 931.50g
vgs: VG #PV #LV #SN Attr VSize VFree XSLocalEXT-de0e7bd7-e938-78a8-1c1f-2eac2639298d 1 1 0 wz--n- 931.50g 0
So, I got this far... and then I booted off the INSTALLER USB drive, to see if I get to rescue mode... but I noticed that there's a "restore" option, so, I decided to try that.
To my delight, it restored the connection to the nvme SR, which looks like it had 4 VMs on it... and they appear to be up and running now. Sweet!
The other VMs I had... looks like I stored them on the SSD... which I reinstalled xcp-ng on...so, I guess those are gone? So, lesson learned there.
-
@Chrome Fantastic! Please mark my post as helpful if you found it as such. Was traveling much of today, hence the late response.
BTW, it's always good to make a backup and/or archive of your LVM configuration anytime you change it, as the restore option is the cleanest way to deal with connectivity issues if there is some sort of corruption. It's saved my rear end before, I can assure you!
Yeah, if the SSD drive got wiped, there's no option to get those back unless you made a backup somewhere of all that before you installed XCP-ng onto it.
BTW, another very useful command for LVM is "vgchange -ay" which will attempt to renew VG information if a VG seems missing or the like.
-
@tjkreidl Yes, thank you so much for all your help! I will be diving in backups.... even something on a schedule. I appreciate your patience, and your teachings!
All the best to you.
It was a pleasure. I hope I correctly marked your post as helpful, it really was.
-
@Chrome Cheers -- always glad to help out. I put in many thousands of posts on the old Citrix XenServer site, and am happy to share whatever knowledge I still have, as long as it's still relevant! In a few years, it probably won't be, so carpe diem!
-
O olivierlambert marked this topic as a question
-
O olivierlambert has marked this topic as solved
-
Hehe another great example of why a community is fantastic!! (it's a bit sad that Citrix never realized it)
-
@olivierlambert Agreed. The Citrix forum used to be very active, but especially since Citrix was taken over, https://community.citrix.com has had way less activity, sadly.
It's still gratifying that a lot of the functionality still is common to both platforms, although as XCP-ng evolves, there will be continually less commonality.