Select Page

How to Add Swap in Manjaro

How to Add Swap in Manjaro

Hey guys! If you’re hear, you probably already know what RAM is and you’re excited to learn how to add swap in Manjaro. If not, this is sort of a follow-up post to how to download more RAM. Anyway, let’s get started!

Using a Swap File

There’s a ton of different ways to add swap to your system, some more advantageous than others. In my experience, it’s always been easier to add swap to an existing install by using a swap file. First, just confirm that you don’t already have swap enabled. To do this, just run sudo swapon. If that command does not return any output, then you don’t have swap enabled. Also, if you have and/or use htop, it will actually display your swap status right below your RAM usage bar. if it reads empty and 0/0kb, then you don’t have swap enabled. Great! Now we can add a swap file.

Creating and initializing a new swap file

To create an initialize a new swap file, we’ll be using the fallocate command. To initialize a 16GB swap file just run the following in a terminal:

sudo fallocate -l 16G /swapfile

then run: sudo mkswap /swapfile

Setting permissions for your new swap file

Manjaro will likely give you a warning about changing the permissions of your swap file. You can change permissions using the chmod command. The swap file should only be readable and writable by the root.

sudo chmod 0600 /swapfile

Enabling your new swap file

Enable your new swap file by running the following:

sudo swapon /swapfile

Make your changes permanent

Make sure Manjaro knows to use your swap file every single time it boots up. Do this by running:

sudo bash -c "echo /swapfile none swap defaults 0 0 >> /etc/fstab"

And that’s it! The only thing left to do is reboot and just double check to see if your swap is up and running. Again, you can just run those commands from the beginning of the tutorial swapon or htop and you should be good to go! Happy blending!

Check out more articles

How to Generate a Ranger Config File

ranger --copy-config=all This will copy all the default config files from /usr/local/lib so you can make edits without messing anything up. Huge shout out to for explaining this and so much more. Took me a...

First Open Source Contribution

Surprise! I genuinely did not plan on making my first ever open source contribution today. In fact, I didn't plan on a lot of things happening this week at all. I recently got an awesome opportunity to work on a site that is being hosted on a platform called Pantheon,...

How to Exclude Specific Posts and Pages from WP_QUERY

For the sake of having something to work with, let's suppose we've got the following query:In this query, inside the $args array, there's a special parameter that allows you to exclude specific posts and pages from the query. This parameter is called post__not_in and...

Configure SSH For Password-less Connections

Preamble I'm slightly embarrassed to admit this, but it was a long time before I figured out how amazing this little file is and how exactly to put it to good use. The file I'm talking about is the SSH config file. By default, when you first connect to a server via...

WordPress Site Stuck in Maintenance Mode

Plugin Error Code 500 During Update While I was updating a WordPress plugin locally, something happened on my local server to trigger a 500 error code as the plugin was updating. On the frontend, I refreshed the page and was greeted with "Briefly Unavailable for...

Creating a WordPress Plugin Downloader

How it Started I was recently tasked with the challenge of creating a WordPress theme generator. The idea being, instead of writing your style.css file from scratch, you'd be able to just answer a few simple questions about how you'd like your theme set up, and those...

Fix Audio on XFCE Chromebook

The Problem After moving from GalliumOS to Xubuntu, I noticed that playing YouTube videos on both Firefox and Chromium would result in decent playback for a few minutes, but suddenly the audio would turn into a solid beeping tone while the YouTube video displayed the...

Adjust Trackpad Sensitivity XFCE

xinput set-prop "Elan Touchpad" "Synaptics Finger" 1 1 1 What are the values 1 1 1? This sets the sensitivity as close to the original ChromeOS as possible. Larger numbers will decrease sensitivity of various aspects. I never looked into which individual value...

Fireworks (Short Film) About the film Year: 2020 Director/DP: Tim Searfoss Writers: Matt Jones, Tim Searfoss Sound Mix: Matt Jones

Hosting Multiple Sites Using LocalWP

I've done a write-up on hosting local WordPress sites before, but I definitely prefer this method over the previous one. If you've never tried hosting multiple sites using LocalWP, then I'd encourage you to check it out. I've had really bad issues with it in the past,...

Looking for a place to host your next project or design?

Use this link to get your first 4 months of WP Engine for free: WP Engine – Plans (With 4 months free)