Re: simple question regarding moving zfs filesystems

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 27 May 2021 10:00:32 UTC
On 27 May 2021, at 07:47, tech-lists <tech-lists@zyxst.net> wrote:
> 
> Is it the case that, if I want to transfer filesystems from one pool to
> another, that the descendant filesystems/vols will also be transferred?
> 
> lets say there is one zpool called "data" and another called "new"
> 
> zfs list shows:
> 
> NAME                 USED   AVAIL     REFER MOUNTPOINT
> data/pkg             32.2K  5.88T     32.2K /usr/local/etc/pkg
> data/poudriere       22.9G  5.88T     31.4K /poudriere
> data/poudriere-bulk  164G   5.88T     164G  /usr/local/poudriere
> data/poudriere/jails 22.9G  5.88T     37.4K /poudriere/jails
> data/vm1             256G   5.88T     256G  -
> 
> if I do zfs snapshot data@snapshot1 and then:
> 
> zfs send data@snapshot1 | zfs receive new
> 
> will what's in data and data/pkg data/poudriere etc appear under new ?
> will characteristics like compression remain the same?
> On data compression=lz4 on new it's zstd.

I think you can use "zfs send -R" to achieve what you want:

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

                 If the -i or -I flags are used in conjunction with the -R
                 flag, an incremental replication stream is generated. The
                 current values of properties, and current snapshot and file
                 system names are set when the stream is received. If the -F
                 flag is specified when this stream is received, snapshots and
                 file systems that do not exist on the sending side are
                 destroyed.

-Dimitry