Hello everyone,
this is my zpool and I have encrypted datasets on it. So far so good!
pool: tank
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD4002FYYZ-01B7CB1_K3GXMK3L ONLINE 0 0 0
ata-WDC_WD4002FYYZ-01B7CB1_K3GXMW2L ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
ata-WDC_WD4002FYYZ-01B7CB1_K3GXR4YL ONLINE 0 0 0
ata-WDC_WD4002FYYZ-01B7CB1_K3GY56HL ONLINE 0 0 0
errors: No known data errors
And this is my encrypted dataset with children.
NAME USED AVAIL REFER MOUNTPOINT
tank 168G 6.96T 96K none
tank/data 115G 6.96T 192K none
tank/data/a 10.1G 6.96T 10.1G /mnt/a
tank/data/b 23.4G 6.96T 23.4G /mnt/b
tank/data/c 81.8G 6.96T 81.8G /mnt/c
I used to have this structure on a “normal” dataset and I could make offline backups easily with zfs send -R | zfs recv on an external HDD. I want to do this in case the house is burning, lightning is damaging something or whatever could happen. I have done that since FreeBSD 10. Now that OpenZFS 2.0 is available on GNU/Linux I gave Ubuntu Server 22.04 a try and I chose to encrypt the dataset. But no matter what I do, I can not receive the dataset on the HDD. I currently have it formatted as EXT4 and I do zfs send -Rw tank/data@snap > /mnt/usb/backup.zfs in order to have at least something outside the house in case I need to recover.
Here is some additional information.
This is the first few lines of a zpool history so you can see what I do to create those datasets. Maybe I do something wrong here already
History for 'tank':
2022-06-30.09:21:52 zpool create -m none -o ashift=12 tank mirror /dev/disk/by-id/ata-WDC_WD4002FYYZ-01B7CB1_K3GXMK3L /dev/disk/by-id/ata-WDC_WD4002FYYZ-01B7CB1_K3GXMW2L mirror /dev/disk/by-id/ata-WDC_WD4002FYYZ-01B7CB1_K3GXR4YL /dev/disk/by-id/ata-WDC_WD4002FYYZ-01B7CB1_K3GY56HL
2022-06-30.09:28:54 zfs create tank/vm -o compression=lz4 -o xattr=sa -o recordsize=64K -o atime=off -o mountpoint=none -o encryption=on -o keyformat=raw -o keylocation=file:///mnt/zfskey/zfs.key
2022-06-30.09:29:35 zfs create tank/vm/test -o mountpoint=none
2022-06-30.09:30:50 zfs destroy tank/vm/test
2022-06-30.09:31:17 zfs create tank/data -o compression=lz4 -o xattr=sa -o recordsize=64K -o atime=off -o mountpoint=none -o encryption=on -o keyformat=raw -o keylocation=file:///mnt/zfskey/zfs.key
2022-06-30.09:32:42 zfs create tank/vm/win2k16 -o mountpoint=/mnt/win2k16
2022-06-30.09:32:49 zfs create tank/vm/win2k19 -o mountpoint=/mnt/win2k19
2022-06-30.09:32:58 zfs create tank/vm/unifi -o mountpoint=/mnt/unifi
2022-06-30.09:33:14 zfs create tank/vm/wireguard -o mountpoint=/mnt/wireguard
And this is how it fails. I am clearly missing something here.
fox@owl:~$ sudo zfs send -vRw tank/data@dienstag | sudo zfs recv -F zbackup/data
full send of tank/data@dienstag estimated size is 69.6K
full send of tank/data/a@dienstag estimated size is 23.3G
full send of tank/data/b@dienstag estimated size is 9.95G
full send of tank/data/c@dienstag estimated size is 81.6G
total estimated size is 115G
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
fox@owl:~$ sudo zfs send -vRw tank/data@dienstag | sudo zfs recv zbackup/data
full send of tank/data@dienstag estimated size is 69.6K
full send of tank/data/a@dienstag estimated size is 23.3G
full send of tank/data/b@dienstag estimated size is 9.95G
full send of tank/data/c@dienstag estimated size is 81.6G
total estimated size is 115G
cannot receive new filesystem stream: destination 'zbackup/data' exists
must specify -F to overwrite it
fox@owl:~$ sudo zfs send -vR tank/data@dienstag | sudo zfs recv zbackup/data
cannot send tank/data@dienstag: encrypted dataset tank/data may not be sent with properties without the raw flag
warning: cannot send 'tank/data@dienstag': backup failed
cannot receive: failed to read from stream
fox@owl:~$ sudo zfs send -vR tank/data@dienstag | sudo zfs recv -F zbackup/data
cannot send tank/data@dienstag: encrypted dataset tank/data may not be sent with properties without the raw flag
warning: cannot send 'tank/data@dienstag': backup failed
cannot receive: failed to read from stream
As you can see here I created the backup pool and dataset the same way as the main pool. I think I need to do that because otherwise -R and -w can not be used with zfs send, right? Here is the first few lines of the backup pool history.
History for 'zbackup':
2022-07-05.15:43:19 zpool create -f -m none -o ashift=12 zbackup /dev/disk/by-id/scsi-SSeagate_M3_Portable_NM16JP5J
2022-07-05.15:46:03 zfs create zbackup/data -o mountpoint=none -o compression=lz4 -o xattr=sa -o atime=off -o encryption=on -o keyformat=raw -o keylocation=file:///mnt/zfskey/zfs.key
I am not active here a lot so if I screwed up how I should have made this look, please let me know and I will do my best to fix it.
If you have any idea how I could do proper backups again, please let me know.
I wish every reader a nice day