626

Credit to @ryanc@infosec.exchange

I just did the graphic

you are viewing a single comment's thread
view the rest of the comments
[-] dan@upvote.au 27 points 1 day ago

People still use swap partitions instead of swap files?

[-] Frenchgeek@lemmy.ml 1 points 19 hours ago

I do, yeah. Since I'm already partitioning by hand to put /home on a different drive, better use the saved space on the NVME for a small amount of guaranteed swap while I'm at it.

[-] libewa@feddit.org 16 points 1 day ago

This. Swap files on LUKS encrypted partition. Also, the swapspace daemon!

[-] dan@upvote.au 11 points 1 day ago

I've seen so many setups where people encrypt their data but forget to encrypt their swap.

[-] DevDave@piefed.social 5 points 1 day ago

what's the problem? it's not like you dump the entire contents of your system's ram to disk any time use hibernate /s

[-] dan@upvote.au 3 points 1 day ago

Even without hibernation, data in apps you have open will end up in the swap if your system is ever RAM-constrained.

[-] Redjard@reddthat.com 1 points 1 day ago

Generally it only happens to programs you keep running in the background and might not use for a long time that also don't have much background activity. For example password managers.

[-] dan@upvote.au 1 points 1 day ago

It depends on what you set your swappiness to, too. I think Linux distros still have pretty aggressive defaults that swap more than they probably need to.

[-] DevDave@piefed.social 1 points 13 hours ago

I have taken a couple classes in Linux centric forensics and one of the things I often wandered about is if there is an easy way to add jitter or shift individual file blocks by a word (64 bits) or even half the size of a data block. Say every two hours shift up or down so attempts to read a mechanical hard drive would be chaotic.

Don't you need swap partitions to be able to use hibernation?

[-] devfuuu@lemmy.world 1 points 21 hours ago* (last edited 21 hours ago)

Been using a swap file in a luks partition for years. I hibernate very regularly.

[-] PervServer@fedinsfw.app 7 points 1 day ago

Nope, I hibernate with a swap file and it's in a LUKS partition. Although IIRC that whole setup requires me to use systemd boot.

[-] Redjard@reddthat.com 1 points 1 day ago

I do the same and use ugrd. I think dracut would also work.
You just set the resume kernel parameter to the decrypted memory device with the swapfile offset.
As long as the initrd attempts a resume after it decrypted all volumes it'll work, and the initrd doesn't even need to understand why and what was resumed from

[-] Ooops@feddit.org 3 points 1 day ago* (last edited 1 day ago)

It's doable with a swap file instead. But some filesystems are more supportive than others.

For example BTRFS doesn't support swapfiles over multiple devices (so my raid1c3 spanning 3 differently sized disks for example) and also swapfiles must be completely pre-allocated.

And no matter the filesystem you need to manually tell the kernel device and physical offset for the file via kernel parameters. Which can again be easier on some than on others (also causing the no-multiple-device filesystem problem mentioned above.

[-] Redjard@reddthat.com 1 points 1 day ago

btrfs's handling makes sense. The kernel talks to the disk directly, the file is just a pointer for what range it uses, and a placeholder for the filesystem. Something like raid, balancing, cow, all won't work because the kernel doesn't even go through btrfs to change the swap"file".
If you want a proper file as swapfile, with the corresponding overhead, you can make a regular file and mount it via loopback then use it as a swap device.

[-] dan@upvote.au 2 points 1 day ago

I don't use hibernation so I'm not sure.

[-] Redjard@reddthat.com 2 points 1 day ago

So you shut your pc down like a caveman when you do hardware upgrades or repairs or move apartments?

[-] dan@upvote.au 4 points 1 day ago

Yeah I shut down every day. It boots up fast enough that it's really not an issue.

[-] adarza@lemmy.ca 2 points 1 day ago

that's what trixie's netinst defaults to when i set up new desktops using encrypted lvm.. root and swap volumes inside that, unlocking together at boot. my use doesn't hit swap much, so it's nbd. i just leave it like it is. only where an installer doesn't support encrypted swap partitions do i use a file or ram-based swap instead.

[-] dan@upvote.au 4 points 1 day ago

It's not as bad with LVM since LVM is more flexible. A swap file does still make it easier to change the size as needed though. If you need more swap, you can spin up a new swap file pretty much instantly while the system is running, without having to repartition. You can have both a swap partition and a swap file active at the same time though.

On systems where the data is encrypted, also encrypting the swap makes sense so I'm glad Debian does that.

this post was submitted on 12 Sep 2026
626 points (95.2% liked)

linuxmemes

32781 readers
1387 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry of any kind will not be tolerated. This is an LGBTQ+-friendly community -- if that is a problem for you, you should leave.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • Don't come looking for advice, this is not the right community.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves / tolerates / hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. ๐Ÿ‡ฌ๐Ÿ‡ง Language/ัะทั‹ะบ/Sprache
  • This is primarily an English-speaking community. ๐Ÿ‡ฌ๐Ÿ‡ง๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ‡บ๐Ÿ‡ธ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • ย 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 3 years ago
    MODERATORS