/tmp is still tmpfs here, but I prefer this (below) nowadays for usages that are not typical /tmp usages:
n=$(cat /sys/class/zram-control/hot_add)
echo zstd > /sys/block/zram${n}/comp_algorithm # change that if you likeecho 8G > /sys/block/zram${n}/disksize # larger disk probably needed for /target
mkfs.ext4 -O '^has_journal' -L TMPZ -m 0.001 /dev/zram${n}# discard is important for auto-trimming
mount -o noatime,discard /dev/zram${n} /tmpz
chmod 777 /tmpz
chmod +t /tmpz
rm -rf '/tmpz/lost+found'
This is a part of my zram devices initialization script, a bunch used for swap as usual, then ending with this. modprobe zram num_devices=0 works if one likes to hot_add all devices.
From zram you get a block device with builtin compression. From ext4, you still get features like creation time, truncate and fallocate support, …etc. And with discard, ram usage will be limited to used space (like tmpfs). Also ext4 is used without a journal to avoid what would be useless overhead in this use-case.
/tmp
is stilltmpfs
here, but I prefer this (below) nowadays for usages that are not typical/tmp
usages:n=$(cat /sys/class/zram-control/hot_add) echo zstd > /sys/block/zram${n}/comp_algorithm # change that if you like echo 8G > /sys/block/zram${n}/disksize # larger disk probably needed for /target mkfs.ext4 -O '^has_journal' -L TMPZ -m 0.001 /dev/zram${n} # discard is important for auto-trimming mount -o noatime,discard /dev/zram${n} /tmpz chmod 777 /tmpz chmod +t /tmpz rm -rf '/tmpz/lost+found'
This is a part of my zram devices initialization script, a bunch used for swap as usual, then ending with this.
modprobe zram num_devices=0
works if one likes tohot_add
all devices.From zram you get a block device with builtin compression. From ext4, you still get features like creation time, truncate and fallocate support, …etc. And with discard, ram usage will be limited to used space (like tmpfs). Also ext4 is used without a journal to avoid what would be useless overhead in this use-case.