Swap after upgrading from F32 to F33

Well this is what i got:

$ cat /proc/swaps
Filename				Type		Size		Used		Priority
/dev/sda4              partition	8259580		0		         -2
/dev/zram0             partition	4194300		0		        100

$ lsblk
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0   600M  0 part /boot/efi
├─sda2   8:2    0     1G  0 part /boot
├─sda3   8:3    0   223G  0 part /
└─sda4   8:4    0   7.9G  0 part [SWAP]
sdb      8:16   0 931.5G  0 disk 
└─sdb1   8:17   0   931G  0 part /home
zram0  252:0    0     4G  0 disk [SWAP]

$ free -h
                     total        used        free      shared  buff/cache   available
Mem:                 15Gi       2.4Gi        11Gi       155Mi       1.6Gi        12Gi
Swap:                11Gi          0B         11Gi
  1. Let it as it is
  2. Disable zram
  3. Keep zram and re-partition the drive to get 8GB of space

Any suggestions?

1 Like

I have 8GB of RAM and I kept zram and removed swap partition.

$ swapon --show
/dev/zram0 partition 3.8G   0B  100

$ free -h
              total        used        free      shared  buff/cache   available
Mem:          7.7Gi       1.2Gi       3.5Gi       343Mi       2.9Gi       5.8Gi
Swap:         3.8Gi          0B       3.8Gi
1 Like

Keep zram as this is the preferable and recommended method to organize swap since Fedora 33.
You can remove the swap partition to optimize responsiveness and extend the root.

sudo -e /etc/default/grub /etc/fstab
sudo grub2-mkconfig -o /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg
sudo dracut -f --regenerate-all

There is something weird going on…
I can’t disable disk swap.
I comment out the swap entry in /etc/fstab
I delete the “resume=UUID=<…>” entry in /etc/default/grub
I give “grub2-mkconfig”
I give “dracut”
And while everything is updated, when i reboot i have disk swap active…

The only file that has the “resume=UUID=<…>” entry for the latest/default kernel entry is “/boot/grub2/grubenv” (as “kernelopts”)

But i’ m on an EFI system. There is not “/boot/grub2/grub.cfg” and the symlink “/etc/grub2.cfg” is broken.

In the “/etc/grub2-efi.cfg” and “/boot/efi/EFI/fedora/grub.cfg” kernelopts don’t contain “resume=UUID=<…>”

Also the “/boot/loader/entries/<…>.conf” for the default kernel that the system boots doesn’t have the “resume=UUID=<…>”

It looks like the grubenv file isn’t updated from that workflow, but is getting updated with every new kernel installation.

sudo swapoff /dev/sda4
sudo parted /dev/sda rm 4
sudo parted /dev/sda resizepart 3 100%
sudo resize2fs /dev/sda3

I found the “problem”. Is this unit “dev-sda4.swap”.

If someone reads “man systemd-gpt-auto-generator” will see that:

Generator for automatically discovering and mounting root, … as well as discovering and enabling swap partitions, based on GPT partition type GUIDs

systemd-gpt-auto-generator is useful for centralizing file system configuration in the partition table and making configuration in /etc/fstab or on the kernel command line unnecessary

Yep, i need to partition the disk so changes to be made on the GPT table.

I was hoping to disable the disk swap and go with zram, without repartitioning. Just in case in the future i need that disk swap.

1 Like

The easy and fast solution is:

sudo ln -s /dev/null /etc/systemd/system-generators/systemd-gpt-auto-generator

It works, i just rebooted and no disk swap is present, only the zram
The partition remains to be used anytime

Another would be to pass these arguments in the kernel command line with grubby:

systemd.gpt_auto and rd.systemd.gpt_auto with a negative value

1 Like

That would work too, but i want to retain the partition

simply change its type to something other than swap. It can then be restored if needed, or alternatively you can enable swap on a swapfile as already said.

I’m sorry, but may i know what these commands are for?

And do i need to boot in livecd for using these commands?

No need, but it’s best to have one if something goes wrong.

didn’t the root partition need to be unmounted before resizing?

do I need to use these commands too after resizing root?

Ext4 supports online extending, otherwise it depends on your file system.


So first i use this:

Then this:

Is it correct?

It was correct for the OP’s layout.
If yours is different, it’s best to discuss in a separate thread.

But my layout is pretty much the same as OP:

$ cat /proc/swaps
Filename				Type		Size		Used	Priority
/dev/sda5                               partition	4194300		0	-2
/dev/zram0                              partition	4004860		0	100

$ lsblk
sda      8:0    0 111.8G  0 disk 
├─sda1   8:1    0   308M  0 part /boot/efi
├─sda2   8:2    0   500M  0 part /boot
├─sda3   8:3    0    77G  0 part /home
├─sda4   8:4    0    30G  0 part /
└─sda5   8:5    0     4G  0 part [SWAP]
sdb      8:16   0 931.5G  0 disk 
├─sdb2   8:18   0  97.7G  0 part /mnt/28956143-10c7-489a-98ec-45011eef21ed
└─sdb3   8:19   0 833.4G  0 part /mnt/e85680aa-b52a-4db2-8bf6-a5d89cd44a78
zram0  252:0    0   3.8G  0 disk [SWAP]

and I’m on EFI system too

1 Like

Well, then it should work for you too.
Just modify the commands accordingly.

1 Like

Thank you!
One more question, the OP mentions:

Do i need to do this too?
Sorry for asking too much question, as i can’t have this machine to be unbootable.

Yep, the first command should open those files for editing.