How to recover a pruned (but not GCed) backup ?

pierrep

Member
Mar 14, 2021
2
0
21
49
Hello everyone,

long story short, I have a backup I needed and did not manage to 'salvage', so it just got pruned, but the garbage collector did not run (and will not for a while).
How could i recover that backup and hopefully use it for the restore I need ?

Thanks in advance for the help.
 
It appears I managed to make with VM functional again, so I don't need that "urgently" anymore.
If someone ends up having info on that I think it will still be useful some day to someone :)
 
I'm not sure this is possible.

If I'm not mistaken when a backup is pruned, not only is the name/timestamp/etc lost, but also the map of which chunks go where on disk. Garbage collection just takes chunks that are unreferenced by a backup and removes them. You really need that "backup"

So in essence, you have all the chunks of data on disk, but you have no information on which of those blocks are part of your backup, nor what order those blocks might be in.

Datastores typically look something like this:
  • DATASTORE/.chunks/[first-4]/[hash] - backup chunk. This is your actual data. The file name is the hash of the content of this particular chunk and is how PBS does deduplication
  • DATASTORE/vm/###/YYYY-MM-DDTHH:MM:SS/ - this is a given VM backup snapshot
    • index.json.blob - probably some metadata on the VM
    • qemu-server.conf.blob - backup metadata - VM ID, date, disks in backup, whether it's protected, verification state, backup stats
    • drive-????.fidx - index of disk chunks - what chunks are on a given drive/volume and what order

Your best bet might be to look for a way to "un-delete" the vm/ct folder in your PBS datastore (DATASTORE/vm/###/TIMESTAMP). Depending on the filesystem and/or underlying disk this may not be possible. If it is possible, it will likely require you to unmount/remount your datastore read-only while you do the data recovery.