Re: UFS snapshots and dump/restore
- In reply to: Sad Clouds : "UFS snapshots and dump/restore"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Mar 2024 13:08:17 UTC
On Fri, 29 Mar 2024 12:15:41 +0000
Sad Clouds <cryintothebluesky@gmail.com> wrote:
> Despite the nodump flag, /data/.snap/latest is still dumped and
> restored. This causes /data/.snap/latest to be reset to 0 bytes after
> running restore and the snapshot is lost. Any idea why such behaviour?
I think I know what's going on - inside the snapshot there is an empty
file with the same snapshot name. This is created before nodump is set.
To make dump/restore work without corrupting the original snapshot, I
had to rename the snapshot after creation.
Create snapshot and rename it:
# snapshot="/data/.snap/latest"
# mksnap_ffs ${snapshot}.tmp && chflags nodump ${snapshot}.tmp
# mv ${snapshot}.tmp ${snapshot}
Restore snapshot with dump then delete empty snapshot file:
# snapshot="/data/.snap/latest"
# cd $(dirname ${snapshot})/../ && dump -0 -a -h 0 -C 16 -b 64 -f - ${snapshot} | restore -xuvf -
# rm -f ${snapshot}.tmp