For RAM saving, you can use a compressed RAM-based block device - zram
kernel module instead of tmpfs
. There is approximately 45% compression ratio for root directory (/
) :
Demonstration:
user@dom0 ~ % zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle 10G 7G 3.1G 3.2G 8 /
user@dom0 ~ % zramctl -h
...
DATA uncompressed size of stored data
COMPR compressed size of stored data
...
Setup actions:
- Add
+
lines, remove-
line in our (mentioned earlier) file/usr/lib/dracut/modules.d/01ramboot/tmpfs.sh
:
- mount -t tmpfs -o size=100% none /sysroot
+ modprobe zram
+ echo 10G > /sys/block/zram0/disksize
+ /mnt/usr/sbin/mkfs.ext2 /dev/zram0
+ mount /dev/zram0 /sysroot
- Add line to our file
/etc/dracut.conf.d/ramboot.conf
:
add_drivers+=" zram "
- Regenerate the /boot/initramfs⦠and reboot.
user@dom0 ~ % sudo dracut --verbose --force