Adding swap, and adding a menu entry to activate it

January 12th, 2006

I followed the instructions given in this blog, and added a swap file on my removable card to try to improve the perfomance of the system.

All the following steps are done in the Nokia 770.

I created a script at /root/addswap with these contents:


#!/bin/sh
mkswap /media/mmc1/swap 24576
swapon /media/mmc1/swap

I am wondering if the often writings due to swapping can damage the removable card (indeed, I asked about that in the maemo-developers mailing list). So, I created also a script /root/delswap, with these contents:


#!/bin/sh
swapoff /media/mmc1/swap

I pretend to execute these scripts as a normal user, creating an entry in the menus. So, I added the scripts to the /etc/sudoers file. I added these lines:


user ALL = NOPASSWD: /root/addswap
user ALL = NOPASSWD: /root/delswap

Now, they can be executed as a non-root user using sudo. For example, sudo /root/addswap. Create two scripts /root/addswap_user and /root/delswap_user containing sudo /root/addswap and sudo /root/delswap. Give execution permissions (with chmod a+x script_name) to all the scripts.

Next step is to add the scripts to the main menu, to add or remove swap with a point and click.

Go to /var/lib/install/etc/others-menu/extra_applications, and create two files. First addswap.desktop containing


[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Add swap
Exec=/root/addswap_user
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

and delswap.desktop containing


[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Remove swap
Exec=/root/delswap_user
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

Now you have the opportunity of turning on and off the swap just clicking in the applications menu.

I made some tests. With these applications open, the perfomance was very good (take a look at the output of the free command).

1 Comment Add your own

  • 1. Connecting geeks » &hellip  |  January 13th, 2006 at 3:26 am

    […] Maybe you want to know how to add the swap options, set up your bluetooth keyboard, or install the SSH server and set up an ad-hoc network between your computer and the Nokia 770. […]

Leave a Comment

You must be logged in to post a comment.

Trackback this post  |  Subscribe to the comments via RSS Feed


What's this?

This is a blog about the new Nokia 770. It will show tricks, hacks, reviews, etc about this impressive gadget. Comments and feedback are welcome.

You can contact me at isra _at_ herraiz.org, or just leaving a comment in any post.

Latest comments

Gizmo to offer free calls both to landline and mobile lines  4
santi, Sabeel, mami [...]

Non-HID bluetooth keyboards working!  17
Rob Mulally, gene jaleski, herraiz [...]

Bluetooth keyboards for the Nokia 770  9
jose manuel a.lopez, jose manuel a.lopez, Bill [...]

wxWidgets and wxPython almost hildonized  12
jaremo, cowbot, Peter [...]

Calendar

February 2012
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
272829  

Most Recent Posts

Valid XHTML
Valid CSS
No-www.org