You are not logged in.

#1 2025-08-16 15:03:53

alif
Member
Registered: 2025-08-16
Posts: 3

resize LUKS volume

hi everyone. been using arch for a year now but when i was updating my system i got an error saying the partition was too full. since it is luks encrypted and want to approach this carefully, i thought i'd run by my diagnosis of the issue and the commands needed to resize the luks partition [my system is backed up but i'd like to do this in one shot].

on my computer, logged in, "df -m" produces this

Filesystem                     1M-blocks  Used Available Use% Mounted on
dev                                47888     0     47888   0% /dev
run                                47916     2     47914   1% /run
efivarfs                               1     1         1  95% /sys/firmware/efi/efivars
/dev/mapper/ArchinstallVg-root     19987 18447       500  98% /
tmpfs                              47916    65     47851   1% /dev/shm
tmpfs                                  1     0         1   0% /run/credentials/systemd-journald.service
tmpfs                              47916     9     47908   1% /tmp
/dev/nvme0n1p1                      1259   198      1062  16% /boot
/dev/mapper/ArchinstallVg-home   1855248 72979   1687956   5% /home
tmpfs                                  1     0         1   0% /run/credentials/getty@tty1.service
tmpfs                               9584     1      9584   1% /run/user/1000

although efivarfs seems nearly full, i've seen that this doesn't matter too much from what i've read. the real problem to fix first though is the nearly full root partition.
for additional info "lsblk -l" produces this output:

NAME               MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
zram0              253:0    0    4G  0 disk  [SWAP]
cryptlvm           254:0    0  1.8T  0 crypt
ArchinstallVg-root 254:1    0   20G  0 lvm   /
ArchinstallVg-home 254:2    0  1.8T  0 lvm   /home
nvme0n1            259:0    0  1.8T  0 disk
nvme0n1p1          259:1    0  1.2G  0 part  /boot
nvme0n1p2          259:2    0  1.8T  0 part

after that i boot into a live iso of ubuntu [i'd use the arch live iso but it was already on my usb key]

to open up the luks volume i execute "cryptsetup luksOpen /dev/nvme0n1p2 cryptdisk" and enter the password.

after that i run "df -h" again:

Filesystem                   Size  Used Avail Use% Mounted on
tmpfs                        9.4G   11M  9.4G   1% /run
efivarfs                     148K  136K  7.7K  95% /sys/firmware/efi/efivars
/dev/sda1                    5.9G  5.9G     0 100% /cdrom
/cow                          47G  259M   47G   1% /
/dev/disk/by-label/writable   23G  4.0M   22G   1% /var/log
tmpfs                         47G   12K   47G   1% /dev/shm
tmpfs                        5.0M   16K  5.0M   1% /run/lock
tmpfs                        1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
tmpfs                        1.0M     0  1.0M   0% /run/credentials/systemd-resolved.service
tmpfs                         47G  8.0K   47G   1% /tmp
tmpfs                        9.4G  4.1M  9.4G   1% /run/user/1000

and "lsblk -l" produces:

NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0                7:0    0   2.7G  1 loop  /rofs
loop1                7:1    0 533.6M  1 loop 
loop2                7:2    0 218.1M  1 loop 
loop3                7:3    0  11.8M  1 loop  /snap/desktop-security-center/59
loop4                7:4    0   242M  1 loop  /snap/firefox/6042
loop5                7:5    0  73.9M  1 loop  /snap/core22/1908
loop6                7:6    0     4K  1 loop  /snap/bare/5
loop7                7:7    0  66.2M  1 loop  /snap/core24/739
loop8                7:8    0  11.1M  1 loop  /snap/firmware-updater/167
loop9                7:9    0  91.7M  1 loop  /snap/gtk-common-themes/1535
loop10               7:10   0   516M  1 loop  /snap/gnome-42-2204/202
loop11               7:11   0  10.8M  1 loop  /snap/snap-store/1270
loop12               7:12   0   568K  1 loop  /snap/snapd-desktop-integration/253
loop13               7:13   0  44.4M  1 loop  /snap/snapd/23771
loop14               7:14   0  14.4M  1 loop  /snap/prompting-client/104
loop15               7:15   0 210.2M  1 loop  /snap/thunderbird/706
loop16               7:16   0 109.6M  1 loop  /snap/ubuntu-desktop-bootstrap/366
sda                  8:0    1  28.9G  0 disk 
sda1                 8:1    1   5.8G  0 part  /cdrom
sda2                 8:2    1     5M  0 part 
sda3                 8:3    1   300K  0 part 
sda4                 8:4    1  23.1G  0 part  /var/crash
                                              /var/log
cryptdisk          252:0    0   1.8T  0 crypt
ArchinstallVg-root 252:1    0    20G  0 lvm   
ArchinstallVg-home 252:2    0   1.8T  0 lvm   
nvme0n1            259:0    0   1.8T  0 disk 
nvme0n1p1          259:1    0   1.2G  0 part 
nvme0n1p2          259:2    0   1.8T  0 part

so i want to downsize ArchinstallVg-home by 30G and add slightly less memory to ArchinstallVg-root.
so with that established the following commands i thought would work would be:

# shrink the home volume by 30720M
resize2fs ArchinstallVg-home 1824528M

# shrink LUKS
cryptsetup resize --device-size G ArchinstallVg-home

#then resize the logical volume, with some extra 16M of room
lvresize -L1824512M ArchinstallVg-home

#then regrow LUKS and the file system on the shrinked logical volume
cryptsetup resize ArchinstallVg-home
resize2fs /dev/mapper/ArchinstallVg-home

so at this point i would have shrunk ArchinstallVg-home. then i'd follow a similar set of commands to grow ArchinstallVg-root. does that seem to make sense as a set of commands to execute? thanks in advance for any advice.

Offline

#2 2025-08-16 15:11:03

frostschutz
Member
Registered: 2013-11-15
Posts: 1,640

Re: resize LUKS volume

You seem to have substracted 16M from the LV size instead of adding it. With the header using 16M as well, 32M of filesystem data would be missing.

Edit: My bad, it's LVM inside LUKS, isn't it? You can match the filesystem size. LUKS header only matters for the PV then, not for each individual LV.

Last edited by frostschutz (2025-08-16 15:12:11)

Offline

#3 2025-08-16 15:38:03

alif
Member
Registered: 2025-08-16
Posts: 3

Re: resize LUKS volume

oh ok, good to know. it is LVM inside LUKS. great will match the filesystem size. then i think the sequence of commands would perhaps be:


# shrink the home volume by 30720M
resize2fs ArchinstallVg-home 1824528M

# shrink LUKS
cryptsetup resize --device-size G ArchinstallVg-home

#then resize the logical volume
lvresize -L1824528M ArchinstallVg-home

#then regrow LUKS and the file system on the shrinked logical volume <-- this step might not be necessary since it is LVM inside LUKS?
cryptsetup resize ArchinstallVg-home
resize2fs /dev/mapper/ArchinstallVg-home

Last edited by alif (2025-08-16 15:49:59)

Offline

Board footer

Powered by FluxBB