Last active
June 22, 2024 15:01
-
-
Save AnthonyDS/30501b3f8a725a3ef9084e9af08c20e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sh fakeswap.sh 2048 | |
fakeswap.sh: 6: fakeswap.sh: Bad substitution | |
Внимание!!! Это bash-скрипт | |
# bash fakeswap.sh 2048 | |
# 1. Сохраняем скрипт как fakeswap.sh | |
# ----------------------------------- | |
#!/bin/bash | |
SWAP="${1:-512}" | |
NEW="$[SWAP*1024]"; TEMP="${NEW//?/ }"; OLD="${TEMP:1}0" | |
umount /proc/meminfo 2> /dev/null | |
sed "/^Swap\(Total\|Free\):/s,$OLD,$NEW," /proc/meminfo > /etc/fake_meminfo | |
mount --bind /etc/fake_meminfo /proc/meminfo | |
# 2. Выполняем | |
# ----------------------------------- | |
chmod +x fakeswap.sh | |
sh fakeswap.sh | |
free -m | |
# Дополнительный материал | |
# http://linux-problem-solver.blogspot.ru/2013/08/create-fake-swap-in-openvz-vps-if-you-get-swapon-failed-operation-not-permitted-error.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment