Situation :
- 3 standalone nodes with VM's on XFS storage
- No Shared storage.
- NFS shares on all 3 nodes to eachother to restore backup files from one node to the other. (added as NFS storage, with backup files only selected in PVE)
Task :
- Introduce new node and setup first cluster node (no shared storage)
- setup/erect NFS connectivity for pulling backup files across and restore them on new clusternode (added as NFS storage, with backup files only selected in PVE)
- Restore VMs from newly taken backup after shutdown.
Issue:
- restore goes fine, but it adds 'unused disks' that are linked to NFS storage on old host.
- deleting those unused disk leads to deletion of actual file over NFS on old node with same VMID while VM is still running.
- backups of those VMS now leads to file not found on diskfiles
Challenge:
- get diskfiles back (without having backups)
first of all this method ONLY works if the files are in use ( so aslong as you dont power off the VM they will still be there)
determine the flagged deleted files
In my case the result was :
Copy the files (yes they are open and in use, still its better then nothing, and a filesystemrepair can do alot) :
Test the integrity of the copied files (and repair if needed with -t all)
Now all files have been rescued for as far as possible outside of the VM
This point is the hardest decision you make in this procedure : power down the VM which lost its disks !
- powering down means the active files are released and deleted ( so make sure you executed the copy of the active files has gone correctly)
After powering down copy the saved files back to their original location
Most likely the filesystem will be inconsistent as it was still running, so boot the VM from a liveCD and repair the disks (fsck)
After done reboot the VM normally, and hope everything is there ( in my case i had a full restoration of the deleted diskfiles and machine !)
Just to share the steps i have taken so if someone else ever runs into it he/she can attempt the same procedure.
- Michael
- 3 standalone nodes with VM's on XFS storage
- No Shared storage.
- NFS shares on all 3 nodes to eachother to restore backup files from one node to the other. (added as NFS storage, with backup files only selected in PVE)
Task :
- Introduce new node and setup first cluster node (no shared storage)
- setup/erect NFS connectivity for pulling backup files across and restore them on new clusternode (added as NFS storage, with backup files only selected in PVE)
- Restore VMs from newly taken backup after shutdown.
Issue:
- restore goes fine, but it adds 'unused disks' that are linked to NFS storage on old host.
- deleting those unused disk leads to deletion of actual file over NFS on old node with same VMID while VM is still running.
- backups of those VMS now leads to file not found on diskfiles
Challenge:
- get diskfiles back (without having backups)
first of all this method ONLY works if the files are in use ( so aslong as you dont power off the VM they will still be there)
determine the flagged deleted files
Code:
find /proc/*/fd -ls | grep '(deleted)'
Code:
12572685 0 lrwx------ 1 root root 64 Apr 14 01:21 /proc/1722/fd/22 -> /data/vms/images/100/vm-100-disk-3.qcow2\ (deleted)
12572687 0 lrwx------ 1 root root 64 Apr 14 01:21 /proc/1722/fd/24 -> /data/vms/images/100/vm-100-disk-2.qcow2\ (deleted)
12572688 0 lrwx------ 1 root root 64 Apr 14 01:21 /proc/1722/fd/25 -> /data/vms/images/100/vm-100-disk-1.qcow2\ (deleted)
12572689 0 lrwx------ 1 root root 64 Apr 14 01:21 /proc/1722/fd/26 -> /data/vms/images/100/vm-100-disk-4.qcow2\ (deleted)
12572690 0 lrwx------ 1 root root 64 Apr 14 01:21 /proc/1722/fd/27 -> /data/vms/images/100/vm-100-disk-5.qcow2\ (deleted)
12572691 0 lrwx------ 1 root root 64 Apr 14 01:21 /proc/1722/fd/28 -> /data/vms/images/100/vm-100-disk-6.qcow2\ (deleted)
Copy the files (yes they are open and in use, still its better then nothing, and a filesystemrepair can do alot) :
Code:
cp /proc/1722/fd/22 /backup-store/vm-100-disk-3.qcow2
cp /proc/1722/fd/24 /backup-store/vm-100-disk-2.qcow2
cp /proc/1722/fd/25 /backup-store/vm-100-disk-1.qcow2
cp /proc/1722/fd/26 /backup-store/vm-100-disk-4.qcow2
cp /proc/1722/fd/27 /backup-store/vm-100-disk-5.qcow2
cp /proc/1722/fd/28 /backup-store/vm-100-disk-6.qcow2
Test the integrity of the copied files (and repair if needed with -t all)
Code:
qemu-img check /backup-store/vm-100-disk-3.qcow2
.....
.....
.....
This point is the hardest decision you make in this procedure : power down the VM which lost its disks !
- powering down means the active files are released and deleted ( so make sure you executed the copy of the active files has gone correctly)
After powering down copy the saved files back to their original location
Code:
cp /backup-store/vm-100-disk-3.qcow2 /data/vms/images/100/
cp /backup-store/vm-100-disk-2.qcow2 /data/vms/images/100/
cp /backup-store/vm-100-disk-1.qcow2 /data/vms/images/100/
cp /backup-store/vm-100-disk-4.qcow2 /data/vms/images/100/
cp /backup-store/vm-100-disk-5.qcow2 /data/vms/images/100/
cp /backup-store/vm-100-disk-6.qcow2 /data/vms/images/100/
Most likely the filesystem will be inconsistent as it was still running, so boot the VM from a liveCD and repair the disks (fsck)
After done reboot the VM normally, and hope everything is there ( in my case i had a full restoration of the deleted diskfiles and machine !)
Just to share the steps i have taken so if someone else ever runs into it he/she can attempt the same procedure.
- Michael