[vox-tech] Swap Size

Ted Deppner ted at psyber.com
Wed Feb 21 10:21:13 PST 2007


On Wed, Feb 21, 2007 at 08:20:35AM -0800, Bob Scofield wrote:
> I've ordered a laptop with 1G of memory.  Yesterday I read on the web someone 
> recommending that you have twice as much swap as memory.  So he said that if 
> you have 512M of memory you should have 1G of swap.

In the old days (and they weren't "the good 'ole days") you had too much
swap so that a production long-running server wouldn't crash if something
started chewing ram.  It'd still run, ever slower, giving you time to
find the offending process and kill it.

In the last 5 years though most unix systems will kill off memory hogs
themselves rathering than dying themselves.

> But if I have 1G of memory it certainly seems like 2G of swap is too much.  
> Couldn't I just get by with 1G swap, or should I allocate 2G to swap?

As others have said, a gig of swap is a good thing.  For a laptop, you
could use a lot less, depending on your use patterns, but might need more
for that hardware suspend.  You should already know if you're a heavy
memory user, and it sounds like you aren't, so go with a gig and don't be
concerned.

If you do find you occasionally you need more ram, you can easily add some
more swap.

dd if=/dev/zero of=/SWAPFILE bs=1024k count=1024  # (a gig)
mkswap /SWAPFILE
swapon /SWAPFILE

-- 
Ted Deppner
http://www.deppner.us/


More information about the vox-tech mailing list