Skip to content

zram: using a compressed in-memory fs? #16

@eMPee584

Description

@eMPee584

as inspiration, my /usr/local/bin/overlay-zram

#!/bin/bash -xv
set -e # die if one step fails

echo "called $0 $@"
dir=$(basename "$@")
zram=/tmp/zram

modprobe -v zram
zramdev=$(zramctl --find --size 20GiB --algorithm lz4)
mkfs.ext4 -O ^has_journal ${zramdev}
mkdir -pv ${zram}
mount -vo discard,dax,noatime ${zramdev} ${zram}
mkdir -pv "/tmp/${dir}-union" "${zram}/${dir}"/{.work,.upper}
modprobe -v overlay
mount -vt overlay overlay -o "lowerdir=${@},upperdir=${zram}/${dir}/.upper,workdir=${zram}/${dir}/.work" "/tmp/${dir}-union"
chown -v --reference="${@}" "/tmp/${dir}-union"

Compression ratio can be looked at with zramctl ..
hard to know if it's worth the fuzz without trying..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions