You are not logged in.

#1 2024-07-04 12:58:03

6i5
Member
Registered: 2024-06-09
Posts: 14

How to change the size of LUKS-encrypted partitions?

Thanks to the help of the wonderful Arch community I successfully installed Arch on my nvme drives. I thought assigning 128GiB to my root directory would have been sufficient but I was wrong. I am currently down to my last 100MiB. I would like to shrink the size of /home by 896GiB and give it to root so that the root directory has 1TiB. Is it possible to shrink /home and have / absorb the space without destroying the partitions? There is zero empty space in vg001 at the moment.

Partitioning Layout

Offline

#2 2024-07-05 23:51:05

yataro
Member
Registered: 2024-03-09
Posts: 93

Re: How to change the size of LUKS-encrypted partitions?

Since your home resides on its own LUKS, you have to shrink the filesystem first, then shrink the LUKS, then shrink the logical volume, and finally expand your root.
You have to calculate all sizes yourself, check all stuff twice, dumpe2fs is your friend for ext paritions, new logical volume size should also include LUKS offset (use cryptsetup status, be aware of your LUKS sector size). Do your backups!

See https://man.archlinux.org/man/lvresize.8 (you can't use --resizefs because of LUKS, so as mentioned above, resize it yourself).
After home is resized, you can easily expand your root, see https://man.archlinux.org/man/lvextend.8 (I think you want -l +100%FREE)

I think there's no need to mention that you should do all this from a live system, and most importantly, backup all the important stuff big_smile

BTW, I prefer to move my home to the root and forget about any free space issues.

EDIT:
Also, your setup looks pretty unusual to me. Is there a practical reason to encrypt each volume individually?

Last edited by yataro (2024-07-05 23:55:57)

Offline

Board footer

Powered by FluxBB