recently posted about using tmpfs for /var/tmp/portage and ended up taking the advice of someone who said to set up zram instead. this is mainly because i only have 8GB physical memory, and i felt the compression would benefit me. i have it set up and working now, but i have a couple of questions about the swap part of it and i'm hoping someone could help me figure it out.
pertinent info: i have 8GB physical RAM, as i said before, and also an 8GB swap partition. I mainly only have swap as a "just in case" type thing, and the 8GB is something that isn't an issue with space so, while i do have a dedicated partition, i have swappiness set to 10.
here is my my zram-init config file:
Code: Select all
# load zram kernel module on start?
load_on_start=yes
# unload zram kernel module on stop?
unload_on_stop=yes
# Number of devices.
# This value is also passed to the kernel module on modprobe.
num_devices=2
# swap - 500M (or a fourth of available memory if uncommenting)
type0=swap
flag0= # The default "16383" is fine for us
size0=8192
#size0=`LC_ALL=C free -m | awk '/^Mem:/{print int($2/4)}'`
mlim0= # no hard memory limit
back0= # no backup device
icmp0= # no incompressible page writing to backup device
idle0= # no idle page writing to backup device
wlim0= # no writeback_limit for idle page writing for backup device
notr0= # keep the default on linux-3.15 or newer
maxs0=2 # maximum number of parallel processes for this device
algo0=zstd # zstd (since linux-4.18), lz4 (since linux-3.15), or lzo.
# Size: zstd (best) > lzo > lz4. Speed: lz4 (best) > zstd > lzo
labl0=zram_swap # the label name
uuid0="6344e2ab-3787-4e0d-9d56-f6216d1f94d1"
args0= # we could e.g. have set args0="-L 'zram_swap'" instead of using labl0
# /tmp - 2G
# If you use this, you should put zram-init into the boot runlevel,
# and services using /tmp should be in the default runlevel and/or have
# rc_need=zram-init in their /etc/conf.d/... file
type1=/var/tmp/portage
flag1=ext4
size1=6144
mlim1= # no hard memory limit
back1= # no backup device
icmp1= # no incompressible page writing to backup device
idle1= # no idle page writing to backup device
wlim1= # no writeback_limit for idle page writing for backup device
blck1=4096 # the default blocksize of 4096
irat1= # bytes/inode ratio
inod1= # inode number
opts1="noatime,nosuid,nodev" # e.g. "relatime" or "noatime" are also reasonable choic>
mode1=1777
owgr1= # No reason to change the default "root:root"
notr1= # keep the default on linux-3.15 or newer
maxs1=2
algo1=zstdalso, i haven't yet built a very large package with this configuration, but is there anything else i need to set to make sure the swap is recognized as available space? what i mean is, the physical zram is 6GB, and mounted as /var/tmp/portage. is there anything i should be doing differently in my swap config to make sure that portage sees the 8GB of swap as available space for /var/tmp/portage as well?
as always, any and all input is very much appreciated. have a wonderful new year everyone.
-sebastian


