You are not logged in.

#1 2009-12-03 15:55:43

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Do We Really Still Need Swap Space?

I have noticed that since I have used Linux since 2003, I have never ever utilized Swap partitions. Maybe I am dead wrong and I have not realized I was but whenever I view system resources, I never see anything utilzing all my system RAM to the point I need to dump data into Swap. Is this an force of habit back from when 16MB's of RAM was available? Now that most people can pick up 4 + GB's on a laptop or low end PC, do we still need to create useless partitions for Swap? Perhaps I am being ignorant in thinking most modern (2001+) systems don't need to use Swap but I myself just have never seen Swap being utilized or found a need to create this partition.


./

Offline

#2 2009-12-03 16:10:34

Nagian
Member
From: Altach, Austria
Registered: 2009-08-03
Posts: 70

Re: Do We Really Still Need Swap Space?

Yeah, if you have enough RAM you don't need a Swap-Partition. Or should i say better seldom, if i remember correct, things like suspend needs the swap-partition.

Offline

#3 2009-12-03 16:19:31

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: Do We Really Still Need Swap Space?

With a modern system, you shouldn't need a swap partition.  I use mine for suspend-to-disk, but this thread has motivated me to try suspend-to-file.  Other than hibernation, I've never seen my swap used, with my 4GB of ram.

Offline

#4 2009-12-03 17:01:01

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: Do We Really Still Need Swap Space?

Is it possible to do a fresh installation of Arch or most common Linux distros for that matter and omit Swap from the partitioning schema?


./

Offline

#5 2009-12-03 17:09:41

whiteychs
Member
From: USA
Registered: 2009-02-13
Posts: 39

Re: Do We Really Still Need Swap Space?

Carlwill wrote:

Is it possible to do a fresh installation of Arch or most common Linux distros for that matter and omit Swap from the partitioning schema?

Yes, I haven't encountered a distro that required a swap partition.  They will usually set one up if you use default partitioning though.

Offline

#6 2009-12-03 17:12:56

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: Do We Really Still Need Swap Space?

OK so I guess Linux doesn't require a Swap partition. Thanks!


./

Offline

#7 2009-12-03 17:15:29

ozar
Member
From: USA
Registered: 2005-02-18
Posts: 1,686

Re: Do We Really Still Need Swap Space?

I have about 50 times more hard drive space than I need for my setup so I always make a swap partition just in case it should be needed by the system at some point.  That said, the partition never actually gets utilized.  HD space is cheap and I have an abundance of it so I routinely go ahead and create the swap partition.


oz

Offline

#8 2009-12-03 17:19:48

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: Do We Really Still Need Swap Space?

I understand but when you have 3+ drives and need to make RAID partitions, you try to make everything as equal as possible and swap really becomes an annoyance at that point, especially for something I have never see utilised since my Linux days...


./

Offline

#9 2009-12-03 17:35:53

VirtualRider
Member
Registered: 2008-08-20
Posts: 134

Re: Do We Really Still Need Swap Space?

What would happen if there is no swap and all physical ram is used? Shouldn't the effect be the same (write to disk)?
My system is nearly unusable if i'm running out of ram and swap becomes involved.

Offline

#10 2009-12-03 18:08:11

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: Do We Really Still Need Swap Space?

VirtualRider: If there is no swap and all physical ram is used, the linux OOM killer will begin to kill processes until there is enough free memory.  This is why swap is a good idea on systems with less memory.  If swapping is a performance problem for you, you can try to adjust vm.swappiness in /etc/sysctl.conf (0-100, lower value means less swappy, whatever that means).

Offline

#11 2009-12-03 18:14:37

VirtualRider
Member
Registered: 2008-08-20
Posts: 134

Re: Do We Really Still Need Swap Space?

It's not really a problem (6gb ram here), but can happen while i'm coding. I guess the processes to kill are choosen more or less randomly? Killing the process that's using the most ram would be good in that situation, otherwise not that good.

Offline

#12 2009-12-03 18:28:52

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: Do We Really Still Need Swap Space?

Not randomly; they're prioritised by memory use first, then a few other factors like niceness, time running, and privilege.

Offline

#13 2009-12-03 18:33:26

VirtualRider
Member
Registered: 2008-08-20
Posts: 134

Re: Do We Really Still Need Swap Space?

Sounds like there is a good chance that the right process will be killed and nothing else. Maybe i won't create a swap partition next time, thank you.

Offline

#14 2009-12-05 00:20:48

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Do We Really Still Need Swap Space?

I always leave some swap. I have had large servers become unusable without swap. The swap _barely_ gets used. Usually you will see a few K in it, but without that, things tend to behave a bit oddly in my experience.

There was some mysql thread about it somewhere I ran across once too. *shrug*


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#15 2009-12-05 00:23:06

Mardoct
Member
Registered: 2009-08-17
Posts: 208

