Re: Expanding a LUKS partition to a second drive.

Ondrej Kozina <[email protected]>
Newsgroups gmane.linux.kernel.device-mapper.dm-crypt
Message-ID <[email protected]>
Hi,

On 2/11/20 8:21 PM, James Dehnert wrote:
> Greetings dm-crypt group,
> 
> I have a situation where I have an existing LUKS encrypted partition 
> (root) and the user wants to expand that partition onto a second drive.
> 
> The existing partition was created at configuration as part of the 
> Ubuntu preseed setup.
> 
> I know how to do this with LVM, but I'm not sure if this can be done 
> without backing up all the data, and then rebuilding the system from 
> scratch.

If you have encrypted LV (LUKS on top of LV) you can extend that LV over 
another PV (block device or partition) and just call cryptsetup resize.
This will work and you can do it even without taking LUKS device 
offline. In fact I've added support for it into fsadm script and you 
would just need to call "lvextend -r" and it would resize active crypt 
device for you automatically.

> 
> I'm not sure where the LUKS volume is created in respect to LVM.  I 
> can't tell if its created directly on the physical volume, on the volume 
> group, or on the logical volume, so I'm noy sure where I should be 
> looking to expand the substrate.  Or if this is even possible.

See lsblk output with said active LUKS device. That should give you a hint.

If the PV is encrypted (LUKS on top of /dev/sdx and PV on top of LUKS) 
there's no way how to extend one LUKS device over two devices or 
partitions. We don't want cryptsetup to became yet another logical 
volume management:)

Regards O.

_______________________________________________
dm-crypt mailing list
[email protected]
https://www.saout.de/mailman/listinfo/dm-crypt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.