borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
11.09k stars 738 forks source link

Improve ZFS snapshot support, replace file name, correct symlinks in mount and restore #6976

Open chaerle opened 2 years ago

chaerle commented 2 years ago

If you backup a ZFS filesystem (e.g. /tank/test), it is a good advice to take ZFS snapshot before to ensure consistency. However if borg is used to backup the hidden .zfs folder (/tank/test/snapshot/.zfs/mysnapshot) or if the snapshot is mounted at another mount point (/mnt/backupsnapshot/test), all absolute symlinks in the backup have wrong paths. If you mount such an backup with org, it is impossible to access the correct files. Also it is not possible to restore a consistent filesystem with another mount point.

Suggestion: 1) Add an option for for file name replacement during backup so that the created backup from the snapshot is identical as if it was taken from the original filesystem. In the example above the file path /tank/test/snapshot/.zfs/mysnapshot has to be replaced with /tank/test in the backup.

2) If a backup is mounted via "borg mount" at a different location as where the backup has been created from, all symlinks are point to wrong data. It should be possible to have an option, that absolute symlinks will be followed inside the backup instead of pointing outside the backup.

3) If you restore a backup to a different location the same as in 2 should be true for symlinks, i.e. it the symlinks should be corrected. It least there should be an option for that.

ThomasWaldmann commented 2 years ago

Can you try if it works better if you: