OpenBSD Journal

Building OpenBSD with limited disk resources

Contributed by sean on from the make world on ancient hardware then go on vacation dept.

An Anonymous Coward points out the following:
Arrigo Triulzi has done a brief writeup of getting OpenBSD built from source while using only one, shared source checkout via read only NFS mount. This was useful for his scenario, which had a machine with limited disk, and helped him to conserve disk space overall. It should be helpful to anyone who manages multiple machines and wants to conserve on disk space while building from source, for example to test a patch or updates. You can find his writeup on his website, "Building OpenBSD "make world" with /usr/src read-only".

This is a handy trick to use with older machines where big disks are either prohibitively expensive or hard to find. This may actually be faster and with some old machines (like the SS5 in the article) where network access to cheap IDE disks may be faster than the ancient SCSI disks in use. For those of us too lazy to try the above and have extra chasis room, these (for non-SCA machines) are helpful.

(Comments are closed)


Comments
  1. By Peter Dembinski (217.96.175.71) pdembinski@konin.lm.pl on http://www.pdembinski.konin.lm.pl

    I discovered that /usr/src should be mounted on the slice with 4096 or 8192 block size -- this is better suited to the average size of file there.

  2. By RC (4.8.16.53) on

    Sorry to say it, but this story is very lame, so very, very lame.

    It's in the docs on OpenBSD.org... When /usr/src is read-only, you 'cd' into your writable directory (your remote NFS mount) and basically just run "lndir /usr/src/". Then you can make the source just like you would normally.

    Very simple.

    Comments
    1. By Peter Dembinski (217.96.175.71) pdembinski@konin.lm.pl on http://www.peter.dembinski.prv.pl

      Yup, lndir is the option. Personally, I mount /usr/src read-only and run make obj.

    2. By Arrigo (212.152.8.176) on

      What a nice friendly poster...

      Just to add to your friendly comment if you just do an lndir /usr/src you had better have a writable NFS-mounted /usr/obj for the "make obj" step or do you like leaving documentation half-baked?

      Also, you might not have noticed but the comment regarding the use of lndir is in the section on building X11 where you don't have the "make obj" option.

      Mounting /usr/src read-only and then having a separate writable /usr/obj sound like a pretty reasonable thing to do and it works flawlessly if your server and client happen to be the same architecture since you inherit the former's symlinks, otherwise it breaks in the architecture-specific bits.

      It never hurts to document what breaks and a quick fix.

      Also, from an efficiency point of view may I point out that your lndir mechanism introduces another level of indirection which over NFS is something you pay for. Allow me to explain:

      NFS mounts:

      server:/usr/src -> client:/usr/real_src
      server:/scratch1 -> client:/usr/src
      server:/scratch2 -> client:/usr/obj

      These are three independent NFS mounts, your lndir will populate /scratch1 with symlinks to /usr/src and then "make obj" will populate /scratch1 with symlinks to /scratch2 (server-side names).

      When you actually run the make for each file-access in client:/usr/src you will have an indirection, via the symlink, to client:/usr/real_src before you get to the real file. This is quite expensive as NFS is not that fast over a 10Mbit/s link.

      With my "oh-so-lame" method you leave out one layer of indirection as you only have two NFS mounts.

      Of course I am sure you had thought of this in your complete and detailed response on using lndir.

      Comments
      1. By mirabile (213.196.254.173) on http://MirBSD.org/

        You can always have BSDOBJDIR point to someplace else.
        I've done an NFS build with the NFS server being an i386
        and the client and build machine being a sparc. And it
        even worked without since the symlinks go to /usr/obj.

        Comments
        1. By Arrigo (212.152.8.176) on

          Interesting, how so? Because I tried the same but the sparc was unable to place the symlink for the sparc-specific stuff from /usr/src (read-only) to /usr/obj. Am I missing something here?

          Comments
          1. By Peter Dembinski (217.98.20.195) pdembinski@konin.lm.pl on http://www.peter.dembinski.prv.pl

            I was wrong of course: make obj won't work on read-only /usr/src.
            Sorry if anyone got confused.

  3. By Jim (69.182.45.193) on

    I have a slow Ultra1 at home and a "fast" Ultra10 at work. What I'd like to do is to build OpenBSD for the Ultra1 on the Ultra10. Perhaps it would go something like this:
    - a "make build" on the Ultra10
    - tar up /usr/obj and burn it to a CD to bring home
    - untar it on my Ultra1 and just run "make install" so it doesn't rebuild everything.

    I realize the above sequence will not work, an obvious reason being that /usr/src/Makefile doesn't have an "install" target. However, is something similar to this possible? If so, can someone give me a basic idea about how to do it?

    Comments
    1. By Martin Reindl (62.178.75.222) martin@ on

      Check out the release(8) manpage.

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]