Christopher Zimmermann <madroach () zakweb ! de> asked
> is it possible to install two OpenBSDs on the same disk? I'd
> like to try -current in a separate installation.

Yes.  The way I do it is to have a single fdisk partition containing
the entire disk (or more generally, as much of it as I want to use for
all OpenBSD stuff combined), then create two separate sets of OpenBSD
root, var, and usr partitions inside that, sharing /home.  That is,
I have the following 'disklabel' partitions:
  wd0a  root #1         /etc/fstab mounts root #1, var #1, usr #1, home
  wd0b  swap
  wd0c  entire disk
  wd0d  root #2         /etc/fstab mounts root #2, var #2, usr #2, home
  wd0e  var #1
  wd0f  var #2
  wd0g  usr #1
  wd0h  usr #2
  wd0j  home

I use the standard OpenBSD bootloader, so by default the computer boots
system #1.  If I want to boot system #2, I just type "boot wd0d:/bsd" at
the "boot>" prompt.

Note that the system #1 /etc/fstab mounts *only* the system #1 partitions
and home:
% cat /etc/fstab
/dev/wd0a  /            ffs     rw,softdep                              1 1
/dev/wd0b  /tmp         mfs     rw,async,nodev,nosuid,-s=2000000        0 0
/dev/wd0e  /var         ffs     rw,softdep,nodev,nosuid                 1 2
/dev/wd0g  /usr         ffs     rw,softdep,nodev                        1 2
/dev/wd0b  /usr/tmp     mfs     rw,async,nodev,nosuid,-s=2000000        0 0
/dev/wd0j  /home        ffs     rw,softdep,noatime,nodev,nosuid         1 2

Similarly, the system #2 /etc/fstab mounts *only* the system #2 partitions
and home:
# mount -r /dev/wd0d /mnt
# cat /mnt/etc/fstab
/dev/wd0d  /            ffs     rw,softdep                              1 1
/dev/wd0b  /tmp         mfs     rw,async,nodev,nosuid,-s=2000000        0 0
/dev/wd0f  /var         ffs     rw,softdep,nodev,nosuid                 1 2
/dev/wd0h  /usr         ffs     rw,softdep,nodev                        1 2
/dev/wd0b  /usr/tmp     mfs     rw,async,nodev,nosuid,-s=2000000        0 0
/dev/wd0j  /home        ffs     rw,softdep,noatime,nodev,nosuid         1 2
# 

The two OpenBSD installations are entirely separate, and may be as
different as desired.  (For example, the laptop on which I'm typing
this has #1 = 4.6-stable and #2 = 4.4-stable.)


A couple of important notes if you decide to try this:

First, the standard OpenBSD install hard-codes "a" as the root partition.
So... at the "(I)nstall, (U)pgrade or (S)hell?" prompt, type "s" to get
a shell, then 
  # ed install.sub
  $-1                        (go to the 2nd-to-last-line)
  s/a/d/                     (change the 'a' to a 'd')
  w                          (write the memory buffer back to the file)
  q                          (quit the ed editor)
(maybe follow with 'more install.sub' to confirm that all went well)
OpenBSD will how happily install with root on the wd0d partition.

[An alternative is to install what you want to wind up in #2 to the #1
partitions, use dump|restore or tar|tar to copy these to the #2 partitions
(as per FAQ 10.2), run installboot(8) to fixup booting to the #2 partitions,
then reinstall what you really want to #1.]


Finally, and most important of all, *don't* try this unless you know
what you're doing!  Playing around with partitions this way works fine
if you do things correctly, but mistakes can easily scramble your disk
(more accurately, the data on it).  In particular, don't try this until
you grok the FMs disklabel(8), fstab(5), installboot(8).  And have a
full backup *before* you try it...

-- 
-- "Jonathan Thornburg [remove -animal to reply]" 
<jth...@astro.indiana-zebra.edu>
   Dept of Astronomy, Indiana University, Bloomington, Indiana, USA
   "If the triangles made a god, it would have three sides." -- Voltaire

Reply via email to