• 公告栏使用li标签,同时你可以使用FontAwesome以及其他HTML语法
  • FontAwesome示例
  • 人道主义的含义是: 从不以人作为牺牲来达到某一目的!@施韦策 (诺贝尔和平奖得主)

Create Fake Swap in OpenVZ VPS if you get swapon failed: Operation not permitted Error

菜鸟Linux笔记 shaobo 85次浏览 978字 0个评论

if you get swapon failed: Operation not permitted Error even if you run as root it is because in your VPS swap creation is not allowed follow below steps to Create Fake Swap in OpenVZ VPS

[root@server] free -m total used free Mem: 4096 104 3991 -/+ buffers/cache: 104 3991
Swap: 0 0 0

create shell script file add lines like below
[root@server] vi 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
free -m

[root@server] chmod +x fakeswap.sh
[root@server] sh fakeswap.sh [root@server] free -m total used free Mem: 4096 104 3991 -/+ buffers/cache: 104 3991 Swap: 512 0 512 to create 1024MB Swap run like below [root@server] sh fakeswap.sh 1024 [root@server] free -m total used free Mem: 4096 104 3991 -/+ buffers/cache: 104 3991 Swap: 1024 0 1024 - See more at: http://linux-problem-solver.blogspot.sg/2013/08/create-fake-swap-in-openvz-vps-if-you-get-swapon-failed-operation-not-permitted-error.html#sthash.Eeknzpcf.dpuf


喜欢 (0)

您必须 登录 才能发表评论!