You are not logged in.

#1 2025-06-15 20:07:11

tetroi
Member
Registered: 2025-06-13
Posts: 10

Swap partition, hibernation

What size SWAP partition do I need? I have 64 GB RAM (4x16).
The official wiki says to set the number to whatever number of RAM you have, but 64 GB is kind of a lot, no?

And also about hibernation (sleep mode). I want it to work because it didn't work on my last system.

The wiki says to create hibernation_image_size.conf and set a smaller number of bytes for my amount of RAM to make it work much faster, but I don't know what number. I'm also having trouble making these table type files. Should I use Tab or Space? What is Mode, UID, GID, Age, Argument. I need to understand what they mean and what to write there.
My image_size file says somewhere around 24.9 GB, basically 2/5 of RAM.

Also about resume. I just need to change mkinitcpio.conf HOOKS= and add resume there, right?

So far I'm at the partitioning stage.

Offline

#2 2025-06-16 03:04:44

cloverskull
Member
Registered: 2018-09-30
Posts: 243

Re: Swap partition, hibernation

Take this with a grain of salt but I've /never/ been able to get hibernate to work 100%. There's always some show-stopping issue with it. I really personally wouldn't recommend it...with the speed at which you can hit a power switch and then be fully booted into your environment, my advice would be to just do that instead of hibernate.

That said, yeah, rule of thumb is 1:1 RAM to swap space for hibernate to work. I've had poor luck with it in general so I can't make any recommendations to the contrary.

If you're using a busybox initramfs, yeah, you'll need the resume hook. If you're using a systemd initramfs, you don't need anything, and in fact it should magically figure out where your hibernate swap space is and may not even require anything extra on your kernel command line.

A couple of things could make this a bit trickier, as well. I recently tried encrypted root, btrfs, swapfile, and hibernate was a nightmare. If you're unencrypted and have an entire partition allocated for swap this may be quite a bit simpler though.

Offline

#3 2025-06-16 09:05:20

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 683

Re: Swap partition, hibernation

tetroi wrote:

The official wiki says to set the number to whatever number of RAM you have, but 64 GB is kind of a lot, no?

Matching the RAM size is considered a safe recommendation, but, IIRC, the hibernation image may need to house not just RAM contents, but VRAM too.

tetroi wrote:

The wiki says to create hibernation_image_size.conf and set a smaller number of bytes for my amount of RAM to make it work much faster, but I don't know what number. I'm also having trouble making these table type files. Should I use Tab or Space? What is Mode, UID, GID, Age, Argument. I need to understand what they mean and what to write there.

The example in https://wiki.archlinux.org/title/Power_ … /file_size is literal; you write it as is. If you want an explanation for the file syntax, there's a link to https://wiki.archlinux.org/title/system … rary_files which in turn links to the tmpfiles.d(5) man page. Per kernel documentation for image_size the value you want is "0", just as shown in the example.

You can also try changing the hibernation compression to lz4 to reduce the image size further.

Offline

#4 2025-06-16 09:16:57

SimonJ
Member
From: Alicante, Spain
Registered: 2021-05-11
Posts: 207
Website

Re: Swap partition, hibernation

I am no expert but last week there was a post about hibernation so I thought I would see what it took.
I created a 32GB swap file,I have 64GB of ram.
I activated the swap file and added it to fstab.

/swapfile none swap defaults 0 0

I added the resume hook to

HOOKS=(base udev autodetect microcode modconf block plymouth encrypt lvm2 filesystems keyboard keymap resume fsck)

ran mkinitcpio -P
rebooted and have hibernated ever since. Maybe I was lucky but it was trivial to follow the wiki and get it to work. YMMV


Rlu: 222126

Offline

#5 2025-06-16 09:37:42

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 683

Re: Swap partition, hibernation

It's the amount of RAM in use that will determine whether you can hibernate, not the total amount.

Offline

Board footer

Powered by FluxBB