Since swapfile shouldn’t be in a snapshot, and I want my system encrypted therefore I am asking if it could be possible to make efi partition big enough to include swapfile inside it?

I can’t find documentation for this process, so would it require some extra steps to make it work?

  • Luci@lemmy.ca
    link
    fedilink
    English
    arrow-up
    4
    ·
    3 days ago

    Why not make a swap partition instead?

    • Doesn’t mess with your ESP partition
    • Won’t be snapshotted
    • Follows KISS principles
  • pogodem0n@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 days ago

    Have your swap file in another btrfs subvolume. E.g: @swap mounted to /swap and put your swap file there. All subvolumes under the root subvolume will be excluded from your snapshots.

  • zarenki@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    3 days ago

    Although swapfiles shouldn’t be in snapshots (or otherwise Copy-On-Write), that doesn’t mean you can’t have them in btrfs. You can create a non-COW file in a separate btrfs subvolume that you don’t enable automatic snapshots for and use that for swap. btrfs-progs even has a btrfs filesystem mkswapfile convenience command for allocating a NOCOW file suitable for swap use, though you still need to make sure to put it in a subvolume that you don’t make snapshots for.

    You probably don’t want to put swap in an unencrypted partition if you’re encrypting your root filesystem. Swap is liable to write sensitive data to disk, especially if you use hibernate.