/tmp mounted with zram is too small

WRT1900AC v1 (mamba) with latest master.

I checked PROCD_ZRAM_TMPFS "Mount /tmp using zram" and that created a 16MB /tmp. 16MB is not enough for sysupgrade. The next image I want to flash is 25MB and sysupgrade insists on copying the image to /tmp, even if the image is just stored in another ram/tmpfs.

root@OpenWrt:/# dmesg | grep -i "zram"
[    2.770877] zram: Added device: zram0
[    2.841518] zram0: detected capacity change from 0 to 16777216
[    3.082207] EXT4-fs (zram0): noquota option not supported
[    3.086091] EXT4-fs (zram0): mounted filesystem with ordered data mode. Opts: errors=continue,noquota
[    3.086193] init: Using up to 16384 kB of RAM as ZRAM storage on /mnt
[   13.808685] zram: Added device: zram1
[   13.891369] zram1: detected capacity change from 0 to 126877696
[   13.940687] Adding 123900k swap on /dev/zram1.  Priority:-2 extents:1 across:123900k SSDsc

I have some questions:

  1. Can I change the default size? How?
  2. Zram occupies RAM as the virtual drive fills with data, but does it free the RAM when files are deleted from the drive? Like a "discard" on SSD?

Thank you.

I'm afraid it's hardcoded:

Try this way:

mount --bind /another/tmpfs /tmp

Out of curiosity, would a flash drive work ?

I don't know what's happening under the hood when the sysupgrade runs, theoretically it might unmount all external file systems.

if not, putting it on an external source could work.

No, a flash drive won't make any difference.

Perhaps it's better to use zram as swap device (package zram-swap). Data in tmpfs is swapped the same way as data in RAM.

Either use the existing /tmp directory or create a new tmpfs. By default the size of a tmpfs is half of the RAM size.