mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-28 05:36:34 +00:00
Change swap size on start if needed
balenaOS now creates a /dev/zram0 device sized as min(25% of ram, 1G) which on EtcherPro is 256M. We need 1G, so we resize it on start if the amount is not 1G. Also modprobe is no longer necessary as zram is built into the kernel. Change-type: patch
This commit is contained in:
parent
86fb91ec9d
commit
32bd9efa11
@ -44,11 +44,6 @@ WORKDIR /usr/src/app/node_modules/.bin
|
|||||||
RUN ln -s ../electron/cli.js electron
|
RUN ln -s ../electron/cli.js electron
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN \
|
|
||||||
apt-get update \
|
|
||||||
&& apt-get install -y kmod \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
CMD \
|
CMD \
|
||||||
./zram.sh \
|
./zram.sh \
|
||||||
&& node /usr/src/app/update-config-and-start.js
|
&& node /usr/src/app/update-config-and-start.js
|
||||||
|
@ -14,7 +14,6 @@ services:
|
|||||||
labels:
|
labels:
|
||||||
io.balena.features.dbus: 1
|
io.balena.features.dbus: 1
|
||||||
io.balena.features.supervisor-api: 1
|
io.balena.features.supervisor-api: 1
|
||||||
io.balena.features.kernel-modules: 1
|
|
||||||
volumes:
|
volumes:
|
||||||
- 'etcher_pki:/root/.pki'
|
- 'etcher_pki:/root/.pki'
|
||||||
- 'etcher_cache:/root/.cache'
|
- 'etcher_cache:/root/.cache'
|
||||||
|
9
zram.sh
9
zram.sh
@ -1,10 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DEVICE=/dev/zram0
|
DEVICE=/dev/zram0
|
||||||
|
SIZE=1G
|
||||||
|
|
||||||
if [ ! -b $DEVICE ]; then
|
CURRENT_SIZE=$(zramctl --raw --noheadings --output DISKSIZE $DEVICE)
|
||||||
modprobe zram
|
|
||||||
zramctl $DEVICE --size 1024M
|
if [ $CURRENT_SIZE != $SIZE ]; then
|
||||||
|
swapoff $DEVICE
|
||||||
|
zramctl $DEVICE --algorithm lz4 --size $SIZE
|
||||||
mkswap $DEVICE
|
mkswap $DEVICE
|
||||||
swapon $DEVICE
|
swapon $DEVICE
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user