You are not logged in.
Here is what I want to do.
I have a LUKS partition of 500GB that I setup long long ago. It contains about 200GB of data. Now I want to split the LUKS parition into a 250GB LUKS partition and a 250GB normal partition.
Is this possible to do without loosing my 200GB worth of data? Point me in the right direction please.
EDIT : I read in stackexchange that
LUKS does not store a size, it defaults to the device size at the time you open it..
Does that mean I can resize a LUKS partition using gparted?
Last edited by Avg-Joe (2021-12-17 12:05:15)
Offline
dm-crypt doesn’t care. It provides a block device and does in-place mapping between blocks of the underlying storage and the decrypted volume. So you may freely resize it.
However, the file system inside the volume does care! The issue is exactly the same as if the partition was not encrypted. You can’t simply shrink it, as that may leave some files outside. The file system must be first shrunk to the desired size⁽¹⁾ and only then the entire volume may be cut down. This is the situation you are dealing with:
,----------------------------------------------------------.
| Entire storage |
|,--------------------------------------------------------.|
|| Partition ||
||,------------------------------------------------------.||
||| Encrypted LUKS data |||
|||,--------.-------------------------------------------.|||
|||| LUKS |,-----------------------------------------.||||
|||| header || File system |||||
|||| |`-----------------------------------------'||||
|||`--------'-------------------------------------------'|||
||`------------------------------------------------------'||
|`--------------------------------------------------------'|
`----------------------------------------------------------'The part that in the middle of that matrioshka doll is the one that cares about the size.
In any case, I would strongly suggest backing up the data on some temporary medium, setting up partitions from scratch, copying the data back. Not because shrinking itself is necessarily dangerous, but because how many things outside of your control may go wrong — starting from your finger slipping, calculating some offset wrong or power going down for a second. Not really worth the risk if you have any spare storage or can borrow it from someone.
Last edited by mpan (2021-12-17 17:16:00)
Offline