LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   swap space (https://www.linuxquestions.org/questions/slackware-14/swap-space-596391/)

warun 11-01-2007 12:32 PM

swap space
 
hi,
Is there any hard n fast rule that the swap space should be twice the RAM capacity???

Thanks in advance

Dinithion 11-01-2007 12:42 PM

No! That was way back when you had a few MB of RAM. If you have 1GB or 2, your swapspace will probably not be used, but it is nice to have anyways. 512MB would be more then enough, and if you're short on space, 256 would probably work just fine. Personally I have used linux for a while without swap at all, and I diddn't have any trubble. Now I have 512MB and that seems to be a normal choice.

Nemesiz 11-01-2007 01:26 PM

Like Windows use more then double virtual memory. If you have 256 mb of RAM then virtual memory is set to use between 768-1536 mb of HDD space.

H_TeXMeX_H 11-01-2007 01:56 PM

2 x RAM is the MAXIMUM recommended swap space. You usually don't need so much unless you edit large images or movies, in which case you might need it.

Dinithion 11-01-2007 02:00 PM

I know that was the traditional logic, but I can't see why I should waste 4GB of my harddrive to "unused" swap?

Lufbery 11-01-2007 02:30 PM

Hi all,

I've wondered about this too. From the monitors I use, it seems that rarely is more than 90% of my RAM used, and my swap partition has never been used.

This is on a Pentium III-800 with 384 MB of RAM running Slackware 11. Granted, I haven't yet edited 70 MB TIFF images, or encoded a DVD-worth of data -- both activities that might use my swap partition. But last night I compiled Scribus, which took almost two hours and used nearly 100% of my processor, and ran Firefox, Pan, Seamonkey, and Emacs at the same time. Things slowed down a little bit, but my swap partition stayed unused.

Is Slackware simply that efficient?

Regards,

-Drew

H_TeXMeX_H 11-01-2007 02:43 PM

Typically my swap is not used. But, it is used actively when I open or edit large images or movies ... it doesn't happen too often, but it does happen.

Nemesiz 11-01-2007 04:49 PM

If you have enough RAM you can leave swap small.

Like mine:

Mem: 2075008k total, 2016316k used, 58692k free, 82696k buffers
Swap: 0k total, 0k used, 0k free, 1296012k cached

WTF?! Swap zero ? Oh yes now i remember. HAL has destroyed my /etc/fstab few days ago and all this time i was without swap :)

Mem: 2075008k total, 1652772k used, 422236k free, 57884k buffers
Swap: 2008104k total, 32880k used, 1975224k free, 1276620k cached

Oh, now its fine.

Alien Bob 11-01-2007 06:07 PM

HAL does not destroy your fstab file, it does not write to it at all.

Eric

Nemesiz 11-03-2007 12:34 PM

Quote:

Originally Posted by Alien Bob (Post 2945037)
HAL does not destroy your fstab file, it does not write to it at all.

Eric

Well thats happened after i pluged external HDD and my all /etc/fstab was modificated. HAL was running then. External HDD had etx3 and vfat partitions

duryodhan 11-04-2007 07:42 AM

HAL shouldn't be able to even touch your fstab, even if by some weirdness it wants to screw with it imho,...
Quote:

bash-3.1$ ll /etc/fstab
-rw-r--r-- 1 root root 1.2K 2007-10-27 14:28 /etc/fstab


To the op, swap space is generally not needed if you have >1GB ram (even in 512MB , but ymmv).

BUT, 2.6.23 kernel supports suspend to disk (Hibernate in windows speak) and so it would be nice if you keep >500MB space as swap so that you can use that feature painlessly.

Alien Bob 11-04-2007 09:15 AM

Quote:

Originally Posted by Nemesiz (Post 2946990)
Well thats happened after i pluged external HDD and my all /etc/fstab was modificated. HAL was running then. External HDD had etx3 and vfat partitions

If that happened, you have installed some 3rd party software afterwards, because the standard software in Slackware 12.0 does not mess with your fstab file if you plug in a piece of hardware.

Eric

BCarey 11-04-2007 11:11 AM

My laptop uses quite a bit of swap space. I have 512M memory and 1G of swap. Currently, according to free, it is using 504M of memory (of which 250 is buffers and cache) and 291M of swap. I tune swapiness to 15. I _do_ tend to have a lot of programs running at any given time. Top memory contenders are openoffice and firefox, both of which I usually have open all the time, then X+kwin, then thunderbird and the 4 terminals I have open. And I currently don't have any large image files open, but it would not be unusual. I also very rarely re-boot the machine since I use sleep and hibernation.

I plan to get more memory for this machine (although it is not usually sluggish), but even so I think I'll want swap space.

Another reason to consider swap space is if you plan to use hibernation to swap. I don't know what the calculation is for that.

Brian

Anyway,

globaltree 11-04-2007 01:35 PM

swap seldom needed with lots of physical ram
 
If you have lots of physical RAM already then why even use swap? That's 4 GB of good storage you can still use.

I only have 256MB of ram in my mac mini, and so I created a 512MB swap partition (of which it hasn't used over the first 128MB yet). But if I had 2 GB physical storage, I wouldn't bother with the swap.

I'm not sure about this, but it seems like using swap partition can create an imperceptible greater wear-and-tear on drive, as well as greater energy consumption, as the heads have to do more work moving to and fro from the swap partition, and I think head movement is the slowest and noisiest part of a drive's operation.

I guess my question to those more advanced concerning this would be: could using a swap partition actually lower the lifespan of a drive?

If so, then I think the logic is that it is worth the extra wear-and-tear on the drive, and the shortened lifespan,and the increased little whirring sounds, to use swap, in low physical memory situations, since it delivers a performance boost. But in high physical memory situations, it might not be worth the trade. Of course, in high physical memory situations, the swap is seldom used, so this wear-and-tear is not occurring. I think it just depends on how memory intensive your tasks are: if you are rasterizing a hundred images at once, maybe it could still boost performance, but otherwise what your are really sacrificing is just an unused portion of your drive, as you correctly surmised.

Nemesiz 11-04-2007 02:01 PM

Quote:

Originally Posted by Alien Bob (Post 2947798)
If that happened, you have installed some 3rd party software afterwards, because the standard software in Slackware 12.0 does not mess with your fstab file if you plug in a piece of hardware.

Eric


Maybe. But i have installed only opera who are not in Slackware 12.0. Everything else are installed from CD.

p.s. i still thinking that HAL is responsible for /etc/fstab and btw i`m allways using root account for X and others programs. So i just made chattr +iu /etc/fstab


All times are GMT -5. The time now is 09:57 AM.