ZFS: Difference between revisions

imported>Mic92
encrypted zroot can be also recovered
imported>Mic92
explicit snapshot not required
Line 276: Line 276:
If you've followed this wiki entry and didn't create an encrypt top-level dataset but a child-dataset, e.g. zroot/root/nixos where zroot is the name of the pool and the top-level dataset and root is the encrypted child-dataset, then you can easily use zfs send/recv to migrate it to the new format.
If you've followed this wiki entry and didn't create an encrypt top-level dataset but a child-dataset, e.g. zroot/root/nixos where zroot is the name of the pool and the top-level dataset and root is the encrypted child-dataset, then you can easily use zfs send/recv to migrate it to the new format.


# Create a snapshot:<br/><code>zfs snapshot zpool/root/nixos@now</code>
# Create a custom NixOS iso with crypto stability patch enabled
# Create a custom NixOS iso with crypto stability patch enabled
# Boot into that live environment
# Boot into that live environment
# Import the pool and load the key
# Import the pool and load the key
# Create a new encrypted dataset, e.g.<br/><code>zfs create -o encryption=aes-256-gcm -o keyformat=passphrase -o mountpoint=none zroot/rootNEW</code>
# Create a new encrypted dataset, e.g.<br/><code>zfs create -o encryption=aes-256-gcm -o keyformat=passphrase -o mountpoint=none zroot/rootNEW</code>
# Use zfs send and receive to copy the data to new format:<br/><code>zfs send zpool/root/nixos@now | zfs receive zpool/rootNew/nixos</code>
# Use zfs send and receive to copy the data to new format:<br/><code>zfs send zpool/root/nixos | zfs receive zpool/rootNew/nixos</code>
# Set correct mountpoint for the newly created dataset:<br/><code>zfs set moutpoint=legacy zpool/root/New/nixos</code>
# Set correct mountpoint for the newly created dataset:<br/><code>zfs set moutpoint=legacy zpool/root/New/nixos</code>
# Rename the old and new datasets:<br/><code>zfs rename zpool/root zpool/rootOLD</code><br/><code>zfs rename zpool/rootNEW zpool/root</code>
# Rename the old and new datasets:<br/><code>zfs rename zpool/root zpool/rootOLD</code><br/><code>zfs rename zpool/rootNEW zpool/root</code>