How increase ZRAM size in Ubuntu?

How increase ZRAM size in Ubuntu?

To increase the size of your ZRAM device, create the file /etc/systemd/zram-generator. conf and include the below configuration example. (You can also leave an empty file in this path to disable ZRAM.) The limits given above matches the default limits (50 % of available memory or 8 GB in MB.)

What is Linux ZRAM?

zram, formerly called compcache, is a Linux kernel module for creating a compressed block device in RAM, i.e. a RAM disk with on-the-fly disk compression. The two most common uses for zram are for the storage of temporary files ( /tmp ) and as a swap device.

How do I change my zram size?

Edit: As user #g7 mentioned, to change the default size of zram, /usr/sbin/zramswapon config file has to be edited. In the middle of the text you should see this: SIZE=$(( $MEMORY_IN_KBYTES * 1024 * 13 / 100 / NUM_ZRAM_DEV )) where value 13 represents percantage of physical ram assigned to zram.

How to enable the zram module for faster swapping on Linux?

In order for zRAM to function, you’re going to need to disable the traditional swap. This is handled within the fstab file. Open that file with the command: In that file, comment out (add a leading # character) the line starting with /swap.img. Save and close the file.

Do you need fstab entry for zram module?

If you’re using a different distribution, you’ll only need to modify the systemd unit file to fit your distro of choice. The zRAM module is controlled by systemd, so there’s no need for an fstab entry.

Which is Stat file is not available in zram?

The stat file represents device’s I/O statistics not accounted by block layer and, thus, not available in zram /stat file. It consists of a single line of text and contains the following stats separated by whitespace: the number of pages freed because of REQ_OP_DISCARD requests sent by bio.

What are the possible return codes for zram?

The list of possible return codes: an attempt to modify an attribute that cannot be changed once the device has been initialised. Please reset device first. zram was not able to allocate enough memory to fulfil your needs. invalid input has been provided.