Behavior of in-place encryption with --reduce-device-size

"John A. Leuenhagen" <[email protected]> Wed, 29 May 2024 13:45:39 -0400
Newsgroups dev.linux.lists.cryptsetup
Message-ID <zqmdlvho3du3b7uyldgj4qeqk5ix36o7rmwo44ia2hl6ngmdnl@72qguwtrdma4>
Hi all,

I was looking at doing in-place encryption on a currently unencrypted
volume, and found that this is supported through `cryptsetup reencrypt
--encrypt ...`. This is great, but I was curious as to how it actually
did this, and the details online were scarce for what could potentially
be a destructive operation.

What is unclear to me is that the LUKS header must go at the beginning
of the device, overwriting any data that might be there. The
--reduce-device-size option suggests that space will be taken from the
end of the device; does this mean that data will be shifted to the right
as encryption takes place? If so, how does this process fare against an
interruption (e.g. SIGINT)? The man page suggests this will be fine, but
I was curious about the details here.

Thanks,
John