Re: online encryption progress

Ondrej Kozina <[email protected]> Tue, 17 Oct 2023 11:03:52 +0200
Newsgroups dev.linux.lists.cryptsetup
Message-ID <[email protected]>
On 16/10/2023 19:57, Brian J. Murrell wrote:
> Hi.
> 
> I used:
> 
> # cryptsetup reencrypt --encrypt --init-only --reduce-device-size 32M /dev/md0 md0_encrypted
> # cryptsetup reencrypt --resume-only /dev/md0

This command, unless called with --quiet option, should print progress 
regularly, including percentage already completed.

> 
> to encrypt a device online.
> 
> I can see that it's encrypting:
> 
> # cryptsetup status md0_encrypted
> /dev/mapper/md0_encrypted is active.
>    type:    LUKS2
>    reencryption:  in-progress
>    cipher:  aes-xts-plain64
>    keysize: 512 bits
>    key location: dm-crypt
>    device:  /dev/md0
>    sector size:  512
>    offset:  32768 sectors
>    size:    7813643952 sectors
>    mode:    read/write
> 
> Is there any way to know how far from complete it is?  I.e. percent
> done, etc.?

See above. Status command (in current code) can not output reencryption 
progress data. The information necessary for it to be correct are stored 
in LUKS2 metadata (on disk). We'd have to construct new reencryption 
context which is protected by lock held by current reencryption process 
(cryptsetup reencrypt --resume-only /dev/md0 process).

Kind regards
O.