Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on...
Note: An (*) indicates there is no official participation from that distribution here at LQ. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
01-03-2005, 01:21 AM
|
#1
|
Member
Registered: Nov 2004
Location: Colorado
Distribution: Ubuntu mostly...
Posts: 100
Rep:
|
ubuntu - increase swap size
i installed ubuntu. when i go to "system monitor" it says this when
i click the tab for "resource monitor" at the bottom:
==================================================
used memory: 91.0 mb of 504 mb
used swap: 0 bytes of 486 mb
name: directory: type: total: used:
/dev/hda1 / ext3 72.9 gb 1.6 gb
tmpfs /dev/shm tmpfs 252mb 0 bytes
==================================================
my question is this, shouldn't my swap be 2x ram? other distro's i
have installed made a 1004 mb space for swap. i have 512 mb ram.
i let the ubuntu installer do the partitioning. should i not worry about it?
if it is not right, can i change it once the OS is installed? is there a
command for it?
thx...
|
|
|
01-03-2005, 01:23 AM
|
#2
|
Member
Registered: Nov 2004
Location: Colorado
Distribution: Ubuntu mostly...
Posts: 100
Original Poster
Rep:
|
my post
my post didn't format the way i wanted it to. try and read it anyway.
|
|
|
01-03-2005, 06:06 AM
|
#3
|
Member
Registered: Jul 2004
Location: LT
Posts: 150
Rep:
|
I think you dont need a gig of swap with 512mb ram(ofcourse it depends on what your doing with your box). i have 256megs of ram and swap usage is max ~400mb and opera browser uses most part of it.
AFAIK the 2xRAM formula is from the old days when computers had little ram.
you shouldnt worry unless you are running out of swap. you either can resize your current swap partition, create another one or create a swap-file.
|
|
|
01-04-2005, 06:31 AM
|
#4
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
A recent suggestion was:
If you have 512MB or more RAM, SWAP should be 1/2 size of RAM
Less than 512, should be 2x size of RAM.
An example:
You have 512MB RAM, your swap should be somewhere around 256MB.
If you had 256MB RAM, then your SWAP should be somewhere around 512MB.
Cool
|
|
|
01-04-2005, 03:09 PM
|
#5
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
as the other post said, you probably dont need all that memory.
however to answer the question, here is a good way to add swap without having to resize your partitons.
Code:
# edit count= to be the amount of extra swap you want
dd if=/dev/zero of=/SWAP.img bs=1M count=128
losetup /dev/loop7 /SWAP.img
mkswap /dev/loop7
swapon /dev/loop7
then add the losetup and swapon lines to your rc.local boot scripts.
the proper way to increace your swap size however, would be to use qtparted on a live-cd like Knoppix to reduce your root partiton, and increace your swap partiton.
[/code]
Last edited by qwijibow; 01-04-2005 at 03:10 PM.
|
|
|
01-23-2005, 08:53 AM
|
#6
|
LQ Newbie
Registered: Jan 2005
Distribution: Ubuntu and Yoper
Posts: 6
Rep:
|
If you've got the hard drive space to spare, then actually what several Linux experts have told me (this is assuming you're a power user, graphic designer, developer, or just heavy user) that the best formua is 3x your computer's RAM, up to 1 GB. If you've got >1GB of RAM, then it's just 1x. Seems a bit outrageous, but it's worked quite well, and yes I have gotten periods where I've used that much swap.
|
|
|
01-23-2005, 10:09 AM
|
#7
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
[/quote]formua is 3x your computer's RAM, up to 1 GB. If you've got >1GB of RAM, then it's just 1x.[/quote]
seems a bit of a crap formula.. no insult intended, but hat would mean a user with just under a gigabyte of ram would end up with 4Gig total memory, and a user with just over a gig ram would end up with 2gigs ram.
double the amount of total memory for the sake of 5 megs ram !
im no expert, but here is would i would recomend...
take the maximum amount of ram you will ever need... (for many of you, this might be the recomended about of ram on the unreal tournament / doom CD)
Multiply by 2 (to be on the safe side.) then subtract the amount of ram physical ram you have... and their you have your Swap...
to be more accutate, you might want to factor in how "swappy" your kernel is.
set swappyness with
echo "number_between_0_and_100" > /proc/sys/vm/swappiness
make you machine more swappy for machines with little ram, less swappy for machines with large amounts of ram.
Last edited by qwijibow; 01-23-2005 at 10:12 AM.
|
|
|
01-23-2005, 11:58 AM
|
#8
|
LQ Newbie
Registered: Jan 2005
Distribution: Ubuntu and Yoper
Posts: 6
Rep:
|
Quote:
no insult intended, but hat would mean a user with just under a gigabyte of ram would end up with 4Gig total memory, and a user with just over a gig ram would end up with 3gigs ram.
|
Try re-reading the guideline I gave. For under a gig (obviously with some discretion) the rule is to multiply by three. For over a gig, make your swap EQUAL to the size of your RAM.
Obviously, these are only guidelines, not a strict mathematical formula. If someone has 256 MB of ram, having a swap of 768 MB wil help considrably. If you have 512 MB of ram, maybe you ought to only go with a 1 GB swap instead. Howver, I still don't see where you're getting figures of 4gb and 3 gb from.
The old "twice the amount of ram minus the amount of physical memory" rule is from the earlier days of linux, when machines weren't coming with 1 GB of memory or very ram-intenstive applications, particularly given the influx of eye candy in the Linux Desktop, as part of the path to bringing the average home user away from Windows.
Really, it all comes down to personal choice. I use a gig of swap, and have occasionally come close to using all of it. Howver, I frequentlu do hit half the swap size, so I like to have the room to spare. Storage is cheap, I can afford sparing a gig for stabiliy and speed. What another user's situations is will affect the size of their swap.
|
|
|
01-23-2005, 12:04 PM
|
#9
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
Quote:
Try re-reading the guideline I gave. For under a gig (obviously with some discretion) the rule is to multiply by three. For over a gig, make your swap EQUAL to the size of your RAM.
|
so for systems with 0.95 Gig of ram, you would add almost 3 gigs of swap.
total almost 4 gigs of memory.
for systems with 1.05Gugs of ram, you would add just ofver a gig swap...
total 2 gigs of memory.
like i say, for the state of an insignificant amount of ram, you are doubleing the total memory, trippleing the swap.
maybe you should re-read my post before telling me to re read yours.
anyways, im just saying genral rules just down work,
i have 512 megs of ram, with swappyness set to 60, and my swap is never touched, even when compiling multiple large programs (like KDE) and authoring a DVD. to playing Ut2004 / Doom.
|
|
|
01-23-2005, 12:11 PM
|
#10
|
LQ Newbie
Registered: Jan 2005
Distribution: Ubuntu and Yoper
Posts: 6
Rep:
|
I meant no offense, but as I said, it's all personal preference. But let's be realistic here. What normal user would have 0.95 GB of ram, or 1.05 gb of ram? The average user would have 128, 512, 768, or 1024. That's what I was aiming at.
Clearly we use Linux differently, which leads to our different swap usage. What works for me maynot work for others. But that's Linux and FOSS in general is about, isn't it? The choice to use what works best for you!
|
|
|
01-23-2005, 03:27 PM
|
#11
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
i know, neither did i. im just arguing that i dont believe swap should simply be a multiple of your physical ram.
|
|
|
01-24-2005, 12:45 PM
|
#12
|
Member
Registered: May 2004
Location: USA
Distribution: #1 PCLinuxOS -- for laughs -> Ubuntu, Suse, Mepis
Posts: 315
Rep:
|
Here is a formula ..
1. carefully count the numbers of angles dancing on the head a pin. (use a CAT scanner if you can)
2. multiply that by your birthdate (not the year .. actual days from the year BC 2355 + add the lost days of the julian calendar)
3 Take a factorial of it
4 divide it by 42
5 and use it as a seed of random number generator to give you an idea what the swap space should be ..
This 5 step formula is what the gurus uses .. cuz it always give the right answer for "each" individual.
All these formulas are BOGUS .. 2x/3x/4x .. < x, > y ..
Simple formula is WHAT are you doing with your computer ..
If you are doing:
lot of audio/video compression .. A LOT OF SWAP "may help" ..
A lot of programming .. may be ..(i guess in this case you won't be asking such questions on a forum)
Only websurfing .. almost none
a bit this a bit that ... a little bit would do ..
typically servers use good deal of swap.
You can always mount additional fs for swap .. .. so start with any amount you can .. 200-300 meg .. and if you see things
failing, memory meter pegging .. create another swap partition and add that in fstab and you will be happy forever.
|
|
|
All times are GMT -5. The time now is 04:57 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|