Data Source: Mount archives before backup #1273

Open
opened 2026-02-24 20:52:28 +00:00 by margau · 6 comments

What I'd like to do and why

Hi all,
I run borgmatic on Proxmox Servers, with the intention of efficently backup up the guest snapshops.

Proxmox usually places backups of the guests as .tar (or similar) in /var/lib/vz/dump, one tar per backup.
Even if leaving the archives uncompressed and tweaking the chunker_params, it is not really efficent in deduplicating the content.

This would be probably better if it would be possible to backup the tar "content" file-based, instead of the complete tar file as a single file.

Therefore I'd like to suggest an option to add a "archive-unpack" as a data source, mounting the archive and backing up the content file by file. This should result (in my understanding) in much better deduplication.

Right now I'm experimenting with ratarmount ( find . -type f -name '*.tar' -exec ratarmount {} \;), although that is not too successful yet.

I'm of course open for discussions, other ideas etc.

Other notes / implementation ideas

No response

### What I'd like to do and why Hi all, I run borgmatic on Proxmox Servers, with the intention of efficently backup up the guest snapshops. Proxmox usually places backups of the guests as .tar (or similar) in /var/lib/vz/dump, one tar per backup. Even if leaving the archives uncompressed and tweaking the chunker_params, it is not really efficent in deduplicating the content. This would be probably better if it would be possible to backup the tar "content" file-based, instead of the complete tar file as a single file. Therefore I'd like to suggest an option to add a "archive-unpack" as a data source, mounting the archive and backing up the content file by file. This should result (in my understanding) in much better deduplication. Right now I'm experimenting with [ratarmount](https://github.com/mxmlnkn/ratarmount) (` find . -type f -name '*.tar' -exec ratarmount {} \;`), although that is not too successful yet. I'm of course open for discussions, other ideas etc. ### Other notes / implementation ideas _No response_
Owner

Thanks for filing this. Here are my initial thoughts:

  • An "archive-unpack" data source is an interesting idea. If it worked anything like the existing data sources, its configuration would accept a single tarball path at a time (so you could list multiple). And then upon borgmatic create, it would untar each tarball—maybe into a temporary directory—and send the data to Borg (separately from any source files).
  • I'm not sure what the restore story would be for this though. Maybe restoring would produce a tarball from the stored files? And then you could use whatever Proxmox restore command you like on it?
  • Since you're presumably dumping these tarballs with vzdump (directly or indirectly), what do you think of instead having a native Proxmox/vzdump data source? That would allow borgmatic to potentially direct the dump. borgmatic still probably couldn't stream the dump directly to Borg, because storing a streamed tarball wouldn't actually solve your deduplication problem. But it could, for instance, call vzdump --stdout and pipe that into a tar extract command to write the result into a temporary directory on the fly. And then Borg could be pointed at that temp directory.
  • This kind of approach would be more in line with (not yet implemented) data sources for other VM stacks. E.g., see #252.
  • On the other hand, the benefit of an "archive-unpack" data source is it might be useful for a broader set of use cases.
