You are not logged in.

#1 2023-05-06 18:08:45

cypherpsycho
Member
Registered: 2022-09-09
Posts: 1

Resize luks partitions

My Arch installation is on a nvme drive with three partitions: a boot partition, a root partition of 30GB, and a home partition of 1TB. Both the root and home partitions have LUKS encryption. However, I am running out of space on the root partition while installing packages from pacman, so I need to expand it / shrink home. The name of my drive is nvme0n1, with the boot partition labeled as nvme0n1p1, the root partition as nvme0n1p2, and the home partition as nvme0n1p3. How would I go about doing that? If it wasnt LUKS i could easily do it, the encryption layer is what is confusing me significantly. i don't use LVM or anything like that,

Offline

#2 2023-05-08 23:31:43

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,491

Re: Resize luks partitions

In theory you'd start by filechecking and shrinking the filesystem, then use crypsetup --resize for the LUKS device and finally adjust the partition to the desired size. But particularly for shrinking things can go wrong at the partitioning step, because you need to ensure you empty the space between the partitions without harming the blockdevice.
It's strongly recommended to create a backup first in any case. For your home partition it is safest to recreate a smaller partition, LUKS encrypt it fresh, create a filesystem and simply restore the backup into it, adjust any UUIDs in crypttab/fstab for the new LUKS home mount. For the system partition (i.e. expanding it to the free space), the steps are: 1. run a filesystemcheck at runtime first, 2. partitioning tool to expand partition, 3. cryptsetup-resize the opened LUKS device, 3. expand the filesystem, done.

Offline

Board footer

Powered by FluxBB