How to use zfs send | zfs recv to copy encrypted dataset in the same pool?

testcb00

Dabbler
Joined
Feb 3, 2021
Messages
31
I am redesigning my storage structure. Here is my current design (I follow winnielinnie's format to present)
  • pool1 <--- non encryption pool
    • root <--- the root dataset for normal data
      • dataset1 <--- inherited, no encryption scheme
      • securedata <--- encryption scheme, unlocked by passphrase (can be "locked")
        • dataset2 <--- inherited encryption scheme, inherits the same passphrase as "securedata"
          • dataset4 <--- inherited encryption scheme, inherits the same passphrase as "securedata"
          • dataset5 <--- inherited encryption scheme, inherits the same passphrase as "securedata
        • dataset3 <--- inherited encryption scheme, inherits the same passphrase as "securedata"
    • secureroot <--- New dataset, encryption scheme, unlocked by passphrase (can be "locked")
My target is to move the dataset inside the securedata to secureroot.
  • pool1 <--- non encryption pool
    • root <--- the root dataset for normal data
      • dataset1 <--- inherited, no encryption scheme
    • secureroot <--- New dataset, encryption scheme, unlocked by passphrase (can be "locked")
      • dataset2 <--- inherited encryption scheme, inherits the same passphrase as "secureroot"
        • dataset4 <--- inherited encryption scheme, inherits the same passphrase as "securedata
        • dataset5 <--- inherited encryption scheme, inherits the same passphrase as "securedata
      • dataset3 <--- inherited encryption scheme, inherits the same passphrase as "secureroot"
To create a snapshot, I use
zfs snap -r pool1@snap1
However, I don't know the next step.

I have tried
zfs send -v -w -R pool1/root/securedata/dataset2@snap1 | zfs recv -v -d -F pool1/secureroot

The result becomes
  • pool1 <--- non encryption pool
    • root <--- the root dataset for normal data
      • dataset1 <--- inherited, no encryption scheme
      • securedata <--- encryption scheme, unlocked by passphrase (can be "locked")
        • dataset2 <--- inherited encryption scheme, inherits the same passphrase as "securedata"
        • dataset3 <--- inherited encryption scheme, inherits the same passphrase as "securedata"
    • secureroot <--- New dataset, encryption scheme, unlocked by passphrase (can be "locked")
      • root <--- the root dataset for normal data
        • securedata <--- encryption scheme, unlocked by passphrase (can be "locked")
          • dataset2 <--- inherited encryption scheme, inherits the same passphrase as "securedata"
            • dataset4 <--- inherited encryption scheme, inherits the same passphrase as "securedata
            • dataset5 <--- inherited encryption scheme, inherits the same passphrase as "securedata
I don't know why it includes the parent dataset...
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I'm not sure if you even need to do that and don't know why it's doing the additional level...

zfs rename pool1/root/securedata/dataset2 pool1/secureroot/dataset2

Or is it that you really need an additional copy?
 

testcb00

Dabbler
Joined
Feb 3, 2021
Messages
31
I'm not sure if you even need to do that and don't know why it's doing the additional level...

zfs rename pool1/root/securedata/dataset2 pool1/secureroot/dataset2

Or is it that you really need an additional copy?
Thank you, sretalla, I already use this command to move the dataset, but I also want to know the method of an additional copy.
 
Top