Thanks for filing this. Here are my initial thoughts: * An "archive-unpack" data source is an interesting idea. If it worked anything like the existing data sources, its configuration would accept a single tarball path at a time (so you could list multiple). And then upon `borgmatic create`, it would untar each tarball—maybe into a temporary directory—and send the data to Borg (separately from any source files). * I'm not sure what the restore story would be for this though. Maybe restoring would produce a tarball from the stored files? And then you could use whatever Proxmox restore command you like on it? * Since you're presumably dumping these tarballs with [`vzdump`](https://pve.proxmox.com/pve-docs/vzdump.1.html) (directly or indirectly), what do you think of instead having a native Proxmox/vzdump data source? That would allow borgmatic to potentially direct the dump. borgmatic still probably couldn't stream the dump directly to Borg, because storing a streamed tarball wouldn't actually solve your deduplication problem. But it could, for instance, call `vzdump --stdout` and pipe that into a tar extract command to write the result into a temporary directory on the fly. And then Borg could be pointed at that temp directory. * This kind of approach would be more in line with (not yet implemented) data sources for other VM stacks. E.g., see #252. * On the other hand, the benefit of an "archive-unpack" data source is it might be useful for a broader set of use cases.
Owner

More ideas:

  • Instead of using vzdump at all, borgmatic could freeze the container, bind mount the rootfs, and point Borg at it directly. (Then unfreeze the container afterwards.) No intervening tarball to worry about that way.
More ideas: * Instead of using `vzdump` at all, borgmatic could freeze the container, bind mount the rootfs, and point Borg at it directly. (Then unfreeze the container afterwards.) No intervening tarball to worry about that way.
Author

Hi,
thanks for the thoughts!

In my point of view, vzdump and "archive-unpack" would be both independently from each other a interesting idea. vzdump directly obviously would avoid a "middle step", while being tight more direct to proxmox, thats why I came up with the tar idea which could fit more use cases.

Regarding the restore, for all ideas (including the container freeze) it would be important that a "pve-compatible" backup file (ideal: a content-side identical archive) could be restored to import the VM in another hypervisor etc. (scenario: A hypervisor had a catastrophic failure, the VM is needed up and running in another one from the backup).

Hi, thanks for the thoughts! In my point of view, vzdump and "archive-unpack" would be both independently from each other a interesting idea. vzdump directly obviously would avoid a "middle step", while being tight more direct to proxmox, thats why I came up with the tar idea which could fit more use cases. Regarding the restore, for all ideas (including the container freeze) it would be important that a "pve-compatible" backup file (ideal: a content-side identical archive) could be restored to import the VM in another hypervisor etc. (scenario: A hypervisor had a catastrophic failure, the VM is needed up and running in another one from the backup).
Owner

@margau wrote in #1273 (comment):

Hi, thanks for the thoughts!

In my point of view, vzdump and "archive-unpack" would be both independently from each other a interesting idea. vzdump directly obviously would avoid a "middle step", while being tight more direct to proxmox, thats why I came up with the tar idea which could fit more use cases.

Sounds like you have a preference for the "archive-unpack" approach at this point?

Regarding the restore, for all ideas (including the container freeze) it would be important that a "pve-compatible" backup file (ideal: a content-side identical archive) could be restored to import the VM in another hypervisor etc. (scenario: A hypervisor had a catastrophic failure, the VM is needed up and running in another one from the backup).

Could you say a little more about this? Is the idea that, for the archive unpack approach for instance, a restore would reconstruct a "pve-compatible" tarball at the same path that it started at when it was originally backed up? And it would be "pve-compatible" by virtue of being the exact same data that was in there to begin with?

@margau wrote in https://projects.torsion.org/borgmatic-collective/borgmatic/issues/1273#issuecomment-13667: > Hi, thanks for the thoughts! > > In my point of view, vzdump and "archive-unpack" would be both independently from each other a interesting idea. vzdump directly obviously would avoid a "middle step", while being tight more direct to proxmox, thats why I came up with the tar idea which could fit more use cases. Sounds like you have a preference for the "archive-unpack" approach at this point? > Regarding the restore, for all ideas (including the container freeze) it would be important that a "pve-compatible" backup file (ideal: a content-side identical archive) could be restored to import the VM in another hypervisor etc. (scenario: A hypervisor had a catastrophic failure, the VM is needed up and running in another one from the backup). Could you say a little more about this? Is the idea that, for the archive unpack approach for instance, a restore would reconstruct a "pve-compatible" tarball at the same path that it started at when it was originally backed up? And it would be "pve-compatible" by virtue of being the exact same data that was in there to begin with?
Author

Hi,
I guess archive-unpack as the "most generic version" would be the most useful also for other usecases.

Regarding the restore path:
Proxmox just wants to have the tar file "somewhere", so it can be piped by hand using pct restore or qmrestore. An automated restore probably won't be that useful, as the use case with a "restore" would likely mean moving to another host etc.

That means from my perspective:
Yes, archive-unpack would just place the archive in the same location as before the backup (especially as this is not proxmox-related, but generic). In my understanding, pve-compatible just means "the same tar archive contents" for the "archive-unpack" variant-

It could be a bit more interesting for the vzdump --stdout approach (where it would also need an archive which could be restored by the commands above, but for me it is not clear "where" that would be).

Hi, I guess archive-unpack as the "most generic version" would be the most useful also for other usecases. Regarding the restore path: Proxmox just wants to have the tar file "somewhere", so it can be piped by hand using `pct restore` or `qmrestore`. An automated restore probably won't be that useful, as the use case with a "restore" would likely mean moving to another host etc. That means from my perspective: Yes, archive-unpack would just place the archive in the same location as before the backup (especially as this is not proxmox-related, but generic). In my understanding, pve-compatible just means "the same tar archive contents" for the "archive-unpack" variant- It could be a bit more interesting for the `vzdump --stdout` approach (where it would also need an archive which could be restored by the commands above, but for me it is not clear "where" that would be).
Owner

Got it, thank you. That's helpful. Okay, here's what I'm thinking for the archive-unpack in terms of configuration UX. Something like:

tarballs:
    - name: guest1
      path: /var/lib/guest1.tar.gz
      label: Proxmox guest 1
      restore_path: /var/lib/restores/guest1.tar.gz
    - name: guest2
      path: /var/lib/guest2.tar.gz
      label: Proxmox guest 2

Only name and path would be required. The implicit restore path would default to path unless restore_path overrides it.

Let me know if you have any feedback.

Got it, thank you. That's helpful. Okay, here's what I'm thinking for the archive-unpack in terms of configuration UX. Something like: ```yaml tarballs: - name: guest1 path: /var/lib/guest1.tar.gz label: Proxmox guest 1 restore_path: /var/lib/restores/guest1.tar.gz - name: guest2 path: /var/lib/guest2.tar.gz label: Proxmox guest 2 ``` Only `name` and `path` would be required. The implicit restore path would default to `path` unless `restore_path` overrides it. Let me know if you have any feedback.
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1273
No description provided.