LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   install Linux without swap partition? (https://www.linuxquestions.org/questions/linux-software-2/install-linux-without-swap-partition-284340/)

leduytien 01-31-2005 01:26 AM

install Linux without swap partition?
 
Hi,

I installed Fedora Core 3 without a swap partition and were warned by the installer that this will affect the perfomance of most installation. Is that true? (after installing, I feel my screen updated a little bit slower - but don't know whether it's my imagination or ...)

Can anyone explain what this "swap partition" do? do it act like the swap memory used by Windows?

foo_bar_foo 01-31-2005 01:49 AM

yes it's swap memory
it will get used very little if you have alot of ram
but you won't have to wonder if it's affecting performance
when it becomes needed and it's not there your gui will lock up and freeze solid and will not recover

whansard 01-31-2005 01:50 AM

Re: install Linux without swap partition?
 
Quote:

Originally posted by leduytien
Hi,


Can anyone explain what this "swap partition" do? do it act like the swap memory used by Windows?

that's it. it's about the same thing. if you have more than 200 megs of ram, you won't run into many situations where swap would help much.

KimVette 01-31-2005 01:49 PM

Re: Re: install Linux without swap partition?
 
Quote:

Originally posted by whansard
that's it. it's about the same thing. if you have more than 200 megs of ram, you won't run into many situations where swap would help much.
. . . aside from applications terminating without notice. ;)

Plan to run a window manager with effects? Plan on doing any multitasking? Do you browse using a tabbed browser? Do you do any image editing in The Gimp? If the answer to any of those questions is "yes" then you definitely want swap space, and it should be a minimum of somewhere between 1.5x and 2.5x the amount of installed RAM. I run a gig of RAM on my workstations and when multitasking my machines use swap space. Granted, I often work with high-resolution images intended for print, but it still drives the point home that swap is very necessary.

If you don't want to dedicate a partition to swap, you can get by using a file on your / partition, but it may impact performance slightly.

whansard 01-31-2005 03:43 PM

there's a bunch of threads on this site with arguments about whether you need swap or not. using the above argument would make you believe that having 32 megs of ram with 100 megs swap is more stable than 512 megs of ram with no swap. running out of ram for applications is not worse than running out of ram+swap for applications.

reddazz 01-31-2005 03:49 PM

If you have a lot of ram, usually more than 512 megs or 1gb you can get away without needing a swap space, but in doesn't hurt to configure your system to use, especially if you play games or do stuff thats graphic intensive. There have been a few articles on the net recently rgarding this issue about swap space, so you may want to do a google search to find out other peoples opinions.

wapcaplet 01-31-2005 05:44 PM

It all comes down to the fact that hard disk space is much cheaper than RAM (well, cheaper in dollars, a lot more expensive in wasted time :) ). You probably won't notice if 1GB is unavailable from your 160GB hard disk, and it could save you from crashes if you ever do manage to use up the RAM.

I've heard the 1.5x to 2.5x figure for swap-to-RAM for many years. I think it definitely applied in the days when most computers had 16MB or 32MB, with 64MB being a rare luxury. The apps of the day demanded more memory than that, especially when multitasking.

RAM has caught up, but apps aren't using a proportionally larger amount of if. Even running your heavyweight WM, a browser, some terminals, and OpenOffice all at once is not likely to require 1GB of RAM, let alone the 512MB + 1.5x swap that used to be a recommended minimum. Editing very large graphics might be an exception, but anyone needing such large graphics is likely to have their workstations equipped accordingly. Even then, you'd need to be dealing with in excess of 6,000x5,000-pixel truecolor images to even break 100MB.

The only other applications I can think of that might demand so much RAM would be multitrack audio editing and 3D modelling.

In short: Give a GB for swap. It can't hurt. But you probably don't need more than that.

Tinkster 01-31-2005 06:04 PM

And if ALL else fails one can still create a swap FILE
rather than a partition (with a fair performance penalty,
one might add) ...

Code:

dd if=/dev/zero of=test.swp bs=1024 count=512000
mkswp test.swp
swapon -v test.swp

will give you a 512MB swap file ...


Cheers,
Tink

bulliver 01-31-2005 06:31 PM

Just to put in my 2 cents...

Two of my computers have nice sized RAM for their purpose.
The Xless web/mail server:
Code:

[16:03][root@vyvyan exim]# free -m
            total      used      free    shared    buffers    cached
Mem:          759        743        15          0        142        416
-/+ buffers/cache:      184        574
Swap:        2598          0      2598

This is with 57 days of uptime, mind you.

The Dual headed X workstation, which gets multitasked a lot (ie: full screen DVD with mplayer and fullscreen pinball :)):
Code:

[16:10][bulliver@virgo bulliver]$ free -m
            total      used      free    shared    buffers    cached
