On Mon, 2024-12-09 at 05:07 -0600, Ranjan Maitra via users wrote:
> Thank you!
> 
> So, in the past, for an ext4 system, which is what I have, I used to do the 
> following:
> 
> 
> sudo vi /etc/default/grub
> 
> add --> resume=UUID="****" <-- to the line GRUB_CMDLINE_LINUX= (anywhere, i 
> do it before the rhgb)
> 
> where the uuid is obtained using blkid.
> 
> then
> 
> sudo bash -x grub2-mkconfig
> 
> # # for efi-based systems: #
> 
> sudo bash -x grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
> 
> and then reboot.
> 
> So, we basically ignore the zram0?

Keep the zram. It makes a real difference to performance. However you
can add some systemd units to disable it when hibernating, e.g.:

$ cat /etc/systemd/system/hibernate-preparation.service
[Unit]
Description=Enable swap file and disable zram before hibernate
Before=systemd-hibernate.service

[Service]
SyslogIdentifier=%N
User=root
Type=oneshot

ExecStartPre=/bin/bash -c ' \
        swapon -a; \
        swapoff /dev/zram0; \
        exit 0; \
        '

ExecStart=/bin/true

The 'swapon -a' line is because I would normally only have zram
enabled, but you can remove this if you're going to keep the swap
partition (or file) active all the time.

$ cat /etc/systemd/system/hibernate-resume.service
[Unit]
Description=Enable zram swap after resuming from hibernation
After=hibernate.target

[Service]
SyslogIdentifier=%N
User=root
Type=oneshot
ExecStart=/bin/bash -c ' \
        if ! swapon --show=NAME --noheadings | grep -q /dev/zram0; then \
                swapon /dev/zram0; \
        fi; \
        exit 0; \
        '

[Install]
WantedBy=hibernate.target

You put those in the appropriate places and call 'systemctl enable ...'
for each of them, then reboot.

Disclaimer: I set this up in F40 and used it for a while but had some
issues with getting it to work reliably with BTRFS so now I'm just
doing suspend rather than hibernate (I have a desktop). However it
should be OK with ext4.

poc
-- 
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to