Re: How do I determine appropriate swapspace settings? And other partitioning questions.

From: Grant Diffey (nevyn-luv_at_artificial-stupidity.net)
Date: 02/26/05


Date: Sat, 26 Feb 2005 20:40:08 +1100

Morningdew wrote:

> Hello!
>
> I was just curious to know... What are some good rules of thumb for
> configuring swap space under Linux? For that matter, are there any
> comprehensive guides or articles on the subject? When I used to admin
> NT boxes I used to set their "virtual memory" setting to 1.5 times
> physical memory, giving 50% over physical as swap. That was just by
> convention, or, "rule of thumb". No great scientific methodology, it is
> just what had worked for me and my coworkers for so long. Granted,
> Linux is different.
>
Yep. the fundamental difference is that NT uses a traditional VM design
(linux briefly had a traditional vm in the 2.4 series) based around keeping
what's currently in memory also in swap so that when you need more memory
you can instantly zap those clean pages and get more memory because they've
aready been written to disk in idle time. the upshot of this is that you
MUST have at least as much swap as you have physical memory.

Linux 2.4.0 -> 2.4.11 had a vm of this style. (Rick's vm) andrea's vm which
replaced rick's in the 2.4 stable series works like the linux vm has
historically worked that is to say pages are only kept in memory and disk
is used as an overflow only. 2.6 continues with andrea's vm.

> On my box I have installed Ubuntu and moved up to the 2.6.10 kernel, if
> that matters. I am presently running on two IDE hard drives, 30Mb
> Quantum Fireball and 60Mb Seagate ST360020A. As it stands, I have 1Gb
> of physical RAM and have two swap partitions, one on each drive and both
> 494.16Mb. Initially I had set up a 32-bit install on one drive, and a
> 64-bit (AMD64) on the other. I decided to go with my old NT convention
> for grins, and give 50% over physical for swap. But since I have both
> swap partitions available, I have both the 32 and 64 bit installs using
> both swaps, for a nearly 1:1 phys:swap ratio.
>

That's HEAPS for linux see above.
 
> Reason I am asking is because I will be very soon installing a 250Gb
> Western Digital SATA drive. Long story on the old one, but short
> version is it shot craps before I could ever use it. But now since I
> will be getting all this breathing room I will of course be
> reconfiguring my partitioning scheme. So given the opportunity I would
> like to put some method to the madness.
>

> One consideration, besides size, is location. This question goes beyond
> swap space, too. How does Linux like to have it's partitions metered
> across multiple drives? Should the root and swap be on different
> physical drives or does it matter? If it is better to separate, which
> would benefit most from "the faster drive"? Does it actually help to
> split the swap amongst partitions on differing drives, similar to (yes,
> remotely similar to) how striping speeds up RAID performance?
>
you could create a software raid of two small partitions and swap on that.
as the disk access is going to be way more expensive than the raiding.

> While I am asking, I would also be interested in suggestions with regard
> to partitions and placements. I have been running 5Gb roots that include
> my /var and /home. Most of my "media", including music, video, photos,
> and the like I have been keeping on a separate partition that I mount
> under /mnt/share. This way I have access to it from whichever root I
> boot to, as well as making it publicly readable to my family's logins.
> Not much needs to be kept private, and, well, I manage that when need be.
>
We have that in our house too. we have a 200GB XFS volume called /bigish
which will soon be expanded with another disk to 400GB yay for LVM

> I think it would be unwise for me to make the /home directories be the
> same between the two installs (32 and 64-bit). But I am intruiged to
> know how far such a notion could be taken. Being able to have
> Thunderbird and my GPG keys available no matter which I boot to would be
> rather convenient. I could spend more time in 64-bit land. Right now I
> must use the 32-bit install for that.
>
if the distro is the same (ubuntu) there is no reason not to share /home
just make sure that /etc/passwd /etc/shadow /etc/groups and /etc/gshadow are
synced between the systems and you should be all good.
 
> Lastly, since I don't want to tap you all toooo much all at once, I am
> curious about this whole "chroot" thing. Since I have both 32 and
> 64-bit installs, is there a way to make my 32-bit root BE the chroot
> under 64-bit? That would totally rock! I have zero experience with this
> and am only sort-of understanding how it all works. I would like to,
> for instance, just run 64-bit firefox and have it use 32-bit
> libflashplayer.so. That, of course, being one of the very few things
> keeping me on the 32-bit side 90% of the time when I would much rather
> go 64-bit as much as possible. But I have heard that you can't have a
> 64-bit app call a 32-bit library. Okay. So then 32-bit FF. But then
> that also means all the dependencies for FF and for FlashPlayer, right?
> Well, then, at what point DO the 64 and 32-bit parts commingle? Would
> 32-bit FF run on the 64-bit X session? That, I could see. Or is it
> some "xnest" type set-up? If it dose run on the display, would it talk
> to 64-bit Gnome? What kind of crazy nightmare am I getting myself into
> with this chroot thingy? Am I better off sitting in a corner, beating my
> head against the wall? Maybe I should stop wasting my time on this and
> use it more (!) effectively, writing pleas to Macromedia to get off
> their corporate duffs and spend the, what, hour or two it would (should:
> can't know with closed-source) take to do the damned port.
>
A chroot won't do what you want. User Mode Linux might tho but it'd be
reasonably complicated.

regards Grant.

-- 
All software sucks all hardware sucks.


Relevant Pages