Zram device is smaller then zram thinks it is

I have been having problems with the stability of games for some time now. random crashes and sudden fps drops that only go away when I restart the game. Now I stumbled upon that the zram device in the partition manager is shown smaller than zram is allocated in terminal.

kde partitionmanager shows 31,27 GB
terminal zramctl shows 31,3 GB

i don’t know why or if this is normal but i assume that the problems are caused by zram trying to write something where there is no partition. could someone help me fix it? i have really little knowledge of terminal commands and don’t really understand the instructions on the net.

I think this is normal. The terminal rounds up, the partition manager is a bit more precise.

The random crashes have other causes.

Please see if this helps us:

**free --lohi** 
               total        used        free      shared  buff/cache   available
Mem:        14160804     5725296     7918428      106816      901032     8435508
Low:        14160804     6242376     7918428
High:              0           0           0
Swap:       14159868           0    14159868

unfortunately I only get a wildcard error
fish: No matches for wildcard ‘free --lohi’. See help wildcards-globbing.

Interesting, lets see how it looks at this:

swapon 

❯ swapon
NAME       TYPE       SIZE USED PRIO
/dev/zram0 partition 31,3G   1M  100

same as

❯ zramctl
NAME       ALGORITHM DISKSIZE  DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd         31,3G  176K 20,9K  544K      16 [SWAP]

if the “free --lohi” was entered right this might need naim or ptr1337 eyes
run the bug report and attach the link back here.

sudo cachyos-bugreport.sh

This is very odd to me.

Maybe this will help:

Note:

  • When configuring zram, the size of the zram device controls the maximum uncompressed amount of data it can store, not the maximum compressed size. You can configure the zram’s size to be equal to or even greater than your system’s physical RAM capacity, as long as the compressed size of physical RAM will not exceed your system’s physical RAM capacity. zram - ArchWiki

This would mean that swapon “size” and zramctl “disksize” do not refer to the size of the partition but to the size created by compression.

on archwiki they have a full 32GB in their example.

i also checked my bios and it says i have 32gb ram.
I just wanted to rule out a hardware error.

1 Like

I’m not sure how your /fstab is laided out, mine total RAM 16Gigs swap is also 16Gigs, and my format is ZFS, it’s not timid gobbling my ram so I’ll use this:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=CE35-7587                            /boot/efi      vfat    defaults,umask=0077 0 2
proc    /proc    proc    defaults,nosuid,nodev,noexec,relatime,hidepid=2     0     0
/dev/zram0 none swap defaults,discard,pri=100 0 0
~

Seems to hold up on some very heavy lifting.

mine is looking very different
but I don’t even see a zram in it

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=322aade1-c262-4af6-9145-fb3101551aab /              ext4    defaults,noatime,commit=60 0 1
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

How is your back-ups? are they good?
You could try that to see if it helps, but just this line no-labels or UUID needed.

/dev/zram0 none swap defaults,discard,pri=100 0 0

Your will look different than mine, and that’s ok.

df /dev/zram0
Filesystem     Type      Size  Used Avail Use% Mounted on
dev            devtmpfs  6.7G     0  6.7G   0% /dev

so i just copy the line into my fstab under everything else and save it?
i guess i need a reboot after that.

Yes and Yes…Good Luck :slight_smile:

❯ df /dev/zram0
Dateisystem    1K-Blöcke Benutzt Verfügbar Verw% Eingehängt auf
dev             16328288       0  16328288    0% /dev

but the difference between partition and zramclt remains

❯ swapon
NAME       TYPE       SIZE USED PRIO
/dev/zram0 partition 31,3G 768K  100

~
❯ zramctl
NAME       ALGORITHM DISKSIZE  DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd         31,3G  256K   33K  688K      16 [SWAP]

i just had a look in btop, even if i don’t know which value it refers to but it shows me 31,2 GB of total memory as the zram partition if the value is not rounded up. unfortunately i didn’t get the idea to check the value before i rebooted

use it for a while to see if it helps in Gaming.

1 Like

guess i have a few games to play (: and i will get back to you.

thanks for your time
I really appreciate it

One is rounding the value to a lesser degree of significant figures than the other. This is hardly an issue, if you can even call it one.

1 Like

The ZRAM block device is created on boot. This is the reason why it’s not in fstab.

I already explained that above, but nobody took notice :grin:

1 Like