#!/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/fSZ3cx ppt.cc/fLOuCx ppt.cc/fE9Nux ppt.cc/fL5Kyx ppt.cc/fVjECx ppt.cc/fIr1ax tecmint.com linuxcool.com linux.die.net linux.it.net.cn ostechnix.com unix.com man.linuxde.net bit.ly/2EzoUDo bit.ly/2v6jGJi bit.ly/2tW6eYT bit.ly/2X6vadl bit.ly/2viLpHU linuxprobe.com linuxtechi.com linuxstory.org systutorials.com ghacks.net linuxopsys.com reurl.cc/8W1x3X reurl.cc/NpzMWe reurl.cc/WrgYdx reurl.cc/Yv4Yvo reurl.cc/Lmy90K reurl.cc/Rr5aeG
Total Pageviews
Thursday 25 July 2019
给openvz vps增加swap分区的办法
Labels:
linux
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment