Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dest_auto_create + raw_send = error #96

Open
DragonQ opened this issue Feb 14, 2023 · 5 comments
Open

dest_auto_create + raw_send = error #96

DragonQ opened this issue Feb 14, 2023 · 5 comments

Comments

@DragonQ
Copy link

DragonQ commented Feb 14, 2023

What's the correct way to send an encrypted dataset to a remote pool with no existing dataset? I'm using these options:

[source/backups]
daily = 7
snap = yes
clean = yes
raw_send = yes
dest_auto_create=yes
dest = ssh:22:root@backup-nas:backups/backups
dest_keys = /home/user/.ssh/id_rsa

[ssh:22:root@backup-nas:backups/backups]
daily = 7
snap = no
clean = yes
key = /home/user/.ssh/id_rsa

When I run pyznap send, I get this error:

Feb 14 20:18:35 INFO: Destination root@backup-nas:backups/backups does not exist, will create it...
Feb 14 20:18:35 INFO: Successfully created root@backup-nas:backups/backups...
Feb 14 20:18:35 DEBUG: Sending source/backups to root@backup-nas:backups/backups...
Feb 14 20:18:35 INFO: No common snapshots on root@backup-nas:backups/backups, sending oldest snapshot source/backups@pyznap_2023-02-14_02:00:03_yearly (~216.3G)...
Feb 14 20:18:35 DEBUG: Using raw zfs send...
Feb 14 20:18:35 DEBUG: Using mbuffer on source: 'mbuffer -q -s 128K -m 256M'...
Feb 14 20:18:35 DEBUG: Using pv on source: 'pv -f -w 100 -s 315990178336 -D 60 -i 60'...
Feb 14 20:18:35 ERROR: Error while sending to root@backup-nas:backups/backups: cannot receive new filesystem stream: zfs receive -F cannot be used to destroy an encrypted filesystem or overwrite an unencrypted one with an encrypted one...

Is there a "proper" way to do this without manually creating a dataset on the destination pool?

@DragonQ
Copy link
Author

DragonQ commented Mar 8, 2023

For anyone with the same issue, I was able to workaround this manually by finding the oldest snapshot (first shown when running zfs list -t snapshot source/backups), then running the following command:

sudo zfs send -p -w source/backups@pyznap_oldest_snapshot | pv | ssh backup-nas sudo zfs recv backups/backups

Pyznap then works as normal after removing the dest_auto_create option. It would be nice if this manual step wasn't necessary for encrypted datasets though.

@yboetz
Copy link
Owner

yboetz commented Mar 8, 2023

Sorry, I totally missed this question. I never used encrypted datasets, so I'm actually not too familiar with how they work with zfs send/recv. Would it also work if you just create the dataset and then use pyznap without the dest_auto_create? Or does there need to be a snapshot on the dataset before it works?

@DragonQ
Copy link
Author

DragonQ commented Mar 22, 2023

I manually create a destination dataset, then do a sudo pyznap send -s source/test1 -d ssh:22:root@backup-nas:backups/test1 -w, I get the same error as above.

@yboetz
Copy link
Owner

yboetz commented Apr 2, 2023

Hm no idea what exactly is causing this. I never worked with encrypted datasets, so no experience there on how exactly they behave with zfs send/recv.

@ddemuro
Copy link

ddemuro commented Apr 3, 2023

I had the same problem so I submitted a PR for this specific case #101

With raw send you should not create the destination since it'll always complain that the dest doesn't match source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants