1

I want send several zfs snapshots to another pool. Source pool "rpool", target pool "dpool"

rpool/kvm1380_img                               88,6G  1,48T     77,6G  -
rpool/kvm1380_img@snapshot_Sun_01_11_weekly     1,33G      -     77,6G  -
rpool/kvm1380_img@snapshot_Mon_02_11             746M      -     77,6G  -
rpool/kvm1380_img@snapshot_Tue_03_11             600M      -     77,5G  -
rpool/kvm1380_img@snapshot_Wed_04_11             843M      -     77,5G  -

I know how send one by one snapshot like:

zfs send -i rpool/kvm1380_img@snapshot_Sun_01_11_weekly rpool/kvm1380_img@snapshot_Mon_02_11 | zfs recv dpool/kvm1380_img@snapshot_Mon_02_11

the next one:

zfs send -i rpool/kvm1380_img@snapshot_Mon_02_11 rpool/kvm1380_img@snapshot_Tue_03_11 | zfs recv dpool/kvm1380_img@snapshot_Tue_03_11

and so on...

but I want send all snapshots at once to get everything same like rpool:

dpool/kvm1380_img                               88,6G  1,48T     77,6G  -
dpool/kvm1380_img@snapshot_Sun_01_11_weekly     1,33G      -     77,6G  -
dpool/kvm1380_img@snapshot_Mon_02_11             746M      -     77,6G  -
dpool/kvm1380_img@snapshot_Tue_03_11             600M      -     77,5G  -
dpool/kvm1380_img@snapshot_Wed_04_11           

How to do that?

1

Instead of the -i option, you can use the -I option to send an incremental stream that includes an entire set of multiple snapshots:

Generate a stream package that sends all intermediary snapshots from the first snapshot to the second snapshot. For example, -I @a fs@d is similar to -i @a fs@b; -i @b fs@c; -i @c fs@d. The incremental source may be specified as with the -i option.

For example:

zfs send -i rpool/kvm1380_img@snapshot_Sun_01_11_weekly rpool/kvm1380_img@snapshot_ Wed_04_11 | zfs recv ...

That example will send every snapshot from snapshot_Sun_01_11_weekly to snapshot_ Wed_04_11.

Or, you can send a full replication stream using the -R option:

Generate a replication stream package, which will replicate the specified file system, and all descendent file systems, up to the named snapshot. When received, all properties, snapshots, descendent file systems, and clones are preserved.

Something like this:

zfs snapshot -r rpool/kvm1380_img@latest
zfs send -R rpool/kvm1380_img@latest | zfs recv dpool/kvm1380_img

The target ZFS filesystem and the actual zfs recv ... command may vary. You might, for example, want to add the -u and/or the -o canmount=noauto to the zfs recv command to prevent the system from trying to mount the received filesystem(s).

And if you're going to send a full replication stream this way, it's probably best to receive the stream into a completely new ZFS filesystem. Trying to overlay a full replication stream over the top of an existing ZFS filesystem can be troublesome and hard to manage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.