Solved ZFS replicate whole pool

I have backup on my whole src pool, stored on the server: data/backup/src_pool.
Backup was made with
Code:
zfs snapshot -r src_pool@migrate
zfs send -Rv src_pool@migrate | zfs recv data/backup/src_pool

Now I am trying to restore it to the root of the new pool
Code:
zfs create new_pool ...
zfs snapshot -r data/backup/src_pool@migrated
zfs send -Rv data/backup/src_pool@migrated | zfs recv -Fd new_pool


But it ends up as children children of the new pool:
Code:
% zfs list -rHo name zfs-arm
new_pool
new_pool/ROOT
new_pool/backup
new_pool/backup/src_pool
new_pool/backup/src_pool/ROOT
new_pool/backup/src_pool/ROOT/be1
new_pool/backup/src_pool/home
new_pool/backup/src_pool/var

zfs rename can rename datasets which are children, but can't rename it to the root of the pool
Code:
zfs rename new_pool/backup src_pool
cannot create 'src_pool: missing dataset name
zfs rename new_pool/backup/src_pool/ROOT new_pool/ROOT
zfs rename new_pool/backup/src_pool/home new_pool/home
zfs rename new_pool/backup/src_pool/var  new_pool/var
But that seems rather inefficient (and I still need to manually rsync new_pool/backup/ to new_pool/).

How to end with restored pool without backup child dataset, eg:
Code:
new_pool
new_pool/ROOT
new_pool/ROOT/be1
new_pool/home
new_pool/var

How to replicate my whole ZFS pool to backup server and how to restore it later to the new pool (whole pool not just children datasets)? zvols?
 
Back
Top