I have some data on a ZFS in a machine running FreeBSD that needs evacuation. I have a disc in a USB enclosure with enough space, but it's encrypted using LUKS on a machine running Linux. Is there any way to connect the disc directly to the FreeBSD box, or will I need to copy data through a Linux box (ssh or NFS to the FreeBSD)?

(I don't have room for all the discs in the zpool in any box running Linux, so don't tell me about the option of doing that and using one of the ZFS implementations available on Linux.)


Not a direct answer to your question, but you could cryptsetup open, resize2fs to shrink your encrypted filesystem, cryptsetup close, parted resizepart to shrink the partition and mkpart a new one in the freed space, mkfs to create an unencrypted filesystem suitable for hassle-free data exchange.

If you decide on that route you have to keep in mind that the LUKS header is about 2 MiB in size, so if you shrink your filesystem to say 100 GiB, your LUKS partition has to be 100 GiB + 2 MiB in size (feel free to add some safety margin).

Apart from that, LUKS does not care about device size, so you do not need to do anything else as far as the encryption is concerned. In particular you don't need cryptsetup resize, that's only for online resize.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.