Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

LUKS encryption - increase swap size

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

LUKS encryption - increase swap size

#1 Post by Hallvor »

I would like to add a few gigabytes to my swap partition. Is it feasible because of the encryption?

Have tested with gparted from a USB stick, and everything is greyed out: I can't resize the partition, even when the LUKS-password is entered.

I guess there are several options:
1. Find a solution to resize the partition and expand the swap partition. (Would be optimal)
2. Make a swap file and disable the swap partition. (Wasted space if I can't expand the LUKS-partition.)
3. Back up my data and reinstall. (PITA.)

Am I missing something here? Any advice?
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: LUKS encryption - increase swap size

#2 Post by p.H »

3) You can use any other program (parted, fdisk, sfdisk...) to extend a partition, provided that you move only its end and there is available disk space on this side.

The encrypted volume will automatically extend to the new size the next time it is opened, or you can extend it while opened with "cryptsetup resize <name>". Then you will have to recreate the swap area with mkswap to extend it to the new size.

Alternatively, you can create a new encrypted swap area anywhere in the free disk space and add it to /etc/crypttab and /etc/fstab.

2) Swap files suck.

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Re: LUKS encryption - increase swap size

#3 Post by Hallvor »

Having thought this through, I won't risk hosing this install. I'll just stop hibernating the computer for now, and everything should work fine until I decide to reinstall some time in the future.

Thanks for your time and advice. Much obliged.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: LUKS encryption - increase swap size

#4 Post by p.H »

Oh, you wanted to increase the swap size for hibernation. The hibernation image is written to a single swap area (the first one listed in /proc/swaps IME) which must be big enough regardless of the number and total size of active swap areas. So adding another swap area instead of extending the existing one is not the best solution. However it can still be useful if the smaller swap area is used primarily for normal swap utility (with higher priority) and the bigger is used to write the hibernation image.

Post Reply