LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-21-2013, 06:26 AM   #1
nameprabhat
LQ Newbie
 
Registered: Jan 2013
Posts: 4

Rep: Reputation: Disabled
what if there is no swap partition


Please let me know, can a server boot without having any swap partition?

Regards, Prabhat
 
Old 05-21-2013, 06:28 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
Sure, as long as there's enough RAM.
 
Old 05-21-2013, 06:44 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Booting without swap is never (o.k., rarely) an issue. Start using memory and, welllll .... who knows.
 
Old 05-21-2013, 07:04 AM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
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
 
Old 05-21-2013, 07:51 AM   #5
ozar
Member
 
Registered: May 2004
Location: USA
Distribution: Arch Linux
Posts: 415

Rep: Reputation: 82
Quote:
what if there is no swap partition
Hello

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.
 
Old 05-21-2013, 11:04 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,916

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by nameprabhat View Post
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.
 
Old 05-22-2013, 04:29 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
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.
 
Old 05-22-2013, 05:00 PM   #8
Nbiser
Member
 
Registered: Oct 2012
Location: Maryland
Distribution: Fedora, Slackware, Debian, Ubuntu, Knoppix, Helix,
Posts: 302
Blog Entries: 7

Rep: Reputation: 44
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.
 
Old 05-22-2013, 05:02 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
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.
 
Old 05-22-2013, 07:28 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Yeah, the dreaded OOM-Killer would have kicked in
 
Old 05-22-2013, 08:25 PM   #11
Armann
Member
 
Registered: May 2013
Location: Iceland
Distribution: RHEL/CentOS
Posts: 32

Rep: Reputation: Disabled
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...
 
Old 05-22-2013, 08:28 PM   #12
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by Armann View Post
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 08:36 PM.
 
Old 05-22-2013, 10:08 PM   #13
mike_rhce
Member
 
Registered: Jun 2011
Posts: 164

Rep: Reputation: Disabled
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.
 
Old 05-23-2013, 08:51 AM   #14
Armann
Member
 
Registered: May 2013
Location: Iceland
Distribution: RHEL/CentOS
Posts: 32

Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
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 ?
 
Old 05-23-2013, 09:02 AM   #15
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by Armann View Post
Cool didn't know that, where do you set "swappiness" to 0 in CentOS ?
For more details on swappiness, check link provided in post#4
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
swap file vs. swap partition verndog Ubuntu 16 07-09-2012 09:49 PM
swap file or swap partition? What is better? zemir Linux - Newbie 28 08-19-2011 10:15 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 03:16 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 11:46 AM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 09:45 AM


All times are GMT -5. The time now is 12:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration