Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

Like this article? We recommend ๏”€ If You Have Created a Swap Partition

If You Have Created a Swap Partition

Assuming that you don't have a space problem on the SSD where you installed it, all you have to do is to change the OS parameter that controls swapping between memory and your swap partition (called swappiness) to 1, which means "practically no swapping":

$ sudo nano /etc/sysctl.conf
add to end:
vm.swappiness=1

As I understand it, setting the parameter to 1 makes swapping extremely unlikely, rather than guaranteeing no swap, which is good enough.

Save and close, and your system will ignore swap on the next reboot.

If you haven't yet installed your new netbook OS to an SDHC card that lives within your card reader, consider getting a 16GB flash drive so that you don't need to be concerned about running out of room once you've subtracted from 512MB up to 2GB from your available drive space. With this approach, you can use the default (K)ubuntu installation, and turn off swap via the sysctl.conf file method I've shown above. Hibernate should work right out of the box that way, but suspend-hybrid probably won't. To test whether it does, try this command:

$ sudo pmi-suspend-hybrid

What you do next depends on the result:

  • If the result is unsupported, your choices are to leave the setup as is, or fix it using the method discussed here.
  • If your netbook/laptop takes a minute or soโ€”rather than a few secondsโ€”to do whatever it normally does when suspending, open this file:
  • /var/log/pm-suspend.log

    If you find the words suspend-hybrid somewhere in the first three lines, suspend-hybrid works correctly. If you're using GNOME, and the current version of the gnome-power-manager supports setting suspend-hybrid directly from the GUI, set gnome-power-manager to use suspend-hybrid (or sleep/hibernate), and you're done.

  • If there's no suspend-hybrid GUI support, or if you're using a pre-KDE 4.3 version (KDE 4.2.2 was current when I wrote this article), go to the end of part 2 of this series, in the section "KDE Power Management Setup," where I describe a hack for the /etc/acpi/lid.sh script, so you can trigger suspend-hybrid by closing the netbook/laptop lid.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.