Jump to content

Swap on Linux


Guest Jagadish
 Share

Recommended Posts

Guest Jagadish

Can the swap turned off when it is in use.

 

Filename Type Size Used Priority

/dev/sdb1 partition 2048248 103008 -7

/dev/sdb2 partition 2048276 368836 1

/dev/sdb3 partition 2048276 369016 1

/dev/sda2 partition 2096472 0 -10

/dev/sda3 partition 2096472 0 -11

/dev/sda7 partition 2096440 0 -12

 

Thanks

Link to comment
Share on other sites

You can turn swap off just by doing:

 

swapoff /dev/sdxx

 

command, where sdxx is the partiton. For example:

 

root@esprit:/home/ian# fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x02300e71

  Device Boot	  Start		 End	  Blocks   Id  System
/dev/sda1			   1		 124	  995998+  82  Linux swap / Solaris
/dev/sda2   *		 125		2614	20000925   83  Linux
/dev/sda3			2615	   19457   135291397+  83  Linux

 

shows /dev/sda1 as my swap, and so to turn it off:

 

swapoff /dev/sda1

 

would do the trick. When you reboot, it will be enabled again, but you can simply rectify that by editing /etc/fstab and commenting out the swap line, or remove it if you don't want it.

 

Oh, and if you want to enable it again without rebooting:

 

swapon /dev/sdxx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...