Create Swap Space on VPS that won't allow swapon

Last modified by buzzkill b on 2019/02/26 18:05


0

Create fakeswap.sh

nano 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

save file and modify

chmod +x fakeswap.sh

to create 1024 meg swap file run

./fakeswap.sh 1024

source:
http://linux-problem-solver.blogspot.com/2013/08/create-fake-swap-in-openvz-vps-if-you-get-swapon-failed-operation-not-permitted-error.html

All answers

No answer

Tags:
Created by buzzkill b on 2019/02/26 18:05

Most Active Topics

Sort By: Dates Votes Comments
Most Active Topics
Topics Votes Comments
TriMineEGEM 0 0
Create Swap Space on VPS that won't allow swapon 0 0
Raspberry Pi Node 0 0

Subscribe

EGEM Wiki
v1.0