Tip 2: Disabling Virtual Memory

Disable Virtual memory

Delete swap file

checkfs /DiskName

You just installed your brand new Haiku operating system, and you are ready to roll with it and enjoy its features, snappiness, slickness, coolness, and even are willing to go to Lake Ness to celebrate. Then you realize that your computer has a solid state drive, and you have enough physical RAM so you check in your Haiku Preferences for Virtual Memory and…

Picture 1: Virtual Memory Preferences

There it is, your virtual memory swap file.

Upon installation, Haiku defaults to enable virtual memory, and automatically manage the swap file. There are many reasons why any user would like to have a Virtual Memory Swap file, and as many as why any user wouldn’t like to have such amount of disk space locked, reserved to be used as Swap.

Picture 2: Swap file takes space on disk

Launching the DiskUsage application, we can see that in our case, with 8 GB of RAM, Haiku wants an 8.14 GB of Swap, and at this moment it has reserved 4.85 GB of disk space as Swap file. That swap file is hanging there in our hard drive, and with a small drive like the one we are using here (20 GB), reserving 4.85 GB of space is way too much wasted space. So we decide to deactivate Virtual Memory and regain that disk space for applications and documents.

Picture 3: The swap file is actually, a file, located at /boot/system/var

1: Disable Virtual Memory

In Haiku, the disk icons show the used/free space ratio by an overlayed bar at the right side of the icon, which at the moment shows that about one third of the disk capacity is used already. With a clean install of Haiku R1/beta2 on a 20 GB disk, seems too much space taken. A great amount is due to the swap file as we will see in a moment.

Once disabling the Virtual Memory we need to reboot our system in order for the changes to take effect. Then, upon reboot:

Picture 5: Disabled Virtual Memory

2: Delete swap file

After reboot Virtual Memory has been disabled, but the space is still there, taken by the swap file. The swap file is still taking up space on our hard drive, though not being used. Now we can safely delete the swap file from our drive, as is not being used, thus it won’t cause any trouble to our system.

Picture 6: Moving Swap file to Trash

When we try to move the Swap file to the trash, Haiku will complain it won’t be able to boot. We are sure we want to do this because we know what we are doing, so we press Shift key and click on the Move button, which will be available when whe press the shift key. Then we just need to empty the trash:

Picture 7: After emptying trash, we regained the space

Once the Trash has been emptied, our hard drive has gained space, the space before taken by the swap file. Now our 20 GB hard drive has 19.38 GB free for installing applications and documents.

Picture 8: New Free space.

3: Check the Filesystem

After the delete is complete, and in order to be safe, we should check the filesystem on our hard drive, to verify that everything is correct and no errors will appear upon next boot. To do this we launch the Terminal application and execute the command:

~> checkfs /Haikuverse

where Haikuverse is the name of the disk where the swap file was located:

Picture 9: Running checkfs /Haikuverse in the Terminal

Now our system is clean and without a swap file. We regained the space taken by the virtual memory to install new software and save our documents.

We could enable the Virtual Memory anytime, if we need it, and disable it again following the procedure stated here in case we don’t need it or we don’t want to use Virtual Memory.

Actually, we could just disable virtual memory and do nothing with the Swap file, just let it be there holding on to our disk, or we could resize it to take less space or whatever to suit our particular needs. Anything is possible. 😉


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s