*BSD News Article 12424


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!manuel.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!wupost!uunet!amdahl!amdcad!BitBlocks.com!bvs
From: bvs@BitBlocks.com (Bakul Shah)
Subject: Re: Disklabel help needed
Message-ID: <C3J9FL.4vJ@BitBlocks.com>
Organization: Bit Blocks, Inc.
References: <C3A9MB.9rE@ccu.umanitoba.ca> <1993Mar3.035202.11777@unet.net.com> <1993Mar5.020610.29203@tfs.com> <C3Gp2w.7D4@sugar.neosoft.com>
Date: Sun, 7 Mar 1993 19:14:08 GMT
Lines: 57


julian@tfs.com (Julian Elischer) writes:
> NO NO NO NO!
> NEVER put the swap as teh first partition on the disk
> if it decides to swap to the first blocks it'll overwrite the disklabel
> and bootblocks

Well... you can do this but you have to arrage partitions right
in the master boot record (MBR) + do some other kludgery (see
below).

peter@NeoSoft.com (Peter da Silva) writes:
> OK, folks, THIS is something that *needs* to be fixed, and that *can* be
> easily fixed at the application level... I hope. Are there any dependencies
> in the boot that require any particular partition start at any particular
> track? System V allocates a separate partition just for stuff like this,
> and I think 386BSD should as well. Discussion?

This can't be fixed at the application level but I wouldn't worry
about it.  Generally you don't want to put swap before root.  At
any rate, an easy fix would be for the swap code in the kernel to
skip first few blocks -- something like 20 or so.  That is better
than the hacks I helped make for this one very stubborn friend
of mine!

-- Bakul Shah <bvs@BitBlocks.com>

If you swap starts at offset S and your root at offset R, one of
your MBR partition must start at S and another at R.  Then you
make the partition starting at R active but not the one at S.
Since some of the utilities (such as disklabel) have some builtin
assumptions about Unix partitions C & D, it is best if you
arrange your A partition to start at R, B partition to start at
S, C to start at S and so on.  Here is an example:

			offset		size
MBR partition 0		    0		10000	(for dos)		
MBR partition 1		10000		30000	(for swap)
MBR partition 2		40000	       100000	(for root & everything else)


Unix partition A	40000	       100000	(for root & everything else)
Unix partition B	10000		30000	(for swap)
Unix partition C	10000	       130000	(root+swap)
Unix partition D	0	       140000	(everything)

I don't remember what lies we had to feed to the primary boot
program but what I show above is the key idea.  You may ask why
would one want to put swap before root?  It is because with this
arrangement on average the disk head travels less than with any
other arrangement.  However, I do recommend *against* this
arrangement.  It is better to have a tiny root partition, then
the swap partition then /usr.  I also symlink some often used
directories and files such that as soon as the /usr partition is
mounted most everything uses /usr.  This way in case of a crash
you recover faster and the probability of the root partition
losing any files is rather small.