Swap Space: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 22: Line 22:
| 128GB    ||  11GB  || 139GB    ||          ||          ||
| 128GB    ||  11GB  || 139GB    ||          ||          ||
|}
|}
==Update » Ubuntu » 22.04==
<syntaxhighlight lang="bash" highlight="8-11" line>
echo 'swapon --show'|sudo bash
:'
NAME      TYPE SIZE USED PRIO
/swapfile file  2G 1.4G  -2
'
cat <<'EXE' | sudo bash
swapoff /swap.img
fallocate -l 29G /swap.img
ls -lh /swap.img && mkswap /swap.img
swapon /swap.img && swapon --show && free -th
EXE
</syntaxhighlight>


==Update » Ubuntu » 24.04==
==Update » Ubuntu » 24.04==
Line 28: Line 45:
:'
:'
NAME      TYPE SIZE USED PRIO
NAME      TYPE SIZE USED PRIO
/swap.img file  8G   0B  -2
/swap.img file  6G   0B  -2
'
'


cat <<'EXE' | sudo bash
cat <<'EXE' | sudo bash
swapoff /swap.img
swapoff /swap.img
fallocate -l 12G /swap.img
fallocate -l 38G /swap.img
ls -lh /swap.img && mkswap /swap.img
ls -lh /swap.img && mkswap /swap.img
swapon /swap.img && swapon --show && free -th
swapon /swap.img && swapon --show && free -th

Revision as of 20:47, 8 July 2024

Swap Calculation

RAM Size Swap Size (Swap + Hibernate) Size RAM Size Swap Size (Swap + Hibernate) Size
256MB 256MB 512MB 512MB 512MB 1GB
1GB 1GB 2GB 2GB 1GB 3GB
3GB 2GB 5GB 4GB 2GB 6GB
6GB 2GB 8GB 8GB 3GB 11GB
12GB 3GB 15GB 16GB 4GB 20GB
24GB 5GB 29GB 32GB 6GB 38GB
64GB 8GB 72GB 96GB 9GB 105GB
128GB 11GB 139GB

Update » Ubuntu » 22.04

echo 'swapon --show'|sudo bash
:'
NAME      TYPE SIZE USED PRIO
/swapfile file   2G 1.4G   -2
'

cat <<'EXE' | sudo bash
swapoff /swap.img
fallocate -l 29G /swap.img
ls -lh /swap.img && mkswap /swap.img
swapon /swap.img && swapon --show && free -th
EXE


Update » Ubuntu » 24.04

echo 'swapon --show'|sudo bash
:'
NAME      TYPE SIZE USED PRIO
/swap.img file   6G   0B   -2
'

cat <<'EXE' | sudo bash
swapoff /swap.img
fallocate -l 38G /swap.img
ls -lh /swap.img && mkswap /swap.img
swapon /swap.img && swapon --show && free -th
EXE

Update » Raspberry Pi 4

cat <<'EXE' | sudo bash
printf '\nbefore:\n';free -th
sed -i 's|CONF_SWAPSIZE=100|CONF_SWAPSIZE=2048|' /etc/dphys-swapfile
service dphys-swapfile restart
printf '\nupdate:\n';free -th
EXE

Playground

echo 'sync;echo 3 >/proc/sys/vm/drop_caches && swapoff -a && swapon -a'|sudo bash
free -th
sudo swapon --show
cat /etc/fstab

docker network prune -f
docker volume  prune -f
docker system  prune -f
docker image ls
cat <<'EXE' | bash
for d in system network volume
do docker ${d} prune -f;done
EXE
cat <<'EXE' | ssh [email protected]
for d in system network volume
do docker ${d} prune -f;done
EXE

References