Created
October 21, 2018 17:34
-
-
Save rraallvv/9173124897e3c800e450bf56eff96120 to your computer and use it in GitHub Desktop.
Create Fake Swap in OpenVZ VPS
This file contains hidden or 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
#!/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 | |
free -m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment