NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: BSD disklabel partition letters in NetBSD



So, in a degenerate example, put 2 partitions on a disk that each represent
an entire root filesystem TO THE OS THAT IS BOOTED.

This is exactly the degenerate example I wanted to refer to. Let's consider
a BSD disklabel in the first sector of a hard disk (so, without MBR) with
the following partitions defined:

a: /, root partition of system A
b: unused
c: unused (in some cases, it represents the whole disk)
d: unused

In those cases where c is not the whole disk, then d would be.

e: /homeA, home partition of system A
f: swap partition of system A
g: /, root partition of system B
h: /homeB, home partition of system B
i: swap partition of system B

Let both system A and B be NetBSD, for example 8.0 e 7.1, so we are sure
that they are both fully-compatible with the BSD disklabel layout.

I've never tinkered with moving swap out of 'b' -- but imagine it could be
done, reliably.

I'm not sure why you would need two DIFFERENT swap partitions as only one
would be in use (based on which OS was booted).  But, let someone else
argue that point.

You can specify which NetBSD partition to boot at the boot prompt.  Or,
build a "menu" that provides a simpler interface to this.

fstab(5) in each root partition (/etc being part of that, in this example)
would call out 'e' or 'h' as the partition to be mounted on /home in that
particular root file system.  The "other" home partition could then be
mounted somewhere else (assuming the filesystem type is supported by the
kernels built for A/B.

E.g., fstab(5) for A's system would contain (assuming an sd(4) device):
   /dev/sd0a	/		ffs	...
   /dev/sd0f	none		swap	...
   /dev/sd0e	/home		ffs	...
   /dev/sd0h	/otherhome	ffs	...
   /dev/sd0g	/otherroot	ffs	...
while B's would be:
   /dev/sd0g	/		ffs	...
   /dev/sd0i	none		swap	...
   /dev/sd0h	/home		ffs	...
   /dev/sd0e	/otherhome	ffs	...
   /dev/sd0a	/otherroot	ffs	...

Now, boot system A from partition `a'. First: is it possible to do so? Then,
how would partitions `g', `h' and `i' be detected? In other words, what
would the output of `disklabel wd0' be from system A?

The disklabel is the same for each (there's only one, in this case).  I am
assuming that these are non-overlapping regions of the medium.  I.e., the
physical sectors used by A's root partition differ from those used by B's.

So, set up those partitions (size+offset) as befitting your needs.  Then,
just elect which to boot (boot prompt) and where to mount the others (fstab).

Ideally, at least partitions `g' and `h' should be mounted, fully readable
and writeable. But as regards mountpoints, there is some confusion, given
that partition `g' should be mounted in the same place as the already
mounted partition `a'. Or does this only depend on how fstab(5) has been set
up?

The disklabel just cuts the medium into "pieces" (avoiding the term "slices").
It doesn't know where those will be mounted -- if at all!  fstab(5)'s role is
to specify these mount points (assuming you don't deliberately do something
"outside" the normal approach -- like running a special script to mount stuff)

Then, boot system B from partition `g'. Same questions as above.


Home | Main Index | Thread Index | Old Index