On Thu, Nov 4, 2010 at 5:58 PM, Bryan O'Neal <
Bryan.ONeal@theonealandassociates.com> wrote:
> Setting swapiness is how I can deal with a recurrence but it will not
> flush current swap. And I can not shut down any process to perform
> swap off. :(
>
> On 11/4/10, Eric Shubert <ejs@shubes.net> wrote:
> > On 11/04/2010 03:26 PM, Bryan O'Neal wrote:
> >> Please no debates on why I need to clear swap...
> >>
> >> If I have a box with 20% free ram and 5% free swap but no paging
> >> activity - how do I force linux to release the allocated swap? I have
> >> ~ 2x as much allocated swap as free memory so simply turning swap off
> >> seems like a bad idea.
> >>
> >> Thanks
> >>
> >
> > To minimize swap use, put
> > vm.swappiness = 0
> > in /etc/sysctl.conf file. You can also change it on the fly in the
> > /proc/sys/vm/swappiness.
> > See http://unixfoo.blogspot.com/2007/11/linux-performance-tuning.html
> >
> > AFA purging the swap file is concerned, I only know to stop and start it
> > again:
> > # swapoff -a && swapon -a
> > You might not run into trouble doing this, as there's probably a good
> > deal of (filesystem) cached ram being used that the kernel will give up
> > if it's needed for running processes. Do the math though to be sure you
> > won't run out. Either that or stop some less important processes while
> > you do it.
> >
> > --
> > -Eric 'shubes'
> >
>
>
I would leave the current swap, in case you start thrashing, however, you
requested we not debate, here's the howto:
Type following command to create 512MB swap file (1024 * 512MB = 524288
block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
c) Set up a Linux swap area:
# mkswap /swapfile1
d) Activate /swapfile1 swap space immediately:
# swapon /swapfile1
e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab
file. Open this file using text editor such as vi:
# vi /etc/fstab
Append following line:
/swapfile1 swap swap defaults 0 0
And comment out the old swapfile. You can swapoff the old file also, but I
would, in a production machine test the full swap utilization after changes
through a reboot.
--
Skype: 6022393392
ATT: 5037544452
GV: 6236883392
http://www.it-clowns.com
Politicians should read science fiction, not westerns and detective stories.
-Arthur C. Clark I am free because I know that I alone am morally
responsible for everything I do. -Heinlein
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss