Date: Tue, 2 May 00 23:35:24 +0100 From: fcfbsd <fcfbsd@eircom.net> To: "Peter McGarvey" <Peter.McGarvey@telinco.net> Cc: "FREEBSD-Questions" <freebsd-questions@freebsd.org> Subject: Re: BSD Theology: swap, /var, /tmp and /usr/tmp Message-ID: <E12mlDQ-0008Pr-00@mcclure.tinet.ie>
next in thread | raw e-mail | index | archive | help
I always say more partitions is better as long as you have at least one spare entry - theory - pretty archaic & due to a lot of errors on my part - if they are on seperate partitions i can only damage that partition (that goes for power-outage, bad blocks etc.). I always have a spare partition that I can use to back data out to if necessary. These practices are based on years of stupid behaviour & errors so perhaps it's not a good benchmark. As for swap size i never follow the *2 rule, usually about 20 - 40 Megs. Again I reckon if I'm paging 128Mb of memory the performance is so useless I may as well stop - having said that I don't have any firewire or ultra-scsi disks so the situtation may differ there I really couldn't comment. >On Tue, 2 May 2000, Peter McGarvey wrote: > >> Theological problem this. Facts and Opinions welcome... >> >> Okay, I /think/ I know what I'm doing when I slice-up a disk for a >> FreeBSD system... >> >> / -> 64MB >> swap -> 2 * memory (rounded-up to the nearest MB) >> /usr -> the remaining disk > >That's pretty reasonable. > >> >> Once setup I link /var and /tmp to /usr/var and /usr/temp >> >> This is the way I've always done it, I'm quite happy doing it this way, >> it works for me and I've never had any problems. >> >> Fine, but now some upstart has asked me to set up a FreeBSD system with >> the following.... >> >> / -> 5MB > >You're going to need a bigger root than that--big enough to accomodate >/bin, /sbin, /etc and the other stuff that goes in the root partition. >5 megs isn't even big enough for /bin, I don't think. > >I'd say go with at least 25 megs for /, if not like 64 just to be safe. > >> swap 1 -> 512MB (equal to memory) >> swap 2 -> 512MB >> /var -> 2GB > >If you're going to keep a fair amount of logs, and want it on a separate >partition, that should be ok. Linking it to /usr would also probably >be ok. The reason /var is usually a separate partition (at least on >server boxes) is that you don't want to logs to fill up your other >partitions and cause problems. If you linked /var to /usr/var and it >filled to 100%, I don't think that would mess anything up. It might, but >I can't think of what it would be. > >> /tmp -> 2GB > >Same thing as /var--if you're writing lots of stuff to this partition, you >want to separate it, make it plenty big, or both. If the applications that >will run on the machine in question write lots of huge temp files, or >you want to compile stuff in /tmp, a couple gigs should be about right. >Linking it to /usr/tmp is probably OK. I don't have a BSD box in front of >me at the moment, but by default on some OSes, /tmp is ALWAYS a link to >/usr/tmp or /var/tmp unless you do it differently. > >> /usr -> remaining disk > >And then what, you'd put /home as a link to /usr/home? Should be fine. > >> >> My first instinct is that the guy is barking mad (he is a Linux groupie >> so... (and Linux does have a nasty habit of apropriating every entry in >> the partition table)) >Actually, if you install linux with extended partitions, it's not such a >hog... > > >> >> However I've hit a snag - when it comes to FreeBSD partitions and slices >> I know the HOW (and there is lot's of help on that), but I'm not too >> sure of the WHY (and help here is lacking). >> >> 1. What I need is some rational reasoning why the way I do >> things is right/wrong. >> >> 2. Why the way Linux man wants it is right/wrong. > >I just think a 5 meg / partition is dead wrong. You can't >fit _anything_ on there. > > >> >> 3. Some info on the optimal size of swap > >That depends on your applications. If you use a lot of stuff that eats >swap like cornflakes (ie, INN, maybe squid), then you want plenty of >swap. Nobody can really tell you how big it should be, but the general >rule of thumb has traditionally been 1.5 times the size of RAM. A lot of >people also do twice the size of RAM. For server boxes, I usually do 1 to >1.5, unless it's going to be a news server. For workstations, I usually >use 40 megs, no matter what. Rarely, on such a box, I run out of swap, but >hardly ever. > > >> >> 4. Where's the best place to put /var and /tmp > >For workstations, I use one big / partition. For servers, I put /var on >its own partition, and /tmp as either part of /, or, if I know it's going >to fill up, link it to /usr if possible. > > >> >> Here is what I was told... >> >> On the issue of the 2 swap I was told two swap partitions were needed as >> "we may need to turn one off as too much swap will slow the machine >> down". > >I've never known that to be an issue. Maybe I'm naiive. Usually, I've heard >of people having two swap partitions on separate disks to sort of "stripe" >between them, to improve performance when swapping. > > >> >> Furthermore, I was told the 2*memory rule is no longer valid "once the >> physical memory has exceeded 64MB" Can this true? Have I needlessly >> been waisting mt HDD space by making swap too big? > >Well, one point I'd make is that if you're waiting for 500 megs of >crap to swap in and out, the box is probably going to be nearly unusable. >If stability is more important, you may want to risk it. That is, "sure, >nobody can stand how slow it is, but it's better than crashing". Your call. > > >> >> My thoughts were that swap was used as needed, when needed, and that >> pages are not swapped to disk on a whim just because the swap space >> existed (or perhaps this is how linux works so he's assuming FreeBSD >> does it this way too). > >Been a while since I looked at FreeBSD's swap code, but I'm pretty sure it >uses the typical demand-paging approach--parts of running processes that >haven't been touched in a while get swapped out, and brought back in >when needed. > >> >> As for /var and /tmp why not link them to /usr/var and /usr/tmp. I can >> understand putting them on physically seperate devices. But is it >> strictly necissary to put them in their own slice? Is there a >> performance benefit? or a is there some extra resiliency? >> > >No performance benefit per se, unless you put them on their own _disk_, >which is another thing to consider. > > >> Whilst I'm at it what is the difference between /tmp and /usr/tmp. I've >> always treated them a seperate entities - assuming linking /tmp to >> /usr/tmp was a bad thing. Linux man maligned FreeBSD big time when he >> found there were two temporary directories. I couldn't respond as I >> didn't know - and I refused to descent to his level by insulting his >> prefered OS. >> > >The "multiple temp partitions spread all over hell" situation is largely >historical. Back in the day, a 2MB fixed head disk was pretty studly, and >on your typical PDP box you'd have two or three of them if you were doing >anything particularly serious. They weren't big, but they were pretty >fast, at least for linear writes (no seeking, but the rotational latency >was rather sloggy). So you'd put a couple things that needed performance >more than space on a fixed head disk--logs (ie, /var) and the stuff in >/usr/bin. The left over space was for temp, so you'd have a little in >/var/tmp and a little in /usr/tmp. > >Nowadays, since all disks are big and fast, you don't need to worry so >much. I've set up some systems with /tmp on it's own partition and >/var/tmp and /usr/tmp linked to /tmp. I can't remember what OS that was-- >probably DomainOS. FreeBSD probably isn't picky about where the various >temp dirs are located or linked to, but there may be issues I don't >know about. > > > >> Like I said this is mainly a theological problem. so all Facts and >> Opinions welcome... > >Well, I gave you some of both. I wish I could give you a more definitive >answer. > > >> >> >> -- >> TTFN, FNORD >> >> Peter McGarvey, Unix Administrator >> Network Operations Center, Telinco Limited >> >> >> To Unsubscribe: send mail to majordomo@FreeBSD.org >> with "unsubscribe freebsd-questions" in the body of the message >> > >============================================================= >Jeffrey Dunitz | Network Engineer, >BOFH Emeritus | ENRGi.com >Avalon Networks | --/ > > > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E12mlDQ-0008Pr-00>