Shrink data partition and create encrypted SWAP Partition at the end of disk

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
simon_kungen
Posts: 4
Joined: 2024-08-24 17:30
Has thanked: 1 time

Shrink data partition and create encrypted SWAP Partition at the end of disk

#1 Post by simon_kungen »

Hi

My current encrypted installation of Debian 12 doesn't have a SWAP space because my assumption of SWAP space was that it was just a fallback if you run out of memory and should not be used on an SSD and should instead use something like zram-tools. I did not realize it was required for hibernation to work, but it has also become apparent this laptop can't just use zram and probably needs a SWAP Partition too. I was thinking of shrinking my data partition and add a SWAP space at the end of the disk, therefore not requiring me to shift my data. But I'm unsure if the SWAP space should be encrypted too. I've seen on a few places on the internet that you should encrypt it and others say it's not necessary. And then there is the question if I can even shrink a LUKS encrypted Partition without losing data. And I'd rather not have so I have to type in my password twice, once for unlocking the disk and once for unlocking the SWAP Partition. I'm also using btrfs, so a SWAP File doesn't work as far as I know unless I've missed something.

And what size should you guys recommend for the SWAP Partition if it has ~8GB of memory? The store told me it has 8GB of memory but Linux reports 5.7GB. I can't remember if it has always been 5.7 or if that's what zram takes up on the RAM (has it set to 25%, so 5.7 + 1.42 (current SWAP space) = 7.12GB, so I guess it kind of makes sense if you squint a little).

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2409
Joined: 2010-06-07 16:59
Has thanked: 45 times
Been thanked: 265 times

Re: Shrink data partition and create encrypted SWAP Partition at the end of disk

#2 Post by FreewheelinFrank »

Is this of any use?

https://unix.stackexchange.com/question ... -resize-do

There are a number of topics on the subject which may be of use. Search:

Code: Select all

encrypted swap debian site:forums.debian.net
Not really something I know anything about. but at least I have given your topic a bump. Hopefully somebody who does know about this will see it.

Post Reply