Open dpremy opened 11 months ago
Yes, setting the path to a snapshot will not change anything thats stored inside the container template. Those paths are still the "normal" ones.
I dont know if the plugin should handle this or if another solution for backing up zfs snaps is better.
I understand the hesitation. ZFS is newer to unRAID, likely a small subset of users need this, and if you aren't careful, it could expand in scope quickly. While this could be reproduced with a copy/sync of some sort, via a pre-backup script, that too seems like a rare edge case.
On the flip side, supporting something like this could take the time containers are stopped from hours/minutes, to under 10 seconds. Advanced usage, yes, but significant returns for larger containers.
In my use case I do have a container which is a few gb, and backups take nearly an hour. With current options in the plugin, the container is down during backup. If this snapshot method is supported for Internal and External volumes, I could have the container restarted in a matter of seconds, and then just backup the volumes as time permits.
I believe this could be supported with a few changes:
Maybe a simple native zfs snapshot support would be sufficient? The plugin could stop all containers, create a snapshot, start all containers and doing its backup by adjusting the paths.
FTR:
So, this ticket is about ZFS snapshot support, if docker uses a zfs storage.
The plugin neds to:
Right?
Essentially, it seems the logic for finding the Internal appdata directories doesn't account for changes to the root path, say when using a ZFS snapshot.
I think this could be recreated without ZFS by copying appdata to any other location, and then using that copied location as the source of the backups in the plugin, but I've not verified this.
I suspect the issue is in isVolumeWithinAppdata and the str_starts_with. PHP isn't my forte, though I'll see if I can do some testing and get working code.
As an aside, a little additional debug logging in isVolumeWithinAppdata would help surface this, right before the if, and possibly an else to log unmatched volumes.
Recreating Issue
Create a ZFS Pool which hosts the appdata directory
Use a Pre-backup script to take a ZFS snapshot with a static name. In my case, I destroy any previous offline-backup snapshot, then create a new snapshot; keeping previous snapshots of this name are not needed.
Verify the snapshot was created
Confirm the snapshot can be accessed
ls /mnt/user/appdata/.zfs/snapshot/offline-backup
Set the Appdata source in the plugin to this snapshot location of
/mnt/user/appdata/.zfs/snapshot/offline-backup
All containers now have no Internal Volumes in the Per container settings, and reviewing a backup log you will find related messages
Logs
Standard
Debug