Bug 221707 - zfs receive dry run fails but backup works
Summary: zfs receive dry run fails but backup works
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.1-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-22 02:26 UTC by courtney.hicks1
Modified: 2017-08-23 12:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description courtney.hicks1 2017-08-22 02:26:58 UTC
On a FreeBSD 11.1 system, I created a zpool that contains all my jails that are created and managed with py3-iocage (built from ports) 0.99.1. I have set up my system to have zfs snapshots of the pool created and then backed up to an external hard drive connected via USB using zfs send/receive. Here is my process:

Create snapshot:
zfs snapshot -r iocage@`date +"%Y-%m-%d_%H:%M:%S"`

Initial backup:
zfs send -R iocage@date1 | zfs receive -vF backups/iocage

backups is the zpool on my external HDD, which is imported at an altroot

Incremental backup:
zfs send -R -i iocage@date1 iocage@date2 | zfs receive -vF backups/iocage


The problem:
Before I sent my initial backup to my external HDD I ran this command:
zfs send -R iocage@date1 | zfs receive -vnF backups/iocage

This, however, produced this error:

root@homeServer:~ # zfs send -R iocage@2017-08-19 | zfs receive -vnF backups/iocage
would receive full stream of iocage@2017-08-19 into backups/iocage@2017-08-19
would receive full stream of iocage/iocage@2017-08-19 into backups/iocage/iocage@2017-08-19
would receive full stream of iocage/iocage/download@2017-08-19 into backups/iocage/iocage/download@2017-08-19
would receive full stream of iocage/iocage/download/11.1-RELEASE@2017-08-19 into backups/iocage/iocage/download/11.1-RELEASE@2017-08-19
would receive full stream of iocage/iocage/download/10.3-RELEASE@2017-08-19 into backups/iocage/iocage/download/10.3-RELEASE@2017-08-19
would receive full stream of iocage/iocage/releases@2017-08-19 into backups/iocage/iocage/releases@2017-08-19
would receive full stream of iocage/iocage/releases/10.3-RELEASE@2017-08-19 into backups/iocage/iocage/releases/10.3-RELEASE@2017-08-19
would receive full stream of iocage/iocage/releases/10.3-RELEASE/root@2017-08-19 into backups/iocage/iocage/releases/10.3-RELEASE/root@2017-08-19
would receive full stream of iocage/iocage/releases/11.1-RELEASE@2017-08-19 into backups/iocage/iocage/releases/11.1-RELEASE@2017-08-19
would receive full stream of iocage/iocage/releases/11.1-RELEASE/root@nextcloud into backups/iocage/iocage/releases/11.1-RELEASE/root@nextcloud
cannot receive incremental stream: destination 'backups/iocage/iocage/releases/11.1-RELEASE/root' does not exist
warning: cannot send 'iocage/iocage/releases/11.1-RELEASE/root@minecraft': signal received
warning: cannot send 'iocage/iocage/releases/11.1-RELEASE/root@webServer': Broken pipe
warning: cannot send 'iocage/iocage/releases/11.1-RELEASE/root@plexMedia': Broken pipe
warning: cannot send 'iocage/iocage/releases/11.1-RELEASE/root@homeBackup': Broken pipe
warning: cannot send 'iocage/iocage/releases/11.1-RELEASE/root@reverseProxy': Broken pipe
warning: cannot send 'iocage/iocage/releases/11.1-RELEASE/root@2017-08-19': Broken pipe


I saw that it was saying backups/iocage/iocage/releases/11.1-RELEASE/root didn't exist, so I created that path, with each directory being its own zfs dataset (like it is on host). Once I did that, I got a new error:

zfs send -R iocage/iocage@2017-08-19 | zfs receive -vnF backups/iocage
would receive full stream of iocage/iocage@2017-08-19 into backups/iocage@2017-08-19
would receive full stream of iocage/iocage/download@2017-08-19 into backups/iocage/download@2017-08-19
would receive full stream of iocage/iocage/download/11.1-RELEASE@2017-08-19 into backups/iocage/download/11.1-RELEASE@2017-08-19
would receive full stream of iocage/iocage/download/10.3-RELEASE@2017-08-19 into backups/iocage/download/10.3-RELEASE@2017-08-19
would receive full stream of iocage/iocage/releases@2017-08-19 into backups/iocage/releases@2017-08-19
would receive full stream of iocage/iocage/releases/10.3-RELEASE@2017-08-19 into backups/iocage/releases/10.3-RELEASE@2017-08-19
would receive full stream of iocage/iocage/releases/10.3-RELEASE/root@2017-08-19 into backups/iocage/releases/10.3-RELEASE/root@2017-08-19
would receive full stream of iocage/iocage/releases/11.1-RELEASE@2017-08-19 into backups/iocage/releases/11.1-RELEASE@2017-08-19
would receive full stream of iocage/iocage/releases/11.1-RELEASE/root@nextcloud into backups/iocage/releases/11.1-RELEASE/root@nextcloud
would receive incremental stream of iocage/iocage/releases/11.1-RELEASE/root@minecraft into backups/iocage/releases/11.1-RELEASE/root@minecraft
would receive incremental stream of iocage/iocage/releases/11.1-RELEASE/root@webServer into backups/iocage/releases/11.1-RELEASE/root@webServer
would receive incremental stream of iocage/iocage/releases/11.1-RELEASE/root@plexMedia into backups/iocage/releases/11.1-RELEASE/root@plexMedia
would receive incremental stream of iocage/iocage/releases/11.1-RELEASE/root@homeBackup into backups/iocage/releases/11.1-RELEASE/root@homeBackup
would receive incremental stream of iocage/iocage/releases/11.1-RELEASE/root@reverseProxy into backups/iocage/releases/11.1-RELEASE/root@reverseProxy
would receive incremental stream of iocage/iocage/releases/11.1-RELEASE/root@2017-08-19 into backups/iocage/releases/11.1-RELEASE/root@2017-08-19
would receive full stream of iocage/iocage/templates@2017-08-19 into backups/iocage/templates@2017-08-19
would receive full stream of iocage/iocage/jails@2017-08-19 into backups/iocage/jails@2017-08-19
would receive full stream of iocage/iocage/jails/webServer@2017-08-19 into backups/iocage/jails/webServer@2017-08-19
cannot receive: local origin for clone backups/iocage/jails/webServer/root@2017-08-19 does not exist
warning: cannot send 'iocage/iocage/jails/webServer/root@2017-08-19': signal received


However, as I said, removing -n from my input, the error goes away and the send/receive is successful.
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2017-08-23 12:06:34 UTC
I am not sure that zfs can simulate reception of replications streams sufficiently well.  It lacks the machinery to simulate creation of new datasets which might be required to simulate reception of subordinate datasets.  But it does detect when a dataset that is supposed to be received already exists.

I am not sure if it is worth the trouble perfecting the dry mode.