Project

General

Profile

Bug #9938

Add zfs send "backup" support (zfs send -b)

Added by Ezomori Nozomu almost 2 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
zfs - Zettabyte File System
Start date:
2018-10-29
Due date:
% Done:

0%

Estimated time:
Difficulty:
Tags:
Gerrit CR:

Description

This is a request to add zfs send "-b" to OpenZFS: this allows users to send only received properties.

-b
    Sends only received property values whether or not they are overridden 
    by local settings, but only if the dataset has ever been received.
    Use this option when you want zfs receive to restore received properties 
    backed up on the sent dataset and to avoid sending local settings that 
    may have nothing to do with the source dataset, but only with how the 
    data is backed up.

Possible use case: suppose we have system-n1 with its rpool

root@linux:~# zfs list
NAME         USED  AVAIL  REFER  MOUNTPOINTK  none
rpool        171K   368M    24K  /
rpool/home    24K   368M    24K  /home
rpool/root    24K   368M    24K  /root
rpool/var     24K   368M    24K  /var

We want to backup its contents to a centralized storage, but since receiving multiple systems would result in overlapping mountpoints ("/" from system-n1, "/" from another system-n2, "/" from system-xyz) we use zfs receive -x mountpoint to prevent any mount issue:

root@linux:~# zfs snap -r rpool@backup-1
root@linux:~# zfs send -R rpool@backup-1 | zfs recv -x mountpoint backup/rpool-system-n1
root@linux:~# zfs send -R rpool@backup-1 | zfs recv -x mountpoint backup/rpool-system-n2
root@linux:~# zfs send -R rpool@backup-1 | zfs recv -x mountpoint backup/rpool-system-n3
root@linux:~# zfs get -o all mountpoint -r backup
NAME                                  PROPERTY    VALUE       RECEIVED  SOURCE
backup                                mountpoint  none        -         local
backup/rpool-system-n1                mountpoint  none        /         inherited from backup
backup/rpool-system-n1@backup-1       mountpoint  -           -         -
backup/rpool-system-n1/home           mountpoint  none        -         inherited from backup
backup/rpool-system-n1/home@backup-1  mountpoint  -           -         -
backup/rpool-system-n1/root           mountpoint  none        -         inherited from backup
backup/rpool-system-n1/root@backup-1  mountpoint  -           -         -
backup/rpool-system-n1/var            mountpoint  none        -         inherited from backup
backup/rpool-system-n1/var@backup-1   mountpoint  -           -         -
backup/rpool-system-n2                mountpoint  none        /         inherited from backup
backup/rpool-system-n2@backup-1       mountpoint  -           -         -
backup/rpool-system-n2/home           mountpoint  none        -         inherited from backup
backup/rpool-system-n2/home@backup-1  mountpoint  -           -         -
backup/rpool-system-n2/root           mountpoint  none        -         inherited from backup
backup/rpool-system-n2/root@backup-1  mountpoint  -           -         -
backup/rpool-system-n2/var            mountpoint  none        -         inherited from backup
backup/rpool-system-n2/var@backup-1   mountpoint  -           -         -
backup/rpool-system-n3                mountpoint  none        /         inherited from backup
backup/rpool-system-n3@backup-1       mountpoint  -           -         -
backup/rpool-system-n3/home           mountpoint  none        -         inherited from backup
backup/rpool-system-n3/home@backup-1  mountpoint  -           -         -
backup/rpool-system-n3/root           mountpoint  none        -         inherited from backup
backup/rpool-system-n3/root@backup-1  mountpoint  -           -         -
backup/rpool-system-n3/var            mountpoint  none        -         inherited from backup
backup/rpool-system-n3/var@backup-1   mountpoint  -           -         -


This all works fine until we have to restore system-n1 rpool: when we try to send its data the property value of mountpoint is not sent because its effective values is none (forcefully inherited by the zfs receive -x operation):
root@linux:~# zfs send -R backup/rpool-system-n1@backup-1 | zstreamdump -v | grep mountpoint
root@linux:~#

With this functionality we could send the original (received) property values to the "restore" pool:

root@linux:~# zfs send -bR backup/rpool-system-n1@backup-1 | zstreamdump -v | grep mountpoint
                mountpoint = /
root@linux:~# zfs send -bR backup/rpool-system-n1@backup-1 | zfs recv -uF restore
root@linux:~# zfs get -o all mountpoint -r restore
NAME                   PROPERTY    VALUE       RECEIVED  SOURCE
restore                mountpoint  /           /         received
restore@backup-1       mountpoint  -           -         -
restore/home           mountpoint  /home       -         inherited from restore
restore/home@backup-1  mountpoint  -           -         -
restore/root           mountpoint  /root       -         inherited from restore
restore/root@backup-1  mountpoint  -           -         -
restore/var            mountpoint  /var        -         inherited from restore
restore/var@backup-1   mountpoint  -           -         -
root@linux:~#

Related issues

Related to illumos gate - Bug #8073: zfs: 7268 added non-existent option 'b' for send not handled in the switchNew2017-04-14

Actions
#1

Updated by Ezomori Nozomu almost 2 years ago

  • Related to Bug #8073: zfs: 7268 added non-existent option 'b' for send not handled in the switch added

Also available in: Atom PDF