Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:X0F:HSF
zram
zramstart
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File zramstart of Package zram
#!/bin/bash #set -x # default factor of 1/4 of RAM factor=4 # default priority is maximum priority priority=32767 # use lz4 default algorithm on newer kernels algorithm=lz4 # Anything new needs only one zram device num_zdevs=1 [ -z "$FACTOR" ] || factor=$FACTOR [ -z "$PRIORITY" ] || priority=$PRIORITY [ -z "$ALGORITHM" ] || algorithm=$ALGORITHM [ -z "$ZDEV_NUM" ] || num_zdevs=$ZDEV_NUM # Calculate ZRAM size mem_total=$(free -w |grep "^Mem" |awk '{printf("%d",$2)}') zram_size=$((${mem_total} / ${factor} /1024)) mem_per_zdev=$((${zram_size} / ${num_zdevs})) modprobe -r zram > /dev/null 2>&1 # fixes issue with multiple restarts modprobe -q zram num_devices=${num_zdevs} sleep 0.1 # fixes issue with multiple restarts for i in $(seq 0 $((num_zdevs - 1))); do # Create ZRAM with the next free device zramdev=$(zramctl --find --algorithm ${algorithm} --size ${mem_per_zdev}MB 2>&1) # The above returns the device. Use it below if [ "$?" -eq 0 ]; then mkswap $zramdev swapon -p $priority $zramdev else echo -e "\n${zramdev}\n" exit 99 fi done echo -e "\nActivated ZRAM swap device of ${zram_size} MB\n"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor