Howdy, Stranger!

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

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

Easy shell script create virtual swap file for openvz vps

tarek4webtarek4web 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

    This signature wasted 121 bytes of your data allocation.

    https://nixstats.com/report/56b53d6465689e44598b4567

  • tarek4webtarek4web 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?

    Andrew Glodek | Special Projects Director | 香港國際商務中心 HONG KONG INTERNATIONAL BUSINESS CENTRE
  • 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

    Taking a hiatus.

  • ChuckChuck Member
    edited February 2015

    Interesting.

    Probably I will try on 64MB VPS.

    I like what she said, not what it means.

  • 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?

    Andrew Glodek | Special Projects Director | 香港國際商務中心 HONG KONG INTERNATIONAL BUSINESS CENTRE
  • 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

    InternetLifeForum.com - hosting, webmaster forum

  • @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.

    I'm on vacation in Belize.

  • MunMun Member without signature

    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

    Happy to be alive and kicking!

Sign In or Register to comment.