Talk:Resizing LVM-on-LUKS

From ArchWiki
Jump to navigation Jump to search

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)

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)

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)

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)