Migrating from GELI to Native ZFS Encryption

TempleHasFallen

Dabbler
Joined
Jan 27, 2022
Messages
34
Hello,

I'm looking to migrate a whole pool (raidz2) to a new set of disks (also raidz2) and retain the full configuration (shares, datasets, permissions). Re-doing permissions for all the datasets is not an option. Downtime also has to be to a bare minimum.

Previously, I was able to halt all services, zfs send+receive a snapshot of the pool and then unmount, rename the datasets and remount.

However, since my old pool is GELI encrypted and the new one is native ZFS, I am receiving the following error:

Code:
zfs send -Rv current@expansion | zfs receive -Fv temp
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


If I am to do this per dataset, the datasets will carry over as such:

Code:
#!/bin/bash
for value in dataset1,dataset2,dataset3
do
    zfs send -Rv current/$value@migrate | zfs receive -v temp/$value
done



1656053595826.png


What is the correct way to move all datasets to a new pool while changing encryption and retaining permissions?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
ZFS replication is going to replicate the encrypted property too (and from a zfs perspective, your current pool isn't encrypted), so you're going to need to do it another way like with rsync (using the -a option to cover permissions).

Clearly you need to go ahead of yourself and create all the datasets you want first (or rsync will create subdirectories instead)
 

TempleHasFallen

Dabbler
Joined
Jan 27, 2022
Messages
34
ZFS replication is going to replicate the encrypted property too (and from a zfs perspective, your current pool isn't encrypted), so you're going to need to do it another way like with rsync (using the -a option to cover permissions).

Clearly you need to go ahead of yourself and create all the datasets you want first (or rsync will create subdirectories instead)
Is there no way to replicate without replicating all properties or omitting specific ones?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Maybe some of the answer is in this thread:
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Alternatively, you could use @Patrick M. Hausen's post on removing GELI encryption before reimplementing your datasets as ZFS-encrypted datasets:

 

TempleHasFallen

Dabbler
Joined
Jan 27, 2022
Messages
34
Thank you everyone for your assistance & replies.

As per this reply there is a way to omit the encryption when using replication, which I tested and seems to be having exactly the intended effect:

Code:
zfs send -R -v current/dataset@migrate | zfs receive -v -F -x encryption new/dataset


With the key being -x encryption to omit the encryption of the source pool.
 
Top