hc
2024-05-11 645e752c5a84baeb21015cdc85fc05b7d16312c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
set -e
 
device=$1
if [ "$device" = "" ]; then
    echo "Usage: zram-swap-deinit <device>"
    exit 1
fi
 
sysblockdev=/sys/block/$(basename $device)
if [ ! -d $sysblockdev ]; then
    echo "Block device not found in sysfs"
    exit 1
fi
 
# zramctl -r is not suitable as it also removes the actual device. Recreating
# it is non-trivial, especially if not /dev/zram0 is used...
echo 1 > ${sysblockdev}/reset