Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
Please let me know, can a server boot without having any swap partition?
Regards, Prabhat
The easiest way to find out would be for you to build a Linux system without a swap partition, and see what happens. This sounds very much like a homework question, so doing/learning on your own would be best.
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.
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."
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...
Unless you set swappiness to 0 or don't have a swap partition.
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.
Last edited by suicidaleggroll; 05-22-2013 at 07:36 PM.
Unless you set swappiness to 0 or don't have a swap partition.
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.
Cool didn't know that, where do you set "swappiness" to 0 in CentOS ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.