So here is a summary of my situation and this thread.
I had a PVE 6.4.1 installation as follow;
- 1ea root drive
- 2ea drives configured into ZFS pool
My root drive failed and I did not have any backups.
Here is the process that I went through to recover the virtual machine drives that were still out on the ZFS pool.
Do not blindly follow this process. I spent hours reading documentation, mostly ZFS stuff that is linked in this thread.
When I had questions or wanted confirmation then I posted here and
@Dunuin was kind enough to help.
I got a new root drive and installed the latest version of ProxMox Virtual Environment (PVE) v7.3.4.
I went to the Shell and started checking.
Code:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 232.9G 0 disk
├─sda1 8:1 1 1007K 0 part
├─sda2 8:2 1 512M 0 part
└─sda3 8:3 1 232.4G 0 part
├─pve-swap 253:0 0 8G 0 lvm [SWAP]
├─pve-root 253:1 0 58G 0 lvm /
├─pve-data_tmeta 253:2 0 1.5G 0 lvm
│ └─pve-data 253:4 0 147.4G 0 lvm
└─pve-data_tdata 253:3 0 147.4G 0 lvm
└─pve-data 253:4 0 147.4G 0 lvm
sdb 8:16 1 3.7T 0 disk
├─sdb1 8:17 1 3.7T 0 part
└─sdb9 8:25 1 8M 0 part
sdc 8:32 1 3.7T 0 disk
├─sdc1 8:33 1 3.7T 0 part
└─sdc9 8:41 1 8M 0 part
sr0 11:0 1 1024M 0 rom
So my ZFS drives were still there.
From there I imported the zfs pool which was named VM4tbR1.
Code:
# zpool import -f VM4tbR1
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
VM4tbR1 1.57T 1.94T 96K /VM4tbR1
VM4tbR1/vm-100-disk-0 33.0G 1.97T 6.92G -
VM4tbR1/vm-200-disk-1 1.03T 2.07T 932G -
VM4tbR1/vm-300-disk-0 103G 2.02T 21.6G -
VM4tbR1/vm-300-disk-2 103G 2.02T 22.2G -
VM4tbR1/vm-500-disk-0 103G 2.03T 20.1G -
VM4tbR1/vm-550-disk-0 206G 2.13T 17.6G -
Then you can run a zpool status and it should show the state of the pool.
Mine was clean and didn't need a scrubbing.
I had 6ea VMs but I could only remember about half of them.
I dug through my DNS and found what names I could. Only one of them was a Windows machine and it was my big concern. If the boot goes wrong there then it could make the disk unusable. So my plan was to copy that drive from the zfs pool to a new name within the same pool. Then I could build a new VM with the closest configuration I could remember.
I built a new VM with a different ID with the settings.
I then used zfs send and zfs recv to copy the drive. zfs send needs a snapshot to work so I took a snapshot and duplicated it.
Code:
// We need to create a snapshot first
# zfs snapshot VM4tbR1/vm-300-disk-2@last
# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
VM4tbR1/vm-300-disk-2@last 0B - 22.2G -
//Duplicate the drive into the same directory
# zfs send VM4tbR1/vm-300-disk-2@last | zfs recv -v VM4tbR1/vm-322-disk-1
receiving full stream of VM4tbR1/vm-300-disk-2@last into VM4tbR1/vm-322-disk-1@last
received 30.9G stream in 1086 seconds (29.2M/sec)
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
VM4tbR1 1.61T 1.90T 96K /VM4tbR1
VM4tbR1/vm-100-disk-0 33.0G 1.93T 6.92G -
VM4tbR1/vm-200-disk-1 1.03T 2.02T 932G -
VM4tbR1/vm-300-disk-0 103G 1.98T 21.6G -
VM4tbR1/vm-300-disk-2 125G 2.00T 22.2G -
VM4tbR1/vm-322-disk-0 56K 1.90T 56K -
VM4tbR1/vm-322-disk-1 22.2G 1.90T 22.2G -
VM4tbR1/vm-500-disk-0 103G 1.98T 20.1G -
VM4tbR1/vm-550-disk-0 206G 2.09T 17.6G -
# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
VM4tbR1/vm-300-disk-2@last 0B - 22.2G -
VM4tbR1/vm-322-disk-1@last 0B - 22.2G -
// Rename the original disk that was created for the new VM to something else
// This is not really necessary. You can just detach the drive from the WebUI and then delete it.
# zfs rename VM4tbR1/vm-322-disk-0 VM4tbR1/vm-322-disk-0old
// Rename the newly copied old disk to the new VM disk name
// The snapshot will follow the rename so no need to worry about it.
# zfs rename VM4tbR1/vm-322-disk-1 VM4tbR1/vm-322-disk-0
// Rescan disks against the VM so they show up in the WebUI
# qm rescan
I went to the WebUI and detached the drive from the new machine that I created. The new copied drive showed up after the qm rescan so I attached it as the sole drive and booted. The machine booted, made some changes and I had to reboot and it's up and running.
I am now working on my Linux machines and I hope they will be much easier. I realize that I didn't need to duplicate the disks but I was concerned about corruption with them.
BIG THANKS to
@Dunuin. Hopefully this helps someone else.