Recently I’ve been in a need of hibernation functionality on my laptop, but the issue is that I’m using zram and have no swap on disk. Now, I have been wondering how would even zram interact with normal swap for hibernation and if it’s possible to use zswap for it.
So first - how would zram interact with swap for hibernation? Does it even work?
If it does then would it just put all of the compressed ram into the swap and then reboot like nothing happened, or maybe first uncompress itself and then put the uncompressed ram into swap?
Second - would zswap work with hibernation?
Depending on how it works in the first question I theoretically could save like 2GB or so of space.
- I have 8GBs of ram, and setup only another 8GB with zram. From what I understand the default compression method for zram and zswap is 1:3 compression so theoretically I should be able to have 24GB of ram althogether with it. So if zswap would be a valid option here I theoretically could only have to use 6GB of space for it and not 8GB/16GB
Lastly if it is possible to have it working, but it requires some non-standard procedures not mentioned on for example arch wiki then I’d love to have it also explained step by step here.
RTFM (Read The Friendly Manual):
If you have more questions after hitting the books, let us know.
4 Likes
Well, the thing is that I only know about zram and zswap because of these exact pages, and on the first three of these there isn’t much about hibernation, and on the last one there isn’t anything about zram or zswap
thats a really nice page you got there …would be sad if it didnt ever appear on google for me when searching for stuff like that (I guess my fault because I have always only searched with arch
/arch linux
keywords or without them/just linux
)
But in all seriousness, on this page the only part about [setting up] zswap seems to be from systemd-swap […because there is a part about checking zswap information] which also apparently doesn’t exactly support hibernation
I’m not sure if I understand this, you mean that zram doesn’t work with hibernation?
aw man, that kinda defeats the point then
my “plan” was to have zram as swap because don’t want to waste ssd that much, and zswap (perfectly file, but if I had to then partition) just for hibernation
tfw I was a fan of A-Team series and yet I didn’t get the reference until I saw that the link directs to A-Team wiki page
anyways, using swap/zswap actually for swap is lame, I’ll stick to zram like the cool kids do and maybe someday some linux kernel magician will add a magic feature that allows exactly what I want
thanks for the answers and I hope others that will follow my path will get this thread as a first result of their search engine result …at least until it becomes possible
edit: where did that mr go?
cat /sys/power/image_size
will give you a minimal size of swap space necessary for hibernation to work.
For my system it is less than a half of total RAM amount, ~7 Gb.
Just set it once and let your doubts go lol