OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: 2 Qs on obsd partitions

From: Jonathan Thornburg (jthornaei.mpg.de)
Date: Mon Aug 30 2004 - 08:31:06 CDT


In message <http://monkey.org/openbsd/archive/misc/0408/msg01960.html>,
"patrick ~" <sidsrryahoo.com> asked
> 2. Is there a way to have two openbsd partition (say,
> each with different versions of openbsd: 3.4 and 3.6
> for example) and selectively boot into either one, and
> have them share one single /home partition?

In message <http://monkey.org/openbsd/archive/misc/0408/msg01967.html>,
Ted Unangst <teduzeitbombe.org> replied
# short answer: no.
# long answer: you're in for a world of pain.

I guess I'm going to disagree with Ted here:
        [Ted, if there's a hidden pitfall in the solution
        I'm about to describe, please speak up -- I am genuinely
        curious why you think this is "a world of pain"]

If you know what you're doing, I know of no problems in having multiple
OpenBSD {/,/usr,/var,...} partitions sharing a common /home. I've been
running various OpenBSD systems this way since 2.7 or 2.8 with no problems.

For example, the computer on which I'm typing this message has the
partitions
a root #1
b swap (shared between both OpenBSDs)
c whole disk
d root #2
e usr #1
f usr #2
g unused
h home (shared between both OpenBSDs)

root #1 has OpenBSD 3.5-stable on it, with
% cat /etc/fstab
/dev/wd0a / ffs rw 1 1
swap /tmp mfs rw,nodev,async,-s=2000000 0 0
/dev/wd0e /usr ffs rw,nodev 1 2
swap /usr/tmp mfs rw,nodev,async,-s=2000000 0 0
/dev/wd0h /home ffs rw,nodev 1 2
%

root #2 still has OpenBSD 3.4-stable on it (oops, should upgrade it), with
# cat /mnt/etc/fstab
/dev/wd0d / ffs rw 1 1
swap /tmp mfs rw,nodev,async,-s=2000000 0 0
/dev/wd0f /usr ffs rw,nodev 1 2
swap /usr/tmp mfs rw,nodev,async,-s=2000000 0 0
/dev/wd0h /home ffs rw,nodev 1 2
#
        [In normal operation (system boots from #1 filesystems)
        the #2 filesystems are *NOT* mounted, I just hand-mounted
        root #2 for that command.]

Advantages (+) and disadvantages (-) of this scheme:
+ if the main {/,/usr} filesystem somehow gets so badly corrupted that
  the machine won't boot, I can probably boot from the other {/,/usr}
  and fix things
        [because the #2 filesystems aren't mounted in normal
        use, most scenarios for damaging the main filesystem
        leave the #2 set intact]
+ if something critical doesn't work after a software upgrade, I can
  run it from the other, either by a temporary readonly mount of the
  other filesystems, or by booting there
+ more generally, if I'm unsure whether a software upgrade is going
  to be easy or painful, having a backup {/,/usr} is a nice safety net
  and makes "abort, back out, return to former state" a lot easier
- wastes the disk space of a duplicate {/,/usr}
  (but with today's disk sizes that's a drop in the bucket)
        [My first dual-OS-partitions setup was SunOS 4.1.3
        in 1993. At that time I only had a 670M disk, so
        wasting 150M was painful. On the other hand, I had
        neither a cdrom drive nor a high-speed network connection
        then, so "filesystem corrupted, computer won't boot"
        would have been a MAJOR disaster. The dual-OS-partitions
        setup did indeed save my neck when I once managed to
        accidentally delete /dev/zero (which prevented any
        dynamically-linked programs from running).]
- potential problems with shared-library versioning in binaries living
  under /home (in practice, only an issue for the a.out --> elf transition)
- need to be careful not to wipe out /home when upgrading/reinstalling
  (but this is true with any /home setup)
- need to remember than the #2 OS may be a bit out of date on security
  patches (==> should run a "secure by default" OS, right?)
- disk seeks from / to /usr to /home are probably a tiny teeny bit
  slower because the partitions are farther apart

In practice I think the advantages far outweight the disadvantages, and
I highly recommend this type of setup. My only caveat (which admittedly
might apply to the original poster) is, don't try this unless you know
what you're doing, i.e. unless you're comfortable with 'mount', 'umount',
'installboot', and the various disk-partitioning commands.

ciao,

--
-- "Jonathan Thornburg (remove -animal to reply)" <jthornaei.mpg-zebra.de>
   Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
   Golm, Germany, "Old Europe" http://www.aei.mpg.de/~jthorn/home.html
   "Washing one's hands of the conflict between the powerful and the
    powerless means to side with the powerful, not to be neutral."
                                      -- quote by Freire / poster by Oxfam