The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Disable your swap file

Contributed by: Scot Hacker
This tip is valid for: Both BeOS and Haiku

Kevin Adams (machop80@swbell.net) contributes:

After using the Virtual Memory panel once, you’ll have a file /boot/home/ config/settings/kernel/drivers/virtual_memory. The first line of this file reads:

vm on

Change this to “vm off”, reboot, and you’ll be running without virtual memory.

The remainder of this tip covers the possibility of shrinking your swap file, but does not work as advertised.


Editor’s note: It has come to my attention that this tip does not work as advertised. Since it seems like it should work, I’ll leave it here for now in hopes that this will be fixed in a future release. But don’t expect this to work in BeOS 5, Personal or Pro.

BeOS uses a fixed algorithm to determine the size of your swap file, depending on the amount of memory in your machine. By necessity, the size of the swap file is equal to or larger than the amount of memory in your machine. This, however, can cause problems in some rare situations. For instance, what if you have 256MB of memory but only a 500MB boot partition, such as the one you get with BeOS 5 Personal Edition? You’re not going to have much room left over for data storage.

To use a smaller swap file, manipulate the slider in the Virtual Memory preferences panel at least once, and close the panel (no need to reboot just now). This will create a text settings file at /boot/home/config/settings/kernel/drivers/virtual_memory, which will look something like this:

vm on
swap_size 357564416

Open this file in an editor and change the size of the swap file manually. When you reboot, you’ll have a swap file smaller than the one the preferences panel will let you create.

Be careful — setting your swap file too small can affect system performance, especially when dealing with very large files.

Note: Do not return to the VM panel after rebooting to see the new size of your swap file. Accessing this panel again will cause it to snap back to the defaults. To check on the size of your new swap file, use the Terminal:

ls -l /var/swap

Posted in Miscellaneous


(comments are closed).