Is there a maximum size at which a swap file can function?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
7
down vote
favorite
As far as I know, the theoretical limit for a swap file is insanely large depending on whether a 32bit or 64bit system is used.
I have made a 16GB swap file on a 4GB RAM 64bit system with otherwise low-average specs, because I have more than enough space on my 1TB internal HDD...
But does the large swap file actually make a difference in speed/performance?
swap
 |Â
show 3 more comments
up vote
7
down vote
favorite
As far as I know, the theoretical limit for a swap file is insanely large depending on whether a 32bit or 64bit system is used.
I have made a 16GB swap file on a 4GB RAM 64bit system with otherwise low-average specs, because I have more than enough space on my 1TB internal HDD...
But does the large swap file actually make a difference in speed/performance?
swap
1
Related: askubuntu.com/q/49109/367990
â Byte Commander
May 27 at 22:52
2
IMO if you are using swap you really need more RAM, not a larger swap file
â Panther
May 27 at 23:35
1
if you're using HDDs then you should use zram instead and lower the priority of the HDD swaps. And such a big swap partition won't help, because by the type you use like 4GB swap your system had been slow to a crawl
â phuclv
May 28 at 6:00
2
Related: askubuntu.com/q/1017021/504066
â PerlDuck
May 28 at 9:49
As far as I recall a swap file will consume some amount of physical RAM (I think less than 1% of the size of the swap file). So having an excessively large swap file could hurt performance due to that memory consumption. But for a reasonably sized swap file, that's not going to be a problem.
â kasperd
May 28 at 12:09
 |Â
show 3 more comments
up vote
7
down vote
favorite
up vote
7
down vote
favorite
As far as I know, the theoretical limit for a swap file is insanely large depending on whether a 32bit or 64bit system is used.
I have made a 16GB swap file on a 4GB RAM 64bit system with otherwise low-average specs, because I have more than enough space on my 1TB internal HDD...
But does the large swap file actually make a difference in speed/performance?
swap
As far as I know, the theoretical limit for a swap file is insanely large depending on whether a 32bit or 64bit system is used.
I have made a 16GB swap file on a 4GB RAM 64bit system with otherwise low-average specs, because I have more than enough space on my 1TB internal HDD...
But does the large swap file actually make a difference in speed/performance?
swap
edited May 28 at 12:33
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
Zanna
47.8k13116226
47.8k13116226
asked May 27 at 22:43
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
Devon van Schoor
364
364
1
Related: askubuntu.com/q/49109/367990
â Byte Commander
May 27 at 22:52
2
IMO if you are using swap you really need more RAM, not a larger swap file
â Panther
May 27 at 23:35
1
if you're using HDDs then you should use zram instead and lower the priority of the HDD swaps. And such a big swap partition won't help, because by the type you use like 4GB swap your system had been slow to a crawl
â phuclv
May 28 at 6:00
2
Related: askubuntu.com/q/1017021/504066
â PerlDuck
May 28 at 9:49
As far as I recall a swap file will consume some amount of physical RAM (I think less than 1% of the size of the swap file). So having an excessively large swap file could hurt performance due to that memory consumption. But for a reasonably sized swap file, that's not going to be a problem.
â kasperd
May 28 at 12:09
 |Â
show 3 more comments
1
Related: askubuntu.com/q/49109/367990
â Byte Commander
May 27 at 22:52
2
IMO if you are using swap you really need more RAM, not a larger swap file
â Panther
May 27 at 23:35
1
if you're using HDDs then you should use zram instead and lower the priority of the HDD swaps. And such a big swap partition won't help, because by the type you use like 4GB swap your system had been slow to a crawl
â phuclv
May 28 at 6:00
2
Related: askubuntu.com/q/1017021/504066
â PerlDuck
May 28 at 9:49
As far as I recall a swap file will consume some amount of physical RAM (I think less than 1% of the size of the swap file). So having an excessively large swap file could hurt performance due to that memory consumption. But for a reasonably sized swap file, that's not going to be a problem.
â kasperd
May 28 at 12:09
1
1
Related: askubuntu.com/q/49109/367990
â Byte Commander
May 27 at 22:52
Related: askubuntu.com/q/49109/367990
â Byte Commander
May 27 at 22:52
2
2
IMO if you are using swap you really need more RAM, not a larger swap file
â Panther
May 27 at 23:35
IMO if you are using swap you really need more RAM, not a larger swap file
â Panther
May 27 at 23:35
1
1
if you're using HDDs then you should use zram instead and lower the priority of the HDD swaps. And such a big swap partition won't help, because by the type you use like 4GB swap your system had been slow to a crawl
â phuclv
May 28 at 6:00
if you're using HDDs then you should use zram instead and lower the priority of the HDD swaps. And such a big swap partition won't help, because by the type you use like 4GB swap your system had been slow to a crawl
â phuclv
May 28 at 6:00
2
2
Related: askubuntu.com/q/1017021/504066
â PerlDuck
May 28 at 9:49
Related: askubuntu.com/q/1017021/504066
â PerlDuck
May 28 at 9:49
As far as I recall a swap file will consume some amount of physical RAM (I think less than 1% of the size of the swap file). So having an excessively large swap file could hurt performance due to that memory consumption. But for a reasonably sized swap file, that's not going to be a problem.
â kasperd
May 28 at 12:09
As far as I recall a swap file will consume some amount of physical RAM (I think less than 1% of the size of the swap file). So having an excessively large swap file could hurt performance due to that memory consumption. But for a reasonably sized swap file, that's not going to be a problem.
â kasperd
May 28 at 12:09
 |Â
show 3 more comments
6 Answers
6
active
oldest
votes
up vote
6
down vote
It makes no difference in terms of speed or performance. It just allows you to use up to 20 GB of virtual memory before the OOM killer starts killing processes to reclaim memory.
If you want better performance:
- decrease
swappiness
if you don't use more than 4 GB that often - add RAM
- switch to an SSD and put the swap file on it
If you often come into the point of having to swap out memory blocks, a SSD due their architecture and limited write cycles is not the way to go because it can easily use up the SSD's write cycles very quickly. If you only occasionally come into the need of swap memory SSD's are fine.
â Videonauth
May 27 at 23:13
10
@Videonauth: "Easily use up the SSD's write cycles very quickly": any kind of half-decent modern SSD can sustain writing the full capacity of the SSD day after day for years. Your advice might have been correct in 2010, but it's out of date. Even a consumer-grade 256 GiB Samsung SSD 840 can sustain writing 100 GiB per day for more than 2 years.
â AlexP
May 28 at 0:30
If you have lots of RAM, decreasing swappiness makes even less difference than if you had limited RAM. Actually installing lots of RAM makes any other tweaks to swap redundant if it's enough that you can avoid swapping. Keep a swap partition for stability "just in case", 99.9% of the time it won't be used, and you'll retain great performance.
â thomasrutter
May 29 at 0:12
1
Also, the thing about limited SSD write cycles has been untrue for over a decade, it's really time this FUD needs to be called out. Sorry this comment is so redundant given that AlexP already addressed this, but it bears underlining. SSDs are great for write-heavy applications.
â thomasrutter
May 29 at 0:14
1
Wear leveling in SSDs became a thing around 2008 (2008 paper | 2009 Anandtech article). "Did laptops at normal consumer price points even come with SSDs in 2008" heck no, SSDs were crazy expensive and didn't really come standard.
â thomasrutter
May 29 at 15:21
 |Â
show 3 more comments
up vote
5
down vote
You can have up to 32 swap areas (files or partitions) with up to ~4 billion (2^32) pages each, where a "page" is 4kB on a traditional (eg x86 or x86_64) system but can be larger on other architectures or if you have configured large pages specially.
This gives a theoretical maximum of 16TB per swap area, and up to 32 swap areas. There may be other limitations that apply before you reach this but this is as big a swap area that mkswap
can create for you.
As to how much you want, any swap area beyond the maximum you actually utilize contributes nothing to system performance or stability. The trick is to estimate the maximum amount of utilization that will ever occur in a normal or even abnormal situation, and use that as your swap file size and no more.
At time of writing, swap space greater than around 4GB more than your physical memory size is very unlikely to be utilized, unless your system is very abnormal. On a typical system such as a desktop system used by one person at a time, you can probably even stop at a maximum of say 6GB to 8GB even if your physical memory is greater.
add a comment |Â
up vote
2
down vote
This answer might not be appropriate for Ubuntu 18.04 (thanks to @Chai T. Rex for pointing this out in the comments).
Anyway for previous versions, here it goes (there is still no proposed update LTS>LTS, so this might still be relevant):
It's not a file, it's a partition, and yes it does because of swappiness
The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
So basically if your swap partition is much bigger than the RAM that you have, the system will tend to swap more, causing a general slowness.
4
There are swap files now, and they're the default (instead of partitions) when installing 18.04 from scratch.
â Chai T. Rex
May 27 at 22:47
Ok thanks, I correct the answer
â dadexix86
May 27 at 22:48
1
I assume the behaviour of swap pretty much stays the same, no matter whether it's backed by a partition or file. You can also have multiple swap files and/or partitions at the same time. Anyway, I don't think more swap would have a negative effect while there's still enough RAM left.
â Byte Commander
May 27 at 22:55
I would assume the same, but until I'll get my hands on it, this is just a wild assumption
â dadexix86
May 27 at 22:56
There swap partitions and there are swap files. Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot). Swap partition are better in case of full disk where the swap file could be created fragmented. ... The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation â Devon van Schoor j
â Devon van Schoor
May 27 at 23:00
add a comment |Â
up vote
2
down vote
According to the answer by Gilles
...There used to be a 2GB swap size limit (on most 32-bit platforms), but this has not been the case for years. The limitation was removed at some point in the 2.2 kernel series.
Additionally, he cites man page for mkswap
:
The maximum useful size of a swap area depends on the architecture and the kernel version.
In linux/swap.h library there is MAX_SWAPFILES
entry, so there is limit on the number of swap files on the kernel level, however that apparently isn't definitive area either. According to the linked document:
It should be noted that the six bits for âÂÂtypeâ should allow up to 64 swap areas to exist in a 32 bit architecture instead of the MAX_SWAPFILES restriction of 32
Which I understand has having maximum of up to 64 swap files on the 32-bit architectures. However, I haven't noticed in the document mention what would happen on 64-bit architecture. Also worth noting that in this case, OP's efforts to create swap files failed on 30th entry.
As for swap partitions, there appears to be no limit for that in the kernel, besides previously mentioned constats, but number of any partitions still would be limited by the underlying BIOS and disk layout.
add a comment |Â
up vote
2
down vote
There is not much difference in speed or performance when increasing the swap partition to be arbitrarily large.
There are several factors related to swap that can affect performance such as swappiness
and hard drive type (SDD or HDD).
Swap is fairly slow and increasing swappiness reduces the performance. However it only has an affect if there is not enough RAM. But it is better than not having any swap. My recommendation is to make the swap partition size twice as big as your RAM.
5
that recommendation is outdated. Modern systems with 32 or 64GB RAM won't need 64 or 128GB swap
â phuclv
May 28 at 6:07
3
@LðuVénhPhúc I wouldn't use more than 2GB of swap these days...
â el.pescado
May 28 at 7:19
2gb seems very low ... virtual machines or games could really fill more than 2gb of swap very quickly. I think 4 to 8gb of swap works well with any amount of ram. If you need more than 8gb then you should probably add more ram.
â Germain
May 28 at 13:46
add a comment |Â
up vote
0
down vote
I arrive at the fact that a swap file or swap partition practically have no limit. Also, my 16GB swap file is quite big but the size does not affect the speed.
However what I gather is that what does effect the speed is the system actually making use of that swap space as opposed to the physical hardware.
My solution to that is to make a high swappiness value so that the swap is not overly used as opposed to the faster hardware.
so I did:
sudo -s
nano /etc/sysctl.conf
Added to file:
#vm.swappiness = 50
save
sudo sysctl -p
to refresh (or could have just rebooted)
Adding the line#vm.swappiness = 50
to/etc/sysctl.conf
doesn't have any effect, the leading#
makes this line to be a comment, remove it. You can check swappiness withcat /proc/sys/vm/swappiness
.
â mook765
May 28 at 6:27
But the method I described did work. When I input [cat /proc/sys/vm/swappiness] I get 50 as the output
â Devon van Schoor
May 28 at 12:50
add a comment |Â
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
It makes no difference in terms of speed or performance. It just allows you to use up to 20 GB of virtual memory before the OOM killer starts killing processes to reclaim memory.
If you want better performance:
- decrease
swappiness
if you don't use more than 4 GB that often - add RAM
- switch to an SSD and put the swap file on it
If you often come into the point of having to swap out memory blocks, a SSD due their architecture and limited write cycles is not the way to go because it can easily use up the SSD's write cycles very quickly. If you only occasionally come into the need of swap memory SSD's are fine.
â Videonauth
May 27 at 23:13
10
@Videonauth: "Easily use up the SSD's write cycles very quickly": any kind of half-decent modern SSD can sustain writing the full capacity of the SSD day after day for years. Your advice might have been correct in 2010, but it's out of date. Even a consumer-grade 256 GiB Samsung SSD 840 can sustain writing 100 GiB per day for more than 2 years.
â AlexP
May 28 at 0:30
If you have lots of RAM, decreasing swappiness makes even less difference than if you had limited RAM. Actually installing lots of RAM makes any other tweaks to swap redundant if it's enough that you can avoid swapping. Keep a swap partition for stability "just in case", 99.9% of the time it won't be used, and you'll retain great performance.
â thomasrutter
May 29 at 0:12
1
Also, the thing about limited SSD write cycles has been untrue for over a decade, it's really time this FUD needs to be called out. Sorry this comment is so redundant given that AlexP already addressed this, but it bears underlining. SSDs are great for write-heavy applications.
â thomasrutter
May 29 at 0:14
1
Wear leveling in SSDs became a thing around 2008 (2008 paper | 2009 Anandtech article). "Did laptops at normal consumer price points even come with SSDs in 2008" heck no, SSDs were crazy expensive and didn't really come standard.
â thomasrutter
May 29 at 15:21
 |Â
show 3 more comments
up vote
6
down vote
It makes no difference in terms of speed or performance. It just allows you to use up to 20 GB of virtual memory before the OOM killer starts killing processes to reclaim memory.
If you want better performance:
- decrease
swappiness
if you don't use more than 4 GB that often - add RAM
- switch to an SSD and put the swap file on it
If you often come into the point of having to swap out memory blocks, a SSD due their architecture and limited write cycles is not the way to go because it can easily use up the SSD's write cycles very quickly. If you only occasionally come into the need of swap memory SSD's are fine.
â Videonauth
May 27 at 23:13
10
@Videonauth: "Easily use up the SSD's write cycles very quickly": any kind of half-decent modern SSD can sustain writing the full capacity of the SSD day after day for years. Your advice might have been correct in 2010, but it's out of date. Even a consumer-grade 256 GiB Samsung SSD 840 can sustain writing 100 GiB per day for more than 2 years.
â AlexP
May 28 at 0:30
If you have lots of RAM, decreasing swappiness makes even less difference than if you had limited RAM. Actually installing lots of RAM makes any other tweaks to swap redundant if it's enough that you can avoid swapping. Keep a swap partition for stability "just in case", 99.9% of the time it won't be used, and you'll retain great performance.
â thomasrutter
May 29 at 0:12
1
Also, the thing about limited SSD write cycles has been untrue for over a decade, it's really time this FUD needs to be called out. Sorry this comment is so redundant given that AlexP already addressed this, but it bears underlining. SSDs are great for write-heavy applications.
â thomasrutter
May 29 at 0:14
1
Wear leveling in SSDs became a thing around 2008 (2008 paper | 2009 Anandtech article). "Did laptops at normal consumer price points even come with SSDs in 2008" heck no, SSDs were crazy expensive and didn't really come standard.
â thomasrutter
May 29 at 15:21
 |Â
