wiki:tips/SwapSpace

WARNING: the following instructions are deprecated as of rev4; on rev4 swapspace is activated during first boot.

Swap Space

WARNING: the following solution is NOT RECOMMENDED, as it MAY lead to your uSD card wearing off faster.

It is possible (obviously, as with any Linux-based system) to set-up a swapspace, used by the system when RAM runs out. Usually, the swapspace resides on a special partition, this however is highly impractical on the uSD cards used with h1. The preferred and easier solution is to set-up a swapspace in a swap file on the ext2 partition.

In order to do this, we first need to create a swapfile. It can either be done on the Neo or on any other Linux system with access to the ext2 partition on the uSD card, holding your Hackable1 installation. Let's assume that we're doing it the former way, from under Hackable1 system running off of a uSD card on the Neo.

You can perform those operations either from the terminal program on the Neo, or from under the SSH session; the latter is usually more convenient.

Assumptions

There are a few things assumed in the following tutorial:

  • swapfile's path is /swapfile (on the ext2 partition);
  • swapfile's size is 64MiB (that should be than enough, although you may wish to change that to whatever suits you);

Creating the swap file

Let's create a 64MiB zero-filled file on the ext2 partition...

# dd if=/dev/zero of=/swapfile bs=1024 count=65536

...and make a swapswpace in that file:

# mkswap /swapfile

Using the swapfile

You can start immediately using the swapfile by issuing the following command:

swapon /swapfile

And, of course, you can immediately stop using it with:

swapoff /swapfile

Should you come to a decision that you wish to use the swapfile permanently, you can put this at the end of the /etc/fstab file on the ext2 partition:

/swapfile swap swap defaults 0 0

Always be careful when editing the /etc/fstab file, and be sure to know what you are doing. Always create a backup copy before saving any changes!

Now, everytime Hackable1 boots it will automagically use /swapfile as swap space.