zram trimming by writing zero pages
Posted
by
qdot
on Super User
See other posts from Super User
or by qdot
Published on 2012-09-12T23:24:28Z
Indexed on
2012/09/13
3:42 UTC
Read the original article
Hit count: 470
I'm using ZRAM as a backing block device for /tmp filesystem in the following manner:
echo 8000000000 > /sys/block/zram0/disksize
mkfs.ext4 -O dir_nlink,extent,extra_isize,flex_bg,^has_journal,uninit_bg -m0 \
-b 4096 -L "zram0" /dev/zram0
mount -o barrier=0,commit=240,noatime,nodev,nosuid /dev/zram0 /tmp
chmod aogu+rwx /tmp
It works out reasonably well for me - however, there is an issue here - when files are removed, they are not zero'ed, so the ZRAM does not remote the compressed pages. Obviously running
dd if=/dev/zero of=/tmp/ZERO bs=1M count={free-space-some-rest}; rm /tmp/ZERO
clears it up in the ZRAM - it gets notified of zero-pages and shrinks the store.
How can I get ext4 to zero used pages on delete? Also, any other suggestions on how to optimize it?
© Super User or respective owner