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.
If you can ever imagine yourself needing to occupy more than your 2GB of RAM while you're running your computer, AND if you can imagine that any of that being on a hard drive would be a Good Thing (TM), then by all means use double that: 2GB. In the end, it doesn't matter whether you set it to 2GB or some other value, because you'd hate the operation of your machine so much when it started paging that you'd either buy more memory or a faster machine.
The "double the amount of memory" rule of thumb came about when 64K was the normal size of a machine, and gigabytes of memory wasn't even a geeks wet dream. If you think about it, these days the amount of memory in a machine is no longer budget driven, but convenience driven. IOW, whatever it's convenient for the manufacturer to put in, that's what you get.
If you monitor your memory usage, and if you aren't doing a lot of video editing or something like that, you'll probably never see usage go above 500MB. Heck, you may never even cross 300MB. Given that, the amount of swap space is irrelevant. A number of people run without any swap space at all. Me, I don't give it any thought unless I'm installing on a really old hard drive without any room to spare. Normally I just accept whatever the OS wants, because hard drives are so big today that throwing a few GB away really doesn't matter. But, if I really cared, I'd choose 0.
If you monitor your memory usage, and if you aren't doing a lot of video editing or something like that, you'll probably never see usage go above 500MB. Heck, you may never even cross 300MB. Given that, the amount of swap space is irrelevant. A number of people run without any swap space at all. Me, I don't give it any thought unless I'm installing on a really old hard drive without any room to spare. Normally I just accept whatever the OS wants, because hard drives are so big today that throwing a few GB away really doesn't matter. But, if I really cared, I'd choose 0.
thanx guys....
i have much space and memory..
but this doesn't imply that i should waste it unnecesarily
i asked dis question as i was a bit confused...
that was a good suggestion..
i have also used a low configuration machine for past 7 years(2001-2007)
it was a P-2 machine with 10Gb HDD and 64MB RAM
I undrstand the value of computer resources,
in those days i used win98 and rehat
My Linux Box runs with a 1GB swap partition and I have had no problems with it. Although my box only has 512MB of RAM. So I would say 1-2x your amount of RAM will work.
Granted, you could run without any swap drive if you really wanted to but I wouldn't advise it. I take the better safe than sorry approach. Just throw 'swap' a gig or two, it might save you someday when you might do some video editing.
My Linux Box runs with a 1GB swap partition and I have had no problems with it. Although my box only has 512MB of RAM. So I would say 1-2x your amount of RAM will work.
Granted, you could run without any swap drive if you really wanted to but I wouldn't advise it. I take the better safe than sorry approach. Just throw 'swap' a gig or two, it might save you someday when you might do some video editing.
yah
i guess i may allot 768Mb of HDD for my swap partition
I think using zero swap space on an ordinary Linux system is a bad idea.
Most people who discuss this swap space issue in this and many similar threads don't seem to understand that an OS constantly decides between ram and disk for a lot of different types of content only a fraction of which would go in swap space if it were available (the rest are various things that boil down to mapped files).
There will be some content with virtually zero access rate that can go only in swap or ram. There will be other content with higher access rate that is mapped to files, so when it is bumped from ram it is not written to swap. If you don't have enough swap space to write out the inactive content, that will force Linux to bump more active content and will make your system slower.
How much inactive content there is that ought to be in the swap area depends on what sort of applications you're running. Typically, it would be much higher on a server than on a workstation, but that could go very much the other way depending on how you use your workstation. Maybe all that inactive stuff adds up to such a small fraction of 2GB that you'd barely notice the improvement from having a small swap space vs. zero and that a big swap space would be almost entirely unused. I don't know how to tell other than trying with enough swap space that it never all gets used.
There are also complex issues of throughput vs. responsiveness. Ordinary Linux can prioritize CPU use well but can't really prioritize memory use or disk I/O, so large operations and/or background operations tend to get more memory than the end user would like, which makes them only a little faster while making it much slower to switch back to some program you left paused. Some people use an intentional lack of swap space to detune the throughput of the system in favor of faster return to paused programs. Generally there are better ways to achieve that tuning than starving the system of swap space.
The various old rules, such as 1.5 or 2 time ram never made any sense. With ordinary workstations having large amounts of ram, they make even less sense.
If you're not running anything unusual on a 2GB Linux with 80GB hard drive, and you're not planning to nearly fill that drive with data. I suggest using a 500MB swap partition and on rare occasion check to see if it is being used. If a small fraction of it is in use, perfect. If a large fraction is in use, something should be corrected.
If you plan to use enough of your 80GB drive for programs or data that you'd miss .5GB "wasted" on a barely used swap partition, get rid of the drive and buy a real one.
Edit: I wrote all this before seeing your post immediately above. 768MB is a fine choice.
Also, I see "video editing" mentioned in this thread, but not by you. For some "video editing" tools there will be things that work when the total ram+swap is at least 3.5GB and break for reasons an ordinary user wouldn't understand when there is less (in such cases the program wouldn't actually be using the full 3GB even if it were there). It isn't very common, but if you were the one who had mentioned "video editing" I would have said why risk such problems vs "wasting" a full 1.5GB on swap. For web browsing and most other home computer uses, there is no similar issue and it is very unlikely that 500MB would be too little swap space.
Here is a link to what is the definitive argument on swap. I say argument, because it's an argument between kernel developers about the setting of the swappiness variable which directly impacts swapping. I haven't read it in a long time, but I don't remember any strong arguments against zero swap space.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.