Sample Header Ad - 728x90

Recover from faking /proc/meminfo

6 votes
1 answer
2049 views
So, without really thinking too much, I ran this script: #!/bin/bash SWAP="${1:-512}" NEW="$[SWAP*1024]"; TEMP="${NEW//?/ }"; OLD="${TEMP:1}0" sed "/^Swap\(Total\|Free\):/s,$OLD,$NEW," /proc/meminfo > /etc/fake_meminfo mount --bind /etc/fake_meminfo /proc/meminfo from here: http://linux-problem-solver.blogspot.com.ee/2013/08/create-fake-swap-in-openvz-vps-if-you-get-swapon-failed-operation-not-permitted-error.html It worked really well for lying about my swap-space, but now I'd like good old commands like free -m to work again, but /proc/meminfo is totally empty and the server doesn't seem to know anything about it's RAM any more, even with atop or somesuch. Thanks for reading.
Asked by Lauri Elias (163 rep)
Jan 27, 2016, 11:25 PM
Last activity: Jan 27, 2016, 11:49 PM