Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Easy shell script create virtual swap file for openvz vps
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Easy shell script create virtual swap file for openvz vps

tarek.boxtarek.box Member
edited February 2015 in Tutorials

Easy shell script create virtual 1024MB swap file for openvz vps if not have swap

i found these steps and i create shell script for easy usage ,

if you want to increase the swap file you can change it in the script.sh script

wget https://dl.dropboxusercontent.com/u/48368801/script.sh
chmod +x script.sh
./script.sh
free -m

then run free -m to check if applied or not

Note ,,, You need to run it one time only , it will auto start with system 

Comments

  • It's worth noting this is fake swap.

    Thanked by 1ATHK
  • tarek.boxtarek.box Member
    edited February 2015

    @0xdragon said:
    It's worth noting this is fake swap.

    may be yes , may not .
    it may be good for small ram offers

  • @0xdragon said: It's worth noting this is fake swap.

    Okay, so in what way does this "fake swap" differ exactly from the "real swap", as allocated by the OpenVZ provider?

  • wychwych Member
    edited February 2015

    @aglodek

    "The sum of physpages.limit and swappages.limit limits the maximum amount of allocated memory which can be used by a container. When physpages limit is reached, memory pages belonging to the container are pushed out to so called virtual swap (vswap). The difference between normal swap and vswap is that with vswap no actual disk I/O usually occurs. Instead, a container is artificially slowed down, to emulate the effect of the real swapping. Actual swap out occurs only if there is a global memory shortage on the system."

    http://openvz.org/VSwap

    Thanked by 20xdragon Traffic
  • ChuckChuck Member
    edited February 2015

    Interesting.

    Probably I will try on 64MB VPS.

  • aglodekaglodek Member
    edited February 2015

    @wych said:

    Okay, I'm aware how vSwap - that's actually "fake swap" - works, hence my question above ;) Now, with respect to the "real swap" (traditional swap file on disk) introduced in this thread: say, I have a 128MB container with no vSwap allocated, will this add-on swap really work?

  • MichaelBuiMichaelBui Member
    edited February 2015

    aglodek said: in what way does this "fake swap" differ exactly from the "real swap", as allocated by the OpenVZ provider?

    This is indeed "fake info of VPS swap". That means it does not actually change your VPS swap, just change the info displayed to system & users

  • anyone knows how to test if Linux is using this fake SWAP or not

  • @postcd said:
    anyone knows how to test if Linux is using this fake SWAP or not

    I don't get your question but see blow.

    If your VPS is a OpenVZ VPS and has Swap values > 0 MB in free -m output then your VPS has vSwap.

  • After looking at the script, this just overwrites the /proc/meminfo settings, and actually never makes a swapfile.

    So, this is nothing more then a lie?

  • Mun said: So, this is nothing more then a lie?

    Yea, cheating on java :P

Sign In or Register to comment.