#!/bin/bash | |
#Addition SWAP For OpenVZ | |
echo 'Start adding SWAP space ......'; | |
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 | |
echo 'Add the ready!';
以上代码来自https://github.com/TestSmirk/ovz-swap/raw/master/swap4ovz.sh
在linux vps上,
wget https://github.com/TestSmirk/ovz-swap/raw/master/swap4ovz.sh
chmod 755 swap4ovz.sh ./swap4ovz.sh 然后运行free -m 一看,果然增加了512mb虚拟内存。 不过重启vps后,会失效 需要加入开机启动。 from https://github.com/TestSmirk/ovz-swap |
ppt.cc/fVjECx ppt.cc/fEnHsx ppt.cc/fRZTnx ppt.cc/fSZ3cx ppt.cc/fLOuCx ppt.cc/fE9Nux ppt.cc/fL5Kyx ppt.cc/fIr1ax ppt.cc/f71Yqx tecmint.com linuxcool.com linux.die.net linux.it.net.cn ostechnix.com unix.com ubuntugeek.com runoob.com man.linuxde.net v.gd/4A2G5b v.gd/VBg0IE v.gd/kVkm7n v.gd/jCKP1G linuxprobe.com linuxtechi.com howtoforge.com linuxstory.org systutorials.com ghacks.net linuxopsys.com v.gd/2P9wTx v.gd/FtfpqE v.gd/eMfHsm v.gd/Ub7mqv v.gd/RReVk0 v.gd/vS3uTI v.gd/4Zxmba v.gd/1BnFph
Total Pageviews
Thursday, 25 July 2019
给openvz vps增加swap分区的办法
Labels:
linux
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment