what if there is no swap partition
Please let me know, can a server boot without having any swap partition?
Regards, Prabhat |
Sure, as long as there's enough RAM.
|
Booting without swap is never (o.k., rarely) an issue. Start using memory and, welllll .... who knows.
|
In simple words server will boot, but it also depends that what kind of server it is and whether you'll need swap space or not. Swap space temporarily holds memory pages that are inactive. Swap space is used when your system decides that it needs physical memory for active processes and there is insufficient unused physical memory available.
For more details, here: https://help.ubuntu.com/community/SwapFaq |
Quote:
I've not used a swap partition in the last 8 or 9 years on my desktop machines (lots of RAM), but if I were running a server that would become very busy after it boots, I'd want to use one. It would be better to have it an not need it than it would be to need it and not have it. |
Quote:
|
Ser Olmy points out basically the correct answer. Yes, it can boot if other conditions are true. To simply boot, one would have to have some minimum ram amount available. That amount would vary greatly depending on how the distro is made and the kernel and services and boot options and even hardware and bios settings.
In many cases you can easily add in a swap partition or "swap file" with very little effect. One can use multiple swap partitions and multiple swap files. Even swap raid can be used and one can set priority on how sway is selected. Some odd programs will use swap if available even if you have enough ram. If in doubt, a modern distro can have a swap area added just to be safe. As noted above, many people don't use swap anymore. |
You shouldn't need a swap partition as long as there is enough RAM in your system. The purpose of the RAM in the first place is to store currently running programs and processes: the purpose of swap is to store some of these programs and processes if your RAM overflows. As long as you have plenty of RAM you shouldn't need SWAP, in other words.
|
Swap is only needed if you run out of RAM. If you never run out of RAM, then you never need swap space. It's nice to have something there "just in case" though, you never know when an innocent process might run away with your RAM due to some oversight.
Just the other day I ran a "diff -r" on two directories on a remote server. They were big directories, so I left it and started working on something else. A couple of hours later I came back and found the machine responding VERY slowly. I ran "top", and saw that my diff was using all 24 GB of RAM on the machine, and the OS had pushed nearly every other process into the swap. I immediately killed the diff and over the course of 1-2 minutes the system pulled what it needed back out of swap and the system started running normally again. Without a swap partition, things probably would have ended very differently. |
Yeah, the dreaded OOM-Killer would have kicked in ;)
|
I'm currently reading Michael Jang's RHCSA/RHCE sixth edition.
Quote from the book. "Linux moves infrequently used programs and data to swap space even if you have gigabytes of RAM." Just thought I would throw that one in... ;) |
Quote:
Nobody said that the swap is never used if you have available RAM, we're saying that not having a swap won't cause a problem if you have available RAM, which is what the OP asked. |
Incidentally, it is possible to set up a swap file on Linux, e.g. http://www.cyberciti.biz/faq/linux-a...ap-file-howto/ . Of course, you can also set up a swap volume.
If you don't have any swap space (swap partition, volume, or file), Linux simply is not able to move infrequently used programs to that area. |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 03:53 PM. |