Hello,
Trivial task. Create backup of system bootable zfs pool with several datasets and then restore it.
system:
pool:
zfs datatests:
create backup:
delete snapshot:
trying to restore saved stream to snapshot for further restore (rollback):
Actually I expected that zfs creates zsys@restore snapshot and push there data from my stream recursively in the same sequence as it was created.
As expected when I try to restore to bootable and mounted FS I get error:
Please explain me how can I make backup/restore operation using zfs send/receive? Perhaps I make some mistakes while zfs send operation.
Don't offer me to backup every dataset separately and restore it accordingly.
zfs guru, help.
Trivial task. Create backup of system bootable zfs pool with several datasets and then restore it.
system:
Code:
root@:~ # uname -a
FreeBSD 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr 9 04:24:09 UTC 2021 [email]root@releng1.nyi.freebsd.org[/email]:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
pool:
Code:
root@:~ # zpool status -v
pool: zsys
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
zsys ONLINE 0 0 0
gpt/BSD ONLINE 0 0 0
errors: No known data errors
root@:~ #
zfs datatests:
Code:
root@:~ # zfs list
NAME USED AVAIL REFER MOUNTPOINT
zsys 2.38G 12.6G 24K none
zsys/ROOT 2.38G 12.6G 24K none
zsys/ROOT/default 2.38G 12.6G 2.38G /
create backup:
Code:
root@:~ # zfs snapshot -r zsys@backup
root@:~ # zfs send -Rv zsys@backup | xz > [email]zsys@backup.xz[/email]
Code:
root@:~ # zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
zsys@backup 0B - 24K -
zsys/ROOT@backup 0B - 24K -
zsys/ROOT/default@backup 784K - 2.38G -
root@:~ #
delete snapshot:
Code:
root@:~ # zfs destroy -r zsys@backup
root@:~ # zfs list -t snapshot
no datasets available
root@:~ #
trying to restore saved stream to snapshot for further restore (rollback):
Code:
root@:~ # xz -cdk [email]zsys@backup.xz[/email] | zfs receive -dv zsys@restore
cannot receive: specified fs (zsys@restore) does not exist
root@:~ #
Code:
root@:~ # zfs snapshot -r zsys@restore
root@:~ # zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
zsys@restore 0B - 24K -
zsys/ROOT@restore 0B - 24K -
zsys/ROOT/default@restore 0B - 2.38G -
root@:~ #
root@:~ # xz -cdk [email]zsys@backup.xz[/email] | zfs receive -dv zsys@restore
cannot receive: cannot specify snapshot name for multi-snapshot stream
root@:~ #
As expected when I try to restore to bootable and mounted FS I get error:
Code:
root@:~ # xz -cdk [email]zsys@backup.xz[/email] | zfs receive -Fv zsys
cannot unmount '/': unmount failed
root@:~ #
Please explain me how can I make backup/restore operation using zfs send/receive? Perhaps I make some mistakes while zfs send operation.
Don't offer me to backup every dataset separately and restore it accordingly.
zfs guru, help.