Re: Do We Really Still Need Swap Space?

ozar wrote:

I have about 50 times more hard drive space than I need for my setup so I always make a swap partition just in case it should be needed by the system at some point.  That said, the partition never actually gets utilized.  HD space is cheap and I have an abundance of it so I routinely go ahead and create the swap partition.

What he said.


The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.

Offline

#16 2009-12-05 01:03:24

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

Re: Do We Really Still Need Swap Space?

I agree with ozar. I always use a swap partition and normally make it the same size as my ram capacity. Force of habit. I don't use suspend to ram. I once had to add swap to a machine as the oracle dbms complained about it when I was trying to install it. I created a swap file and used that to suplement my swap partition. It worked fine, though I still use a swap partition on new systems even with the kernel's support for swap files.

Offline

#17 2009-12-05 01:38:39

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: Do We Really Still Need Swap Space?

I observed considerable amount of swap usage during:

1. Virtualization.
2. Using firefox + playing music + burning software all at the same time.
3. Openoffice.

I always keep 2gigs swap space and I also use suspend to disk. So, swap is very important to me.


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#18 2009-12-05 01:58:53

guzz46
Member
From: New Zealand
Registered: 2009-06-18
Posts: 190

Re: Do We Really Still Need Swap Space?

If you have never seen any swap used in years of use then i would say you could probably get rid of it, I left swap support out of my custom kernel with no ill effects, suspend to ram still works fine

Offline

#19 2009-12-05 02:46:07

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: Do We Really Still Need Swap Space?

Have 2GB of RAM and if I ever had a problem without having one, I haven't known about it.  Figure I can just create a swapfile later if it ever comes up.


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#20 2009-12-05 03:16:00

z.s.tar.gz
Member
From: Rural Florida
Registered: 2008-12-12
Posts: 298

Re: Do We Really Still Need Swap Space?

I've been going without swap for quite a while now, and I don't see any bad effects, so I guess it's ok!


I need to find a way out so everyone can find their way out.
Resregietd Lunix Uesr: 485581

Offline

#21 2009-12-05 03:16:28

dhave
Arch Linux f@h Team Member
From: Outside the matrix.
Registered: 2005-05-15
Posts: 1,112

Re: Do We Really Still Need Swap Space?

Virtualization has already been mentioned as a good reason to keep a swap partition. My swap space is never used except when I'm running Windows 7 under VMware. I wanted to give a good bit of RAM to Win7. When I'm in Win7 under VMware, Arch starts hitting the swap space. Then, when I close the virtual machine, Arch goes back to using only RAM. That's exactly what I want to happen.


Donate to Arch!

Tired? There's a nap for that. --anonymous

Offline

#22 2009-12-05 10:00:23

shock
Member
Registered: 2009-12-05
Posts: 25

Re: Do We Really Still Need Swap Space?

I'm new to concept of swap space and partition. Why there is swap partition in linux ?

Offline

#23 2009-12-05 11:25:48

Cotton
Member
From: Cornwall, UK
Registered: 2004-09-17
Posts: 568

Re: Do We Really Still Need Swap Space?

If you're never using swap then you're probably using you PC like many Windows users do, ie maybe 3 or 4 apps open at a time, and a browser with a few tabs open.  Swap enables you to do some serious multitasking, eg 20 apps, Firefox with 60+ tabs, Virtualisation, web server, databases etc.
I'd recommend disabling disk based swap and using  compcache, an app which sets up 1/4 of your RAM (by default) as compressed swap. Orders of magnitude faster than disk.

Offline

#24 2009-12-06 15:39:26

Doc Angelo
Member
From: Germany
Registered: 2007-11-28
Posts: 52

Re: Do We Really Still Need Swap Space?

Wow, never heard of compcache - i've got to try it on my freerunner phone (128 MB). On my desktop machine, i have 4 GB RAM installed and i just found out, that my swap space is failing to initialize at boot - no problems so far. But having 2 GB as backup is better, i think.

Offline

#25 2009-12-06 17:52:03

Meskarune
Member
From: Helsinki, Finland
Registered: 2009-03-21
Posts: 361
Website

Re: Do We Really Still Need Swap Space?

is it ok to share swap between linux installs? Right now I have sepperate swap for each install, but if one where careful about booting into the right installation after hybernating, would it be ok, or would there be problems?


Homepage  | Arch Linux Women | Arch Linux Classroom
Acer Aspire E5-575G-53VG:
Intel Dual-Core i5-6200U 2.3 GHz; Skylake rev3 | 8GB DDR4 ram | Intel HD Graphics 520 + NVIDIA GeForce 940MX
Qualcomm Atheros QCA9377 802.11ac | Realtek RTL8111/8168/8411 Gigabit Ethernet Controller

Offline

Board footer

Powered by FluxBB