Swap Space: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==Update » Ubuntu== <syntaxhighlight lang="bash"> swapon --show </syntaxhighlight> ==Update » Raspberry Pi 4== <syntaxhighlight lang="bash" highlight="3,4" line> 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 </syntaxhighlight> ==Playground== {| | valign="top" colspan="2" | <syntaxhighlight lang="bash"> echo 'sync;echo 3 >/proc/...") |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Update » Ubuntu== | ==Swap Calculation== | ||
<syntaxhighlight lang="bash"> | {| class="wikitable defaultright" | ||
swapon --show | |- | ||
!scope="col"| RAM Size !!scope="col"| Swap Size !!scope="col"| (Swap + Hibernate) Size | |||
|rowspan="9"| | |||
!scope="col"| RAM Size !!scope="col"| Swap Size !!scope="col"| (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== | |||
<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 /swapfile | |||
fallocate -l 29G /swapfile | |||
ls -lh /swapfile && mkswap /swapfile | |||
chmod 0600 /swapfile && swapon /swapfile && swapon --show && free -th | |||
EXE | |||
</syntaxhighlight> | |||
==Update » Ubuntu » 24.04== | |||
<syntaxhighlight lang="bash" highlight="8-11" line> | |||
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 | |||
chmod 0600 /swap.img && swapon /swap.img && swapon --show && free -th | |||
EXE | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 61: | Line 112: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang="bash"> | |||
cat <<'EXE' | sudo bash | |||
swapoff /swapfile | |||
rm -rf /swapfile | |||
swapon --show | |||
free -th | |||
EXE | |||
</syntaxhighlight> | |||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang="bash"> | |||
cat <<'EXE' | sudo bash | |||
swapoff /swap.img | |||
rm -rf /swap.img | |||
swapon --show | |||
free -th | |||
EXE | |||
</syntaxhighlight> | |||
| valign="top" | | | valign="top" | | ||
Line 74: | Line 141: | ||
* [https://community.frame.work/t/responded-ubuntu-24-04-and-hibernation-fw-13-12th-gen/51626 Swap » Ubuntu 24.04 & Hibernation] | * [https://community.frame.work/t/responded-ubuntu-24-04-and-hibernation-fw-13-12th-gen/51626 Swap » Ubuntu 24.04 & Hibernation] | ||
* [https://askubuntu.com/questions/178712/ Swap » Increase swap space] | * [https://askubuntu.com/questions/178712/ Swap » Increase swap space] | ||
* [https://askubuntu.com/questions/969296/ Swap » Delete a swap file] | |||
| valign="top" | | | valign="top" | |
Latest revision as of 21:26, 5 October 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 /swapfile
fallocate -l 29G /swapfile
ls -lh /swapfile && mkswap /swapfile
chmod 0600 /swapfile && swapon /swapfile && 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
chmod 0600 /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
|
| ||
cat <<'EXE' | sudo bash
swapoff /swapfile
rm -rf /swapfile
swapon --show
free -th
EXE
|
cat <<'EXE' | sudo bash
swapoff /swap.img
rm -rf /swap.img
swapon --show
free -th
EXE
|
References
| ||