• Home
  • Cloud
    • General
    • SaaS
    • BPaaS
    • PaaS
    • IaaS
    • Other Internet Hosted Applications
      • WordPress
        • WooThemes Canvas
          • WooThemes Canvas CSS
  • About me
  • Why Badly Wired?
  • Contact

Badly Wired

Connecting WordPress via APIs, Plugins and other stuff - a technical notebook

You are here: Home / Cloud / Google Cloud / Adding Swap to Google Compute Engine

Adding Swap to Google Compute Engine

15th August 2016 by Alan 1 Comment

Fully Managed UK Hosting - Only £1+VAT till 1st Jan 2021 on Shared, Reseller and Dedicated Hosting! .... read more ....

By default Google Compute Engine (Debian) doesn’t come with any swap space.  If you have periodic programs that eat a bit more memory (like my backups do) then instead on just adding more physical memory you can add a swap file.

Swaps files are much slower than physical memory, so should be avoided except when it is needed.

Fully Managed UK Hosting - Only £1+VAT till 1st Jan 2021 on Shared, Reseller and Dedicated Hosting! .... read more ....

Setting up a swap file on Debian on Google Compute Engine is described here

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s

To make this permanent add this to /etc/fstab

/swapfile none swap sw 0 0

 

If you need to resize the swap file

sudo swapoff /swapfile 
sudo fallocate -l 4G /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

 

How much swap? Well that  is down to your system. Maybe start with 1x your physical memory and then run memory diagnostics tools.

 

 

[Next] Find out where to host WordPress [Read the full article…]

Filed Under: Google Cloud, Linux  

About Alan

I'm Alan from Fullworks Digital Ltd, where I develop WordPress Plugins and support and manage WordPress websites.

My day job consists of solving clients' WordPress issues and developing new code and solutions.

I started as a professional programmer in 1979 and had been involved with the IT of business technology in virtually every area that exist.

Badlywired.com is my personal blog and my aide memoire of the many interesting facts that I come across. As I spend a lot of time gathering parts of solutions from the internet and assembling them into my own solutions, and also just learning how to do things, this blog is primarily my 'note book' and a way of giving something back to the online community that has helped me extensively.

Comments

  1. Rick says

    12th January 2020 at 5:58 pm

    Thanks. Normally, this gets set up when you create a new system, so you don’t think about it. Setting up a gcloud debian VM didn’t prompt for it, so it didn’t get set up.

    This saves the day on a minimal gcloud compute instance – lets me keep it a bit longer before upgrading.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Applications
  • Cloud
    • General
    • Google Cloud
    • IaaS
    • Other Internet Hosted Applications
      • Wordpress
        • WooThemes Canvas
        • WooThemes Canvas CSS
    • SaaS
  • Code snippets
  • Discounts
  • Genesis
  • Google Apps for Works
  • Linux
  • News
  • SEO
  • Server setup
  • Services
  • Tech Tips
  • Uncategorised
  • Useful Images
  • Useful Stuff
  • WordPress Hosting
  • WordPress Plugins

Tags

background jobs beadcrumbs bind brandings Cache canvas Centos chrome css fail2ban Find firefox Flash fraud genesis gocardless godaddy Google google maps hackers internet explorer javascript KashFlow Linus linux Magento mapquest maps microsoft mysql news nohup php plugin plugins queens diamond jubilee replace SED SEO skype Varnish Virtualmin Webmin woothemes Wordpress

 

Affiliate and Privacy Notices

This site is free to use, but hopes to cover some costs through affiliate income, some products and links are affiliates and may earn the site advertising income.

Some affiliates use Cookies to track if you purchase from them, this allows them to apportion revenue to us you will need to refer to their specific privacy notices as to how you are tracked.

This site is a participant in the Amazon EU Associates Programme, an affiliate advertising programme designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.co.uk.

  • Privacy Policy

Copyright © 2021 · Badly Wired