Mem:          1520        856        664          0        172        446
-/+ buffers/cache:      236      1283
Swap:          486          0          486

After about 6 months in this configuration (4 for the server) both computers have _never_ touched the swap. I guess my point (much like wapcaplet's) is that the higher the physical RAM, the slower the swap curve should rise. Having 3GB of swap on the workstation would be silly, as would having anything higher than 1GB on the server. Personally I wouldn't put anything more than 500MB on any computer, nor have I ever seen close to 500MB of swap used on any system I have used. The rule of thumb "swap = 2 x RAM" needs to change now that people are starting to run large amounts of physical RAM.

Those that actually read the output of free may notice a contradiction here: The reason why I have such a ridiculous amount of swap on the server, it's because I have an old quantum fireball that has served me well for many years. I didn't have the heart to retire it...so it will spend the rest of its days as a dedicated swap HDD on my server :)

Tinkster 01-31-2005 06:57 PM

I didn't give that thing its name, and I didn't create
the swap-sapce, but have a look at this anyway ;)

Code:


[tink@woody ricand]$ free
            total      used      free    shared    buffers    cached
Mem:      8203228    8164892      38336          0    106220    6985532
-/+ buffers/cache:    1073140    7130088
Swap:    16578752    133304  16445448

8GB RAM and it STILL decided to swap 130MB out ...



Cheers,
Tink

jiml8 01-31-2005 07:32 PM

Quote:

that's it. it's about the same thing. if you have more than 200 megs of ram, you won't run into many situations where swap would help much.
I have 1 Gig of RAM on my system. In the ordinary course of events, the system has ALL the 1 Gig in use, and typically between 100 and 400 Megs of swap in use as well. At this time, 999 Megs of RAM are in use (out of 1010 Megs available) and 375 Megs of swap (out of 1 Gig available).

Now, I must confess that in addition to Mandrake 10 with KDE, sendmail, mySQL, and Apache running I also have VMWare with two different Windows installations running as well. Works out pretty handy; I am doing some web integration development and I have an entire network running in this one box.

bornhj 01-31-2005 08:07 PM

The whole RAM x 1.5 = swap thing doesn't work, because that means someone with one GB of ram would have a total of 2.5GB memory to use, while someone with 128MB RAM would have 320MB of memory to use. The way I always do my swap (in Windows and Linux) is 1.5GB - RAM = swap. This means I get a consistent 1.5GB, which is more than I ever need - I don't run many intensive programs/services under Fedora or Gentoo.

dsschanze 01-31-2005 08:17 PM

When I installed redhat 9 on my webserver, I gave 500megs of swap space. I think if you are going to remote GUI to it you definitely should go back and re-partition. On the other hand, if you are not using it for high performance computing as in a lab or a server, you probably can get away without it.

Tinkster 01-31-2005 08:47 PM

Quote:

Originally posted by bornhj
The whole RAM x 1.5 = swap thing doesn't work, because that means someone with one GB of ram would have a total of 2.5GB memory to use, while someone with 128MB RAM would have 320MB of memory to use. The way I always do my swap (in Windows and Linux) is 1.5GB - RAM = swap. This means I get a consistent 1.5GB, which is more than I ever need - I don't run many intensive programs/services under Fedora or Gentoo.
Your method would leave our Oracle box
with -6.5GB swap space ;}

So what you meant when you say
Quote:

The whole RAM x 1.5 = swap thing doesn't work,
is that this is not the way you do it :)

I wouldn't recommend your private formula to others,
though, but rather try and assess their needs.


Cheers,
Tink

foo_bar_foo 02-01-2005 12:11 AM

Quote:

Originally posted by whansard
there's a bunch of threads on this site with arguments about whether you need swap or not. using the above argument would make you believe that having 32 megs of ram with 100 megs swap is more stable than 512 megs of ram with no swap. running out of ram for applications is not worse than running out of ram+swap for applications.
This is nonsence -- the kernel for the most part throws out pages rather than swap them out. Duplications of things on the hard drive are never swapped out but rather exist on the hard drive already and are just reread. But certain types of unique generated application data is put in the swap que as soon as it is created even if it never gets swapped out. The swap is vital as a place for this data to be kept if needed and has very little to do with the hardware ram and it's paging tables, which are 4 gigs wide even if you have less ram than that. So even though the above example is absurd on the surface it's also just wrong in assuming ram and swap are related. One application (or DOS attack) that goes out of controll and gets caught in a mem allocation loop or something and all your application specific data survives in swap and your system recovers. Without swap your system crashes and all your data and important transaction or whatever is gone forever. It may of course be possible for all swap to be used up but not very likely or even possible for the same lost data results given the fact that even if an application tries to fill up swap it will have to use up ram first and in the process all vital data will be saved in swap before the app begins to use the rest of the swap and therefore only the offending process will crash and not the system.


All times are GMT -5. The time now is 05:46 PM.