What's new

Image Tutorial How to create a Swapfile

Status
Not open for further replies.

DirtyDonki

I am the Nice One
Staff member
Admin
Joined
Sep 10, 2014
Messages
25,717
Points
728
Location
Middle England, Planet Earth.
Website
www.metalarmy.net
Why the need for a swapfile?
A swapfile provides a temporary storage area commonly called a cache. This can be seen as a form of extended memory where the system can process 'live' data. This feature can be useful for low memory boxes such as, the Vu+ Solo or Duo.

So if one has lots of processes or plugins installed the system may be overloaded at times & having a swapfile can help.

Direct Image Creation
Creating a swapfile on some images is just a simple case of finding the option to dos so via the menu system. For example on ViX it can be found via:

Menu - Setup - ViX - Swap Manager
Blue (Create) - Green (Activate) - Yellow (Autostart - recommended).

A full restart of the receiver is required for the Swapfile to become active.

Manual Creation on HDD - via telnet session (cmd prompt, terminal, putty, DCC or VUCC)
Open a session & login

Type the following commands in the order they are shown & press enter after each one:
Code:
dd if=/dev/zero of=/media/hdd/swapfile bs=1024 count=131072
Set the swap area
Code:
mkswap /media/hdd/swapfile
Activate the swapfile
Code:
swapon /media/hdd/swapfile
To have the swapfile load automatically after the box is restarted the fstab file needs to contain an instruction to do so:
Code:
vi /etc/fstab
Add the following to the end of the file:
Code:
/media/hdd/swapfile swap swap defaults 0 0
To verify swapfile is set:
Code:
free
You should see information similar to:
Code:
total used free shared buffers
Mem: 1240068 154124 839340 632 246604 1010102
Swap: 131068 0 131068
NOTE: if you want to create the swap on a USB stick then substitute usb for hdd in all the commands above.

All images have software to create a swap file.

Download and install 'System Tools' from the feeds. Then use Swap Manager. There is a limitation with this approach however, in that you cannot create anything bigger than 256MB nor does one learn anything.

So best option is to use the commands above.
 
Last edited:
Status
Not open for further replies.

Top Bottom