Swap partition sizes Was: Best partition size for Ubuntu Root
Kent Borg
kentborg at borg.org
Fri May 2 13:56:30 UTC 2008
If you are going to hibernate to swap, make sure your swap is big
enough. For example, my notebook has 1 GB of RAM. When I gave it 1 GB
of swap it frequently didn't have enough space to hibernate (can you say
"Firefox with lots of tabs open and Thunderbird looking at a big
mailbox"?). Now I have 3GB of swap. By the time I have used enough
swap that I wouldn't be able to hibernate my machine is running too
slowly anyway. So, for a machine that you want to hibernate, 2xRAM plus
a good extra dollop is good.
Otherwise: use 1 GB.
Reasoning:
a) If you have only a little RAM (maybe less than 1GB), jeepers, at
least have more than enough swap.
b) If you have a reasonable amount of RAM (maybe 1 to 4 GB), you have a
nice enough machine you want some performance, by the time you dip into
more than 1 GB of swap, things will start to slow down.
c) If you have a lot of RAM (more than 4 GB), you have a nice machine
that probably has a lot of disk space too, setting aside 1 GB is cheap,
and the Linux kernel likes having some swap; even if there is enough RAM
for everything it needs to do it still can decide to swap out some stuff
isn't in heavy use and instead use that RAM for cacheing the disk
(making your computer faster).
Disclaimer: I don't have personal experience with case "c". I would
love to hear personal reports from those who have. For example, a
fairly big machine with multiple cores and 16-32GB of RAM, running
multiple virtual machines. How much swap would one want?
I can imagine the disks become the bottleneck and any active swapping
competes with that. Also, virtual machines like lots of RAM, don't
count on swap to help with that. So in this case I would figure one
would want very little swap. But if you have 32GB of RAM, having only 1
GB of swap seems like only a little. If some dusty data isn't being
used, why not let the kernel swap it out and use a tad more RAM for more
caching? Any experiences to report here?
Thanks,
-kb
More information about the ubuntu-users
mailing list