Ubuntu Linux: How to Enable or Disable Swap Partition

by Keith Dsouza | Translate | Print
Saturday, 06th Jun 2009 | Share


Share Ubuntu Linux: How to Enable or Disable Swap Partition on Twitter Share Ubuntu Linux: How to Enable or Disable Swap Partition on Facebook Save Ubuntu Linux: How to Enable or Disable Swap Partition To Delicious Favorites Stumble Ubuntu Linux: How to Enable or Disable Swap Partition Share Ubuntu Linux: How to Enable or Disable Swap Partition on Digg Get Instant Updates as RSS Feeds from Techie Buzz

In this post we shall discuss how to enable or disable swap partition in Ubuntu Linux. Ubuntu Linux or any Linux operating system can use a swap partition for paging in case if it runs out of physical memory. The swap partition is not a mandatory requirement for using Linux but it is advisable that you have a swap partition setup to avoid memory bottleneck in case you run out of your physical memory.

The aim of this post is explorer the ways in which we can enable or disable swap partitions it is assumed that you have already swap partition created during the Ubuntu Linux installation.

Method 1:

We can use Gparted partition manager to enable or disable a swap partition. If Gparted is not installed in your Ubuntu Linux then use the following command below to install it.

   1: sudo apt-get install gparted

This will install the Gparted partition editor which you can access from System>>Administration>>Partition Editor

screenshot-1

The Gparted will now display all the available partitions in the hard disk that is selected. In this case we have a 14.99GB hard disk that has got a swap partition of 682.42MB.

screenshot-2

To enable the Swap partition:

To enable the swap partitions right click on the swap partition and then select the ‘Swapon’ option to enable the swap partition.

screenshot-3

To disable the Swap partition:

To disable the swap partitions right click on the swap partition and then select the ‘Swapoff’ option to disable the swap partition.

screenshot-4

Method 2:

In this method we shall discuss the enabling and disabling swap partition from terminal.

To enable the Swap partition:

To enable all the swap partitions on your computer you can use the following command.

   1: sudo swapon –a

If you would like to enable the swap partition for a particular partition then you can use the following command:

   1: sudo swapon –U <uuid>

To find the UUID of all the partitions use this command:

   1: sudo blkid

screenshot-5

In our example the UUID of our swap partition is 39be8652-da3d-4ad0-b11a-adb6c2ba3586 so the command will look like:

   1: sudo swapon –U 39be8652-da3d-4ad0-b11a-adb6c2ba3586

To disable the Swap partition:

To disable all the swap partitions on your computer you can use the following command.

   1: sudo swapoff –a

If you would like to disable the swap partition for a particular partition then you can use the following command:

   1: sudo swapoff –U <uuid>

In our example the UUID of our swap partition is 39be8652-da3d-4ad0-b11a-adb6c2ba3586 so the command will look like:

   1: sudo swapoff –U 39be8652-da3d-4ad0-b11a-adb6c2ba3586

That’s it you can enable or disable swap partition either using the Gparted GUI or using the command line.

[This is a guest post by Shivaranjan Bhoopathy. He writes articles on Linux, Windows and freeware softwares. A visit to his Blog is highly recommended. You’re sure to find something of interest.]



Share

No Responses so far | Share Your Opinions!

Leave a Comment

Note: We discourage users from using keywords in their names while posting comments, most of them get caught by spam, also it really would be more fruitful in knowing people who comment by their real name, rather than by using a name no one relates to. In future we reserve the right to delete comments from users using a name other than their own.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>