Swap: Difference between revisions

From Hackepedia
Jump to navigationJump to search
Frankk (talk | contribs)
No edit summary
Frankk (talk | contribs)
No edit summary
Line 1: Line 1:
Is a secondary storage for [[memory]] that is swapped or paged out.  It is also used for saving the [[kernel]] [[core]]file when the system [[panic]]s. Some systems compress their corefile to swap and others don't ([[BSD]] doesn't), this is why it's a good idea to have 1.5 to 2 times as much swap as physical memory in a machine (as a rule of thumb), so that you can get a good corefile.
Swap a secondary storage for [[memory]] that is swapped or paged out, usually residing on your hard disk.   
 
It is also used for saving the [[kernel]] [[core]]file when the system [[panic]]s. Some systems compress their corefile to swap and others don't (such as [[BSD]]), this is why it's a good idea to have 1.5 to 2 times as much swap as physical memory in a machine (as a rule of thumb), so that you can get a good corefile.
 
Don't forget to ensure there is always enough room in your swap if your RAM is being used to its maximum capacity:
# swapinfo
Device          1K-blocks    Used    Avail Capacity
/dev/ad0s1b        105288    68596    36692    65%
 
otherwise you'll start getting errors to syslog, running applications will be killed, and it will create a general
mess of things:
 
Oct 27 09:51:38 mail swap_pager_getswapspace(9): failed
Oct 27 09:51:38 mail swap_pager_getswapspace(5): failed
Oct 27 09:51:38 mail swap_pager_getswapspace(16): failed
Oct 27 09:51:40 mail pid 95400 (perl5.8.7), uid 125, was killed: out of swap space
 
If you are running out of swapspace frequently, or just want to increase the capacity, you can [http://www.freebsd.org/handbook/adding-swap-space.html add a swapfile ]very easily on [[FreeBSD]].

Revision as of 11:42, 27 October 2005

Swap a secondary storage for memory that is swapped or paged out, usually residing on your hard disk.

It is also used for saving the kernel corefile when the system panics. Some systems compress their corefile to swap and others don't (such as BSD), this is why it's a good idea to have 1.5 to 2 times as much swap as physical memory in a machine (as a rule of thumb), so that you can get a good corefile.

Don't forget to ensure there is always enough room in your swap if your RAM is being used to its maximum capacity:

# swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ad0s1b        105288    68596    36692    65%

otherwise you'll start getting errors to syslog, running applications will be killed, and it will create a general mess of things:

Oct 27 09:51:38 mail swap_pager_getswapspace(9): failed
Oct 27 09:51:38 mail swap_pager_getswapspace(5): failed
Oct 27 09:51:38 mail swap_pager_getswapspace(16): failed
Oct 27 09:51:40 mail pid 95400 (perl5.8.7), uid 125, was killed: out of swap space

If you are running out of swapspace frequently, or just want to increase the capacity, you can add a swapfile very easily on FreeBSD.