show 3 more comments
up vote
6
down vote
up vote
6
down vote
It makes no difference in terms of speed or performance. It just allows you to use up to 20 GB of virtual memory before the OOM killer starts killing processes to reclaim memory.
If you want better performance:
- decrease
swappiness
if you don't use more than 4 GB that often - add RAM
- switch to an SSD and put the swap file on it
It makes no difference in terms of speed or performance. It just allows you to use up to 20 GB of virtual memory before the OOM killer starts killing processes to reclaim memory.
If you want better performance:
- decrease
swappiness
if you don't use more than 4 GB that often - add RAM
- switch to an SSD and put the swap file on it
answered May 27 at 22:49
![](https://i.stack.imgur.com/QxbAJ.png?s=32&g=1)
![](https://i.stack.imgur.com/QxbAJ.png?s=32&g=1)
Chai T. Rex
3,45611132
3,45611132
If you often come into the point of having to swap out memory blocks, a SSD due their architecture and limited write cycles is not the way to go because it can easily use up the SSD's write cycles very quickly. If you only occasionally come into the need of swap memory SSD's are fine.
â Videonauth
May 27 at 23:13
10
@Videonauth: "Easily use up the SSD's write cycles very quickly": any kind of half-decent modern SSD can sustain writing the full capacity of the SSD day after day for years. Your advice might have been correct in 2010, but it's out of date. Even a consumer-grade 256 GiB Samsung SSD 840 can sustain writing 100 GiB per day for more than 2 years.
â AlexP
May 28 at 0:30
If you have lots of RAM, decreasing swappiness makes even less difference than if you had limited RAM. Actually installing lots of RAM makes any other tweaks to swap redundant if it's enough that you can avoid swapping. Keep a swap partition for stability "just in case", 99.9% of the time it won't be used, and you'll retain great performance.
â thomasrutter
May 29 at 0:12
1
Also, the thing about limited SSD write cycles has been untrue for over a decade, it's really time this FUD needs to be called out. Sorry this comment is so redundant given that AlexP already addressed this, but it bears underlining. SSDs are great for write-heavy applications.
â thomasrutter
May 29 at 0:14
1
Wear leveling in SSDs became a thing around 2008 (2008 paper | 2009 Anandtech article). "Did laptops at normal consumer price points even come with SSDs in 2008" heck no, SSDs were crazy expensive and didn't really come standard.
â thomasrutter
May 29 at 15:21
 |Â
show 3 more comments
If you often come into the point of having to swap out memory blocks, a SSD due their architecture and limited write cycles is not the way to go because it can easily use up the SSD's write cycles very quickly. If you only occasionally come into the need of swap memory SSD's are fine.
â Videonauth
May 27 at 23:13
10
@Videonauth: "Easily use up the SSD's write cycles very quickly": any kind of half-decent modern SSD can sustain writing the full capacity of the SSD day after day for years. Your advice might have been correct in 2010, but it's out of date. Even a consumer-grade 256 GiB Samsung SSD 840 can sustain writing 100 GiB per day for more than 2 years.
â AlexP
May 28 at 0:30
If you have lots of RAM, decreasing swappiness makes even less difference than if you had limited RAM. Actually installing lots of RAM makes any other tweaks to swap redundant if it's enough that you can avoid swapping. Keep a swap partition for stability "just in case", 99.9% of the time it won't be used, and you'll retain great performance.
â thomasrutter
May 29 at 0:12
1
Also, the thing about limited SSD write cycles has been untrue for over a decade, it's really time this FUD needs to be called out. Sorry this comment is so redundant given that AlexP already addressed this, but it bears underlining. SSDs are great for write-heavy applications.
â thomasrutter
May 29 at 0:14
1
Wear leveling in SSDs became a thing around 2008 (2008 paper | 2009 Anandtech article). "Did laptops at normal consumer price points even come with SSDs in 2008" heck no, SSDs were crazy expensive and didn't really come standard.
â thomasrutter
May 29 at 15:21
If you often come into the point of having to swap out memory blocks, a SSD due their architecture and limited write cycles is not the way to go because it can easily use up the SSD's write cycles very quickly. If you only occasionally come into the need of swap memory SSD's are fine.
â Videonauth
May 27 at 23:13
If you often come into the point of having to swap out memory blocks, a SSD due their architecture and limited write cycles is not the way to go because it can easily use up the SSD's write cycles very quickly. If you only occasionally come into the need of swap memory SSD's are fine.
â Videonauth
May 27 at 23:13
10
10
@Videonauth: "Easily use up the SSD's write cycles very quickly": any kind of half-decent modern SSD can sustain writing the full capacity of the SSD day after day for years. Your advice might have been correct in 2010, but it's out of date. Even a consumer-grade 256 GiB Samsung SSD 840 can sustain writing 100 GiB per day for more than 2 years.
â AlexP
May 28 at 0:30
@Videonauth: "Easily use up the SSD's write cycles very quickly": any kind of half-decent modern SSD can sustain writing the full capacity of the SSD day after day for years. Your advice might have been correct in 2010, but it's out of date. Even a consumer-grade 256 GiB Samsung SSD 840 can sustain writing 100 GiB per day for more than 2 years.
â AlexP
May 28 at 0:30
If you have lots of RAM, decreasing swappiness makes even less difference than if you had limited RAM. Actually installing lots of RAM makes any other tweaks to swap redundant if it's enough that you can avoid swapping. Keep a swap partition for stability "just in case", 99.9% of the time it won't be used, and you'll retain great performance.
â thomasrutter
May 29 at 0:12
If you have lots of RAM, decreasing swappiness makes even less difference than if you had limited RAM. Actually installing lots of RAM makes any other tweaks to swap redundant if it's enough that you can avoid swapping. Keep a swap partition for stability "just in case", 99.9% of the time it won't be used, and you'll retain great performance.
â thomasrutter
May 29 at 0:12
1
1
Also, the thing about limited SSD write cycles has been untrue for over a decade, it's really time this FUD needs to be called out. Sorry this comment is so redundant given that AlexP already addressed this, but it bears underlining. SSDs are great for write-heavy applications.
â thomasrutter
May 29 at 0:14
Also, the thing about limited SSD write cycles has been untrue for over a decade, it's really time this FUD needs to be called out. Sorry this comment is so redundant given that AlexP already addressed this, but it bears underlining. SSDs are great for write-heavy applications.
â thomasrutter
May 29 at 0:14
1
1
Wear leveling in SSDs became a thing around 2008 (2008 paper | 2009 Anandtech article). "Did laptops at normal consumer price points even come with SSDs in 2008" heck no, SSDs were crazy expensive and didn't really come standard.
â thomasrutter
May 29 at 15:21
Wear leveling in SSDs became a thing around 2008 (2008 paper | 2009 Anandtech article). "Did laptops at normal consumer price points even come with SSDs in 2008" heck no, SSDs were crazy expensive and didn't really come standard.
â thomasrutter
May 29 at 15:21
 |Â
show 3 more comments
up vote
5
down vote
You can have up to 32 swap areas (files or partitions) with up to ~4 billion (2^32) pages each, where a "page" is 4kB on a traditional (eg x86 or x86_64) system but can be larger on other architectures or if you have configured large pages specially.
This gives a theoretical maximum of 16TB per swap area, and up to 32 swap areas. There may be other limitations that apply before you reach this but this is as big a swap area that mkswap
can create for you.
As to how much you want, any swap area beyond the maximum you actually utilize contributes nothing to system performance or stability. The trick is to estimate the maximum amount of utilization that will ever occur in a normal or even abnormal situation, and use that as your swap file size and no more.
At time of writing, swap space greater than around 4GB more than your physical memory size is very unlikely to be utilized, unless your system is very abnormal. On a typical system such as a desktop system used by one person at a time, you can probably even stop at a maximum of say 6GB to 8GB even if your physical memory is greater.
add a comment |Â
up vote
5
down vote
You can have up to 32 swap areas (files or partitions) with up to ~4 billion (2^32) pages each, where a "page" is 4kB on a traditional (eg x86 or x86_64) system but can be larger on other architectures or if you have configured large pages specially.
This gives a theoretical maximum of 16TB per swap area, and up to 32 swap areas. There may be other limitations that apply before you reach this but this is as big a swap area that mkswap
can create for you.
As to how much you want, any swap area beyond the maximum you actually utilize contributes nothing to system performance or stability. The trick is to estimate the maximum amount of utilization that will ever occur in a normal or even abnormal situation, and use that as your swap file size and no more.
At time of writing, swap space greater than around 4GB more than your physical memory size is very unlikely to be utilized, unless your system is very abnormal. On a typical system such as a desktop system used by one person at a time, you can probably even stop at a maximum of say 6GB to 8GB even if your physical memory is greater.
add a comment |Â
up vote
5
down vote
up vote
5
down vote
You can have up to 32 swap areas (files or partitions) with up to ~4 billion (2^32) pages each, where a "page" is 4kB on a traditional (eg x86 or x86_64) system but can be larger on other architectures or if you have configured large pages specially.
This gives a theoretical maximum of 16TB per swap area, and up to 32 swap areas. There may be other limitations that apply before you reach this but this is as big a swap area that mkswap
can create for you.
As to how much you want, any swap area beyond the maximum you actually utilize contributes nothing to system performance or stability. The trick is to estimate the maximum amount of utilization that will ever occur in a normal or even abnormal situation, and use that as your swap file size and no more.
At time of writing, swap space greater than around 4GB more than your physical memory size is very unlikely to be utilized, unless your system is very abnormal. On a typical system such as a desktop system used by one person at a time, you can probably even stop at a maximum of say 6GB to 8GB even if your physical memory is greater.
You can have up to 32 swap areas (files or partitions) with up to ~4 billion (2^32) pages each, where a "page" is 4kB on a traditional (eg x86 or x86_64) system but can be larger on other architectures or if you have configured large pages specially.
This gives a theoretical maximum of 16TB per swap area, and up to 32 swap areas. There may be other limitations that apply before you reach this but this is as big a swap area that mkswap
can create for you.
As to how much you want, any swap area beyond the maximum you actually utilize contributes nothing to system performance or stability. The trick is to estimate the maximum amount of utilization that will ever occur in a normal or even abnormal situation, and use that as your swap file size and no more.
At time of writing, swap space greater than around 4GB more than your physical memory size is very unlikely to be utilized, unless your system is very abnormal. On a typical system such as a desktop system used by one person at a time, you can probably even stop at a maximum of say 6GB to 8GB even if your physical memory is greater.
edited May 29 at 0:05
answered May 28 at 1:04
thomasrutter
25.2k46085
25.2k46085
add a comment |Â
add a comment |Â
up vote
2
down vote
This answer might not be appropriate for Ubuntu 18.04 (thanks to @Chai T. Rex for pointing this out in the comments).
Anyway for previous versions, here it goes (there is still no proposed update LTS>LTS, so this might still be relevant):
It's not a file, it's a partition, and yes it does because of swappiness
The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
So basically if your swap partition is much bigger than the RAM that you have, the system will tend to swap more, causing a general slowness.
4
There are swap files now, and they're the default (instead of partitions) when installing 18.04 from scratch.
â Chai T. Rex
May 27 at 22:47
Ok thanks, I correct the answer
â dadexix86
May 27 at 22:48
1
I assume the behaviour of swap pretty much stays the same, no matter whether it's backed by a partition or file. You can also have multiple swap files and/or partitions at the same time. Anyway, I don't think more swap would have a negative effect while there's still enough RAM left.
â Byte Commander
May 27 at 22:55
I would assume the same, but until I'll get my hands on it, this is just a wild assumption
â dadexix86
May 27 at 22:56
There swap partitions and there are swap files. Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot). Swap partition are better in case of full disk where the swap file could be created fragmented. ... The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation â Devon van Schoor j
â Devon van Schoor
May 27 at 23:00
add a comment |Â
up vote
2
down vote
This answer might not be appropriate for Ubuntu 18.04 (thanks to @Chai T. Rex for pointing this out in the comments).
Anyway for previous versions, here it goes (there is still no proposed update LTS>LTS, so this might still be relevant):
It's not a file, it's a partition, and yes it does because of swappiness
The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
So basically if your swap partition is much bigger than the RAM that you have, the system will tend to swap more, causing a general slowness.
4
There are swap files now, and they're the default (instead of partitions) when installing 18.04 from scratch.
â Chai T. Rex
May 27 at 22:47
Ok thanks, I correct the answer
â dadexix86
May 27 at 22:48
1
I assume the behaviour of swap pretty much stays the same, no matter whether it's backed by a partition or file. You can also have multiple swap files and/or partitions at the same time. Anyway, I don't think more swap would have a negative effect while there's still enough RAM left.
â Byte Commander
May 27 at 22:55
I would assume the same, but until I'll get my hands on it, this is just a wild assumption
â dadexix86
May 27 at 22:56
There swap partitions and there are swap files. Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot). Swap partition are better in case of full disk where the swap file could be created fragmented. ... The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation â Devon van Schoor j
â Devon van Schoor
May 27 at 23:00
add a comment |Â
up vote
2
down vote
up vote
2
down vote
This answer might not be appropriate for Ubuntu 18.04 (thanks to @Chai T. Rex for pointing this out in the comments).
Anyway for previous versions, here it goes (there is still no proposed update LTS>LTS, so this might still be relevant):
It's not a file, it's a partition, and yes it does because of swappiness
The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
So basically if your swap partition is much bigger than the RAM that you have, the system will tend to swap more, causing a general slowness.
This answer might not be appropriate for Ubuntu 18.04 (thanks to @Chai T. Rex for pointing this out in the comments).
Anyway for previous versions, here it goes (there is still no proposed update LTS>LTS, so this might still be relevant):
It's not a file, it's a partition, and yes it does because of swappiness
The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
So basically if your swap partition is much bigger than the RAM that you have, the system will tend to swap more, causing a general slowness.
edited May 27 at 22:47
answered May 27 at 22:46
![](https://i.stack.imgur.com/6SRsM.jpg?s=32&g=1)
![](https://i.stack.imgur.com/6SRsM.jpg?s=32&g=1)
dadexix86
5,3632492
5,3632492
4
There are swap files now, and they're the default (instead of partitions) when installing 18.04 from scratch.
â Chai T. Rex
May 27 at 22:47
Ok thanks, I correct the answer
â dadexix86
May 27 at 22:48
1
I assume the behaviour of swap pretty much stays the same, no matter whether it's backed by a partition or file. You can also have multiple swap files and/or partitions at the same time. Anyway, I don't think more swap would have a negative effect while there's still enough RAM left.
â Byte Commander
May 27 at 22:55
I would assume the same, but until I'll get my hands on it, this is just a wild assumption
â dadexix86
May 27 at 22:56
There swap partitions and there are swap files. Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot). Swap partition are better in case of full disk where the swap file could be created fragmented. ... The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation â Devon van Schoor j
â Devon van Schoor
May 27 at 23:00
add a comment |Â
4
There are swap files now, and they're the default (instead of partitions) when installing 18.04 from scratch.
â Chai T. Rex
May 27 at 22:47
Ok thanks, I correct the answer
â dadexix86
May 27 at 22:48
1
I assume the behaviour of swap pretty much stays the same, no matter whether it's backed by a partition or file. You can also have multiple swap files and/or partitions at the same time. Anyway, I don't think more swap would have a negative effect while there's still enough RAM left.
â Byte Commander
May 27 at 22:55
I would assume the same, but until I'll get my hands on it, this is just a wild assumption
â dadexix86
May 27 at 22:56
There swap partitions and there are swap files. Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot). Swap partition are better in case of full disk where the swap file could be created fragmented. ... The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation â Devon van Schoor j
â Devon van Schoor
May 27 at 23:00
4
4
There are swap files now, and they're the default (instead of partitions) when installing 18.04 from scratch.
â Chai T. Rex
May 27 at 22:47
There are swap files now, and they're the default (instead of partitions) when installing 18.04 from scratch.
â Chai T. Rex
May 27 at 22:47
Ok thanks, I correct the answer
â dadexix86
May 27 at 22:48
Ok thanks, I correct the answer
â dadexix86
May 27 at 22:48
1
1
I assume the behaviour of swap pretty much stays the same, no matter whether it's backed by a partition or file. You can also have multiple swap files and/or partitions at the same time. Anyway, I don't think more swap would have a negative effect while there's still enough RAM left.
â Byte Commander
May 27 at 22:55
I assume the behaviour of swap pretty much stays the same, no matter whether it's backed by a partition or file. You can also have multiple swap files and/or partitions at the same time. Anyway, I don't think more swap would have a negative effect while there's still enough RAM left.
â Byte Commander
May 27 at 22:55
I would assume the same, but until I'll get my hands on it, this is just a wild assumption
â dadexix86
May 27 at 22:56
I would assume the same, but until I'll get my hands on it, this is just a wild assumption
â dadexix86
May 27 at 22:56
There swap partitions and there are swap files. Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot). Swap partition are better in case of full disk where the swap file could be created fragmented. ... The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation â Devon van Schoor j
â Devon van Schoor
May 27 at 23:00
There swap partitions and there are swap files. Swap partitions can be used by two or more Linux installations on the same PC (dual boot or triple boot). Swap partition are better in case of full disk where the swap file could be created fragmented. ... The swap files will work as good as the swap partitions if they are created on non-full disks to avoid fragmentation â Devon van Schoor j
â Devon van Schoor
May 27 at 23:00
add a comment |Â
up vote
2
down vote
According to the answer by Gilles
...There used to be a 2GB swap size limit (on most 32-bit platforms), but this has not been the case for years. The limitation was removed at some point in the 2.2 kernel series.
Additionally, he cites man page for mkswap
:
The maximum useful size of a swap area depends on the architecture and the kernel version.
In linux/swap.h library there is MAX_SWAPFILES
entry, so there is limit on the number of swap files on the kernel level, however that apparently isn't definitive area either. According to the linked document:
It should be noted that the six bits for âÂÂtypeâ should allow up to 64 swap areas to exist in a 32 bit architecture instead of the MAX_SWAPFILES restriction of 32
Which I understand has having maximum of up to 64 swap files on the 32-bit architectures. However, I haven't noticed in the document mention what would happen on 64-bit architecture. Also worth noting that in this case, OP's efforts to create swap files failed on 30th entry.
As for swap partitions, there appears to be no limit for that in the kernel, besides previously mentioned constats, but number of any partitions still would be limited by the underlying BIOS and disk layout.
add a comment |Â
up vote
2
down vote
According to the answer by Gilles
...There used to be a 2GB swap size limit (on most 32-bit platforms), but this has not been the case for years. The limitation was removed at some point in the 2.2 kernel series.
Additionally, he cites man page for mkswap
:
The maximum useful size of a swap area depends on the architecture and the kernel version.
In linux/swap.h library there is MAX_SWAPFILES
entry, so there is limit on the number of swap files on the kernel level, however that apparently isn't definitive area either. According to the linked document:
It should be noted that the six bits for âÂÂtypeâ should allow up to 64 swap areas to exist in a 32 bit architecture instead of the MAX_SWAPFILES restriction of 32
Which I understand has having maximum of up to 64 swap files on the 32-bit architectures. However, I haven't noticed in the document mention what would happen on 64-bit architecture. Also worth noting that in this case, OP's efforts to create swap files failed on 30th entry.
As for swap partitions, there appears to be no limit for that in the kernel, besides previously mentioned constats, but number of any partitions still would be limited by the underlying BIOS and disk layout.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
According to the answer by Gilles
...There used to be a 2GB swap size limit (on most 32-bit platforms), but this has not been the case for years. The limitation was removed at some point in the 2.2 kernel series.
Additionally, he cites man page for mkswap
:
The maximum useful size of a swap area depends on the architecture and the kernel version.
In linux/swap.h library there is MAX_SWAPFILES
entry, so there is limit on the number of swap files on the kernel level, however that apparently isn't definitive area either. According to the linked document:
It should be noted that the six bits for âÂÂtypeâ should allow up to 64 swap areas to exist in a 32 bit architecture instead of the MAX_SWAPFILES restriction of 32
Which I understand has having maximum of up to 64 swap files on the 32-bit architectures. However, I haven't noticed in the document mention what would happen on 64-bit architecture. Also worth noting that in this case, OP's efforts to create swap files failed on 30th entry.
As for swap partitions, there appears to be no limit for that in the kernel, besides previously mentioned constats, but number of any partitions still would be limited by the underlying BIOS and disk layout.
According to the answer by Gilles
...There used to be a 2GB swap size limit (on most 32-bit platforms), but this has not been the case for years. The limitation was removed at some point in the 2.2 kernel series.
Additionally, he cites man page for mkswap
:
The maximum useful size of a swap area depends on the architecture and the kernel version.
In linux/swap.h library there is MAX_SWAPFILES
entry, so there is limit on the number of swap files on the kernel level, however that apparently isn't definitive area either. According to the linked document:
It should be noted that the six bits for âÂÂtypeâ should allow up to 64 swap areas to exist in a 32 bit architecture instead of the MAX_SWAPFILES restriction of 32
Which I understand has having maximum of up to 64 swap files on the 32-bit architectures. However, I haven't noticed in the document mention what would happen on 64-bit architecture. Also worth noting that in this case, OP's efforts to create swap files failed on 30th entry.
As for swap partitions, there appears to be no limit for that in the kernel, besides previously mentioned constats, but number of any partitions still would be limited by the underlying BIOS and disk layout.
edited May 27 at 23:24
answered May 27 at 23:18
![](https://i.stack.imgur.com/U1Jy6.jpg?s=32&g=1)
![](https://i.stack.imgur.com/U1Jy6.jpg?s=32&g=1)
Sergiy Kolodyazhnyy
63.9k9127274
63.9k9127274
add a comment |Â
add a comment |Â
up vote
2
down vote
There is not much difference in speed or performance when increasing the swap partition to be arbitrarily large.
There are several factors related to swap that can affect performance such as swappiness
and hard drive type (SDD or HDD).
Swap is fairly slow and increasing swappiness reduces the performance. However it only has an affect if there is not enough RAM. But it is better than not having any swap. My recommendation is to make the swap partition size twice as big as your RAM.
5
that recommendation is outdated. Modern systems with 32 or 64GB RAM won't need 64 or 128GB swap
â phuclv
May 28 at 6:07
3
@LðuVénhPhúc I wouldn't use more than 2GB of swap these days...
â el.pescado
May 28 at 7:19
2gb seems very low ... virtual machines or games could really fill more than 2gb of swap very quickly. I think 4 to 8gb of swap works well with any amount of ram. If you need more than 8gb then you should probably add more ram.
â Germain
May 28 at 13:46
add a comment |Â
up vote
2
down vote
There is not much difference in speed or performance when increasing the swap partition to be arbitrarily large.
There are several factors related to swap that can affect performance such as swappiness
and hard drive type (SDD or HDD).
Swap is fairly slow and increasing swappiness reduces the performance. However it only has an affect if there is not enough RAM. But it is better than not having any swap. My recommendation is to make the swap partition size twice as big as your RAM.
5
that recommendation is outdated. Modern systems with 32 or 64GB RAM won't need 64 or 128GB swap
â phuclv
May 28 at 6:07
3
@LðuVénhPhúc I wouldn't use more than 2GB of swap these days...
â el.pescado
May 28 at 7:19
2gb seems very low ... virtual machines or games could really fill more than 2gb of swap very quickly. I think 4 to 8gb of swap works well with any amount of ram. If you need more than 8gb then you should probably add more ram.
â Germain
May 28 at 13:46
add a comment |Â
up vote
2
down vote
up vote
2
down vote
There is not much difference in speed or performance when increasing the swap partition to be arbitrarily large.
There are several factors related to swap that can affect performance such as swappiness
and hard drive type (SDD or HDD).
Swap is fairly slow and increasing swappiness reduces the performance. However it only has an affect if there is not enough RAM. But it is better than not having any swap. My recommendation is to make the swap partition size twice as big as your RAM.
There is not much difference in speed or performance when increasing the swap partition to be arbitrarily large.
There are several factors related to swap that can affect performance such as swappiness
and hard drive type (SDD or HDD).
Swap is fairly slow and increasing swappiness reduces the performance. However it only has an affect if there is not enough RAM. But it is better than not having any swap. My recommendation is to make the swap partition size twice as big as your RAM.
edited May 28 at 12:37
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
Zanna
47.8k13116226
47.8k13116226
answered May 27 at 23:01
user834668
5
that recommendation is outdated. Modern systems with 32 or 64GB RAM won't need 64 or 128GB swap
â phuclv
May 28 at 6:07
3
@LðuVénhPhúc I wouldn't use more than 2GB of swap these days...
â el.pescado
May 28 at 7:19
2gb seems very low ... virtual machines or games could really fill more than 2gb of swap very quickly. I think 4 to 8gb of swap works well with any amount of ram. If you need more than 8gb then you should probably add more ram.
â Germain
May 28 at 13:46
add a comment |Â
5
that recommendation is outdated. Modern systems with 32 or 64GB RAM won't need 64 or 128GB swap
â phuclv
May 28 at 6:07
3
@LðuVénhPhúc I wouldn't use more than 2GB of swap these days...
â el.pescado
May 28 at 7:19
2gb seems very low ... virtual machines or games could really fill more than 2gb of swap very quickly. I think 4 to 8gb of swap works well with any amount of ram. If you need more than 8gb then you should probably add more ram.
â Germain
May 28 at 13:46
5
5
that recommendation is outdated. Modern systems with 32 or 64GB RAM won't need 64 or 128GB swap
â phuclv
May 28 at 6:07
that recommendation is outdated. Modern systems with 32 or 64GB RAM won't need 64 or 128GB swap
â phuclv
May 28 at 6:07
3
3
@LðuVénhPhúc I wouldn't use more than 2GB of swap these days...
â el.pescado
May 28 at 7:19
@LðuVénhPhúc I wouldn't use more than 2GB of swap these days...
â el.pescado
May 28 at 7:19
2gb seems very low ... virtual machines or games could really fill more than 2gb of swap very quickly. I think 4 to 8gb of swap works well with any amount of ram. If you need more than 8gb then you should probably add more ram.
â Germain
May 28 at 13:46
2gb seems very low ... virtual machines or games could really fill more than 2gb of swap very quickly. I think 4 to 8gb of swap works well with any amount of ram. If you need more than 8gb then you should probably add more ram.
â Germain
May 28 at 13:46
add a comment |Â
up vote
0
down vote
I arrive at the fact that a swap file or swap partition practically have no limit. Also, my 16GB swap file is quite big but the size does not affect the speed.
However what I gather is that what does effect the speed is the system actually making use of that swap space as opposed to the physical hardware.
My solution to that is to make a high swappiness value so that the swap is not overly used as opposed to the faster hardware.
so I did:
sudo -s
nano /etc/sysctl.conf
Added to file:
#vm.swappiness = 50
save
sudo sysctl -p
to refresh (or could have just rebooted)
Adding the line#vm.swappiness = 50
to/etc/sysctl.conf
doesn't have any effect, the leading#
makes this line to be a comment, remove it. You can check swappiness withcat /proc/sys/vm/swappiness
.
â mook765
May 28 at 6:27
But the method I described did work. When I input [cat /proc/sys/vm/swappiness] I get 50 as the output
â Devon van Schoor
May 28 at 12:50
add a comment |Â
up vote
0
down vote
I arrive at the fact that a swap file or swap partition practically have no limit. Also, my 16GB swap file is quite big but the size does not affect the speed.
However what I gather is that what does effect the speed is the system actually making use of that swap space as opposed to the physical hardware.
My solution to that is to make a high swappiness value so that the swap is not overly used as opposed to the faster hardware.
so I did:
sudo -s
nano /etc/sysctl.conf
Added to file:
#vm.swappiness = 50
save
sudo sysctl -p
to refresh (or could have just rebooted)
Adding the line#vm.swappiness = 50
to/etc/sysctl.conf
doesn't have any effect, the leading#
makes this line to be a comment, remove it. You can check swappiness withcat /proc/sys/vm/swappiness
.
â mook765
May 28 at 6:27
But the method I described did work. When I input [cat /proc/sys/vm/swappiness] I get 50 as the output
â Devon van Schoor
May 28 at 12:50
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I arrive at the fact that a swap file or swap partition practically have no limit. Also, my 16GB swap file is quite big but the size does not affect the speed.
However what I gather is that what does effect the speed is the system actually making use of that swap space as opposed to the physical hardware.
My solution to that is to make a high swappiness value so that the swap is not overly used as opposed to the faster hardware.
so I did:
sudo -s
nano /etc/sysctl.conf
Added to file:
#vm.swappiness = 50
save
sudo sysctl -p
to refresh (or could have just rebooted)
I arrive at the fact that a swap file or swap partition practically have no limit. Also, my 16GB swap file is quite big but the size does not affect the speed.
However what I gather is that what does effect the speed is the system actually making use of that swap space as opposed to the physical hardware.
My solution to that is to make a high swappiness value so that the swap is not overly used as opposed to the faster hardware.
so I did:
sudo -s
nano /etc/sysctl.conf
Added to file:
#vm.swappiness = 50
save
sudo sysctl -p
to refresh (or could have just rebooted)
edited May 28 at 8:40
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
Zanna
47.8k13116226
47.8k13116226
answered May 28 at 0:36
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
Devon van Schoor
364
364
Adding the line#vm.swappiness = 50
to/etc/sysctl.conf
doesn't have any effect, the leading#
makes this line to be a comment, remove it. You can check swappiness withcat /proc/sys/vm/swappiness
.
â mook765
May 28 at 6:27
But the method I described did work. When I input [cat /proc/sys/vm/swappiness] I get 50 as the output
â Devon van Schoor
May 28 at 12:50
add a comment |Â
Adding the line#vm.swappiness = 50
to/etc/sysctl.conf
doesn't have any effect, the leading#
makes this line to be a comment, remove it. You can check swappiness withcat /proc/sys/vm/swappiness
.
â mook765
May 28 at 6:27
But the method I described did work. When I input [cat /proc/sys/vm/swappiness] I get 50 as the output
â Devon van Schoor
May 28 at 12:50
Adding the line
#vm.swappiness = 50
to /etc/sysctl.conf
doesn't have any effect, the leading #
makes this line to be a comment, remove it. You can check swappiness with cat /proc/sys/vm/swappiness
.â mook765
May 28 at 6:27
Adding the line
#vm.swappiness = 50
to /etc/sysctl.conf
doesn't have any effect, the leading #
makes this line to be a comment, remove it. You can check swappiness with cat /proc/sys/vm/swappiness
.â mook765
May 28 at 6:27
But the method I described did work. When I input [cat /proc/sys/vm/swappiness] I get 50 as the output
â Devon van Schoor
May 28 at 12:50
But the method I described did work. When I input [cat /proc/sys/vm/swappiness] I get 50 as the output
â Devon van Schoor
May 28 at 12:50
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1041024%2fis-there-a-maximum-size-at-which-a-swap-file-can-function%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Related: askubuntu.com/q/49109/367990
â Byte Commander
May 27 at 22:52
2
IMO if you are using swap you really need more RAM, not a larger swap file
â Panther
May 27 at 23:35
1
if you're using HDDs then you should use zram instead and lower the priority of the HDD swaps. And such a big swap partition won't help, because by the type you use like 4GB swap your system had been slow to a crawl
â phuclv
May 28 at 6:00
2
Related: askubuntu.com/q/1017021/504066
â PerlDuck
May 28 at 9:49
As far as I recall a swap file will consume some amount of physical RAM (I think less than 1% of the size of the swap file). So having an excessively large swap file could hurt performance due to that memory consumption. But for a reasonably sized swap file, that's not going to be a problem.
â kasperd
May 28 at 12:09