What is the size of the swap partition ?
When I installed Ubuntu, I was asked the size of the swap partition.
I got a 500G partition for Ubuntu, and my RAM size is 8G, and will expand to 16G in a year or two. What should be the size of the swap partition then ? Thank you ! |
Swap partition is usually twice the size of ram, but nowadays ram exceeds the amount necessary so you can decrease the size of swap if you like.
Running top will tell you how much you're using. |
hi
Well i think ubuntu precise pangolin 12.04LTS (for example) recquires at least 4 gig for the swap, as you have plenty of memory it will be no harm to set more. Regards __--__--__ You know nothing until you start sharing it! |
There are no rules of thumb regarding the size of the swap partition, although some ancient ones (like swap=2xRAM) still are seen sometimes in the wild. Ubuntu, like any other Linux distro, will run just fine even without a swap partition, unless you run out of RAM.
It depends solely on your usage of the machine how much swap is needed. On typical modern desktop machines with 4-32GB of RAM usually a swap partition of 1GB is more than sufficient, unless you run really huge workloads. The only exception to this is when you want to use the hibernate/suspend-to-disk feature, in that case you should have a swap partition that is as least as large as physical RAM. As an example, on my main machine with 16GB of RAM I have a 1GB swap partition and no problems at all with that, while on my laptop with 4GB of RAM I use the hibernate/suspend-to-disk function and therefore use a 4GB swap partition. |
You can always add swap space if need be:
$ dd if=/dev/zero of=/swap.file bs=1M count=1000 $ mkswap /swap.file $ swapon /swapfile Will give you 1.0 GB of swap space on the fly. I like swap space, because of the way I work, but for most people running a lappy or desktop for entertainment or office-productivity applications, the machine will never use swap space. |
One thing to remember... If this is for a laptop (unlikely) you need enough swap to at least hold active memory. If swap is actually used, you need enough for active memory + that used during normal swap activity. This is to support hibernation (to disk - it allows you to turn off your system, replace battery, put new battery in, then resume). Suspend to memory is faster- but you cannot turn off your system without causing a crash.
|
Quote:
I have 16gb swap on my system and it runs nice and sweet, but you can always do a test yourself with different swap sizes. |
Quote:
On an ordinary desktop or laptop (not server) system (assuming you are not using hibernate) there is no correlation between the amount of ram you have and the amount of swap space you ought to have. Given zero info about the usage of a system, my best guess at an appropriate swap size is 2GB. If you have 0.5GB of ram, 2GB of swap is a good choice, though 2x ram would suggest less. If you have 16GB of ram, 2GB of swap is a good choice, though 2x ram would suggest absurdly more. BTW, on your system that HAS 16GB of swap, did you ever check how much swap was USED? I expect swap use was around zero. On ordinary systems, swap use is near zero. On ordinary systems, swap is mainly a safety valve for unexpected situations. If almost no swap is used, 2GB makes a good safety valve. In the unlikely event that you notice more than a few hundred MB of swap actually getting used, you ought to increase the swap allocation above 2GB. |
Quote:
With that in mind lets look at the older settings for swap: systems with less then 1G ram you typically had a 2:1 ratio of swap:ram systems between 1G-4G you could typically use a 1:1 or 1.5:1 ratio of swap:ram systems greater then 4G you can cap your swap at 4G as there really is no need to have much more swap then that. If you are running applications/programs that are consuming more then 4G of physical RAM then you will want to increase the amount of RAM. As you are already starting with 8G of ram and will be upgrading to 16G within the next year/2year a 4G swap should be fine. You can always use more swap if you wish to consume extra HDD space. |
Quote:
|
Yes SSDs are still slower then RAM, but they are considerably faster then HDDs and id never waist the space of a SSD for swap, they are just to bloody expensive for the time bean to use for swap. thus i dont consider them for a swap partition.
|
Quote:
What he said Ignoring hibernation on a laptop (which is often finicky anyway), swap is just used as a safety valve for problems. There is absolutely no reason why swap needs to be 2x RAM, that "rule of thumb" has been obsolete for longer than it was applicable. It's right up there with the default 5% root reserve space for ext3 partitions. My systems never use any swap unless a process goes awry and eats all the RAM. In that case, it's simply a matter of how quickly I catch it versus how "awry" the process has gone. I typically keep my swap partitions to 2GB or smaller, except for development machines where excess RAM usage by prototype codes can be a "regular" occurrence. |
Quote:
as for rules of the size of swap, really it depends on what you intend to do with your machine, most people who do light use of there machines can get away with no swap, but with the size of HDDs being so huge these days, a few gigs wouldn't hurt anyways. |
Quote:
|
Quote:
http://www.pcstats.com/articleview.c...id=2718&page=4 Its not a very good review I know, sorry. But you get the idea. ;) Quote:
Quote:
But just putting a current SATAIII SSD on a SATA express port wont make much if any 'real world' difference, and only minor differences in benchmarking....just like when HDDs moved from SATAI->SATAII or SATAII-> SATAIII (its only just been in the last year or two that HDDs have got close to the bandwidth limit of SATAI). SSDs will move to SATA express sooner or later, they are already touching the edge of the bandwidth limit for SATAIII. BTW, the fastest SATAIII SSDs are as fast as RAM....as long as you are talking PC-66 SD-RAM or slower. ;) |
All times are GMT -5. The time now is 03:06 PM. |