Recover pbs vm and ct folder from chunks possible?

dekardy

Member
Aug 30, 2022
2
0
6
I accidentally (read stupidly) deleted my vm and ct folders. Is there is way to rebuild this from the .chunks directory?
 
No, the .chunks folder only contains the chunks and without the catalog/index files from the vm/ct folders these chunks are useless.
Think of the chunks like words in a book. You now still got the words in random order, but not the book anymore, so you don't know what sentences these words should form.
 
Last edited:
  • Like
Reactions: Johannes S
unless you have a copy somewhere else (tape, sync to another PBS), no. I'd disable any scheduled GC until you've made another backup of all the hosts/guests/.. that were previously stored on that datastore - you'll save yourself quite a lot of I/O on the PBS side if at least the common chunks of the last snapshot and the new one are still there.
 
Hi there.

My own experience if that can help. I did the same (stupid) mistake a few years back - synced the chunks to a remote storage, without the associated manifest, then lost the original data.

I just recently managed to salvage the manifest from the system logs under `/var/log/proxmox-backup/tasks/`.

```
created new dynamic index 2 ("host/samba/2023-08-29T09:24:16Z/dockernc.pxar.didx")
successfully added chunk 6ed1a198... to dynamic index 2 (offset 0, size 8328195)
successfully added chunk 34707d7a... to dynamic index 2 (offset 8328195, size 4012474)
successfully added chunk af2ff07c... to dynamic index 2 (offset 12340669, size 1194870)
```
Then reconstruct :
```
RE_ADD = re.compile(
r'successfully added chunk ([0-9a-f]{64}) to (?:dynamic|fixed) index (\d+) \(offset (\d+), size (\d+)\)')

for l in log.splitlines():
m = RE_ADD.search(l)
if m:
entries.setdefault(m.group(2), []).append(
(int(m.group(3)), int(m.group(4)), m.group(1)))

rows.sort(key=lambda r: r[0])
for off, sz, dg in rows:
out.write('%d\t%d\t%s\n' % (off, sz, dg))
```
And that solved it for me.
After that, I simplified and hardened my backup strategies !

Have a good one,
Ron.