Talk:Resizing LVM-on-LUKS

From ArchWiki
Latest comment: 1 March by CaptainMorgan in topic Increasing Size LVM-on-LUKS

Safety buffers when shrinking LVM-on-LUKS

Shrinking Physical Volume and LUKS

Similar as shrinking filesystem and LV, the --size option of cryptsetup specifies the total size of the new LUKS volume including the LUKS header. So if the same size is used for both pvresize and cryptsetup, one will end up with a LUKS volume of which the data segment is actually smaller than the PV. Of course if the LUKS header is located in a different place this shouldn't be a problem but still under most circumstances, having such a buffer tends to be easier compared with working out the exact number here using cryptsetup luksDump info.

FrederickZh (talk) 02:37, 28 August 2019 (UTC)Reply[reply]

This is false according to the man page: "For LUKS it is the size of the underlying device without the area reserved for LUKS header".
ChrisDunder (talk) 08:49, 29 December 2019 (UTC)Reply[reply]

Conclusion

In a nutshell, I think the safety buffers here tend to be a bit excessive (~100MB should be more than enough) however may be treated as a safe and simple solution that covers several corner cases. But still I'd strongly suggest using lvresize --resizefs if the filesystem is supported by fsadm in the second step.

FrederickZh (talk) 02:37, 28 August 2019 (UTC)Reply[reply]

This is no longer relevant since the safety buffer approach has been replaced by using precise formulas.
ChrisDunder (talk) 08:54, 29 December 2019 (UTC)Reply[reply]

Increasing Size LVM-on-LUKS

More of a question but when performing your calculations:


(60922-30399)*4 MiB = 119.2 GiB


I get


(60922-30399)*4 MiB = 112.09 GiB or 112.0 GiB


Am I missing something? CaptainMorgan (talk) 01:50, 1 March 2024 (UTC)Reply[reply]