How to control zram seems to be quite confusing. I'd like to change my zram size from 8G to 10G, and maybe later to 12G (I have a total of 16G). I have gone into /etc/initramfs-tools/initramfs.conf and changed COMPCACHE_SIZE to "10G", after which I did
update-initramfs and rebooted, but that didn't make any change. I do have
zram-config installed, which gives me:
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo 1.9G 4K 81B 12K 1 [SWAP]
/dev/zram1 lzo 1.9G 4K 81B 12K 1 [SWAP]
/dev/zram2 lzo 1.9G 4K 81B 12K 1 [SWAP]
/dev/zram3 lzo 1.9G 4K 81B 12K 1 [SWAP]
Looking at the man page for
zramctl, another approach appears to be to create a zram4 device:
zramctl zram4 -s <size> -a lzo
though in that case I am not sure whether to use 2G, since every other device seems to be 1.9G. Once done, do I need to do mkswap and swapon? And if so, will that stick past a reboot? Also, one person claims that zramctl will only compress "up to half of your ram", though this script from the Debian wiki seems to indicate that 75% is possible.
Searching here on askubuntu, I find various other answers, including using zramctl to change the size of an already given device. Another answer suggests to edit /usr/bin/init-zram-swapping, which is the new location for /sbin/zram-config-start (see /etc/init/zram-config.conf). Yet another answer, found a couple of different places, suggests directly editing /sys/block/zram*/disksize. Going back further, there are even more answers including adding an /etc/init.d/zram, editing /etc/rc.local and editing /etc/init. So before breaking an already working system, could someone clue me in?
Why doesn't editing /etc/initramfs-tools/initramfs.conf work?
Why are my zram* device sizes 1.9G rather than 2.0G?
Should I create a new 1.9G/2.0G device with zramctl? (Which size?)
Or should I use zramctl to resize an already existing device? (By how much?)
Or should I edit /usr/bin/init-zram-swapping?
Or should I resize a device by editing /sys/block/zram*/disksize?
Or should I use any of the /etc/init*, /etc/rc.local approaches?
And, can I compress more than half of my RAM with any of these methods?
Also, what do I need to do to make it stick past a reboot?
I'd be interested in not only which approach might work, but also why there is this confusing thicket of answers.