Previous | Next | Table of Contents

Setting up the filesystem, Diskless NetBSD HOW-TO

The procedure outlined here is independent of the server's operating system. These are files to extract or modify on the nfs server:

  1. # cd /export/client/root

  2. If you're not running NetBSD or OpenBSD on your nfs server, then you may want to check to see if you have GNU tar, version 1.12 or later installed (some distributions of Linux ship with an older GNU tar that doesn't support the necessary features):

    # tar --version
    tar (GNU tar) 1.12

    If not, you need to get GNU tar, as it provides the option to preserve uid and gid properly. If you proceed in untarring the distribution sets, they will have ownerships set incorrectly, which will cause problems.

    If you use the GNU tar on non-Net/OpenBSD, use the [--numeric-owner] option.

  3. Extract essential distribution sets:
    tar [--numeric-owner] -xvpzf /export/client/NetBSD-release/binary/sets/base.tgz
    tar [--numeric-owner] -xvpzf /export/client/NetBSD-release/binary/sets/etc.tgz

  4. Extract any additional distribution sets using the same procedure

  5. # mkdir /export/client/root/kern

  6. Set up swap:
    # mkdir /export/client/root/swap
    dd if=/dev/zero of=/export/client/swap bs=4k count=4k

    This creates a 16 MB swap file. If your operating system doesn't have a /dev/zero (HP-UX doesn't), then you can download this 16 MB swap file (16 KB gzipped).

    SunOS, use the following command to create a 16 MB swap file:
    # mkfile 16m /export/client/swap

  7. Set up /etc/ifconfig.le0, where le0 is the NetBSD device name for your ethernet card. Create a file called /export/client/root/etc/ifconfig.le0, which has the following line:
    inet client netmask 255.255.255.0 broadcast 192.168.1.255
    replacing 255.255.255.0 with the netmask your network administrator wants you to use, and replacing 192.168.1.255 with the broadcast address your network administrator specifies.

  8. Set up /etc/fstab. Create a file called /export/client/root/etc/fstab, which has the following lines:
    #/etc/fstab
    nfsserver:/export/client/swap   none  swap  sw,nfsmntpt=/swap
    nfsserver:/export/client/root   /     nfs   rw 0 0
    nfsserver:/export/client/usr    /usr  nfs   rw 0 0
    nfsserver:/export/client/home   /home nfs   rw 0 0

  9. Edit /etc/rc.conf. Open in your editor /export/client/root/etc/rc.conf. Some important things to set up are (replace 192.168.1.1 with the router your network administrator specifies):
    hostname="client"
    defaultroute="192.168.1.1"
    nfs_client=YES
    auto_ifconfig=NO
    net_interfaces=""

    You should not have rc reconfigure your network device since it will lose its connection to the NFS server with your root filesystem.

  10. Add your machines to /etc/hosts. Add the following lines to /export/client/root/etc/hosts:
    #/etc/hosts
    192.168.1.10 client.test.net client
    192.168.1.5  nfsserver.test.net nfsserver

  11. mv /export/client/root/usr/* /export/client/usr/

Some space-saving techniques

Lazaro Daniel Salem has sent in some suggestions on creating a pseudo-clustered environment (wherein all clients and the server share almost all configuration files). This will only work if your client(s) and server are running on the same NetBSD port (merely running on the same architecture (i.e. microprocessor) will not suffice).

If you are curious, read his suggestions.

It's time to boot up your diskless machine!

  1. Here is an example of what the diskless boot messages on a NetBSD/hp300 machine look like.
    If your screen goes black or appears to hang, make sure that NetBSD supports a local console on your particular machine, you may need to hook up a serial terminal.

    If your serial terminal doesn't show anything (or your machine doesn't even have serial ports), then you need to read additional directions on setting up remote access without any console

  2. Your client will boot into single-user mode, giving you this prompt:
    Enter pathname of shell or RETURN for sh:
    Hit return.

  3. It'll ask you your terminal type.
    On a NetBSD/hp300 machine, the local console, is hp300h, and for serial console, you should probably use vt100

  4. # mount /usr

  5. Create the /dev files.
    # cd /dev
    # /bin/sh MAKEDEV all

    This takes a while (at least two minutes), be patient.

    Note, this won't work using the HP-UX 9 or earlier NFS server, since it doesn't allow client creation of device files. You'll have to download this tarball of device files (5 KB) for NetBSD/hp300 and run, on the nfs server:
    # cd /export/client/root
    # tar [--numeric-owner] -xpvzf dev.tar.gz

  6. Check to make sure swap will work:
    # swapctl -A
    swapctl: adding nfsserver:/export/client/swap as swap device at priority 0
    # swapctl -l
    Device      512-blocks     Used    Avail Capacity  Priority
    /dev/??          32768        0    32768     0%    0

  7. Continue to multi-user mode. Edit /etc/rc.conf either on the nfs server (in /export/client/root/etc/rc.conf) or on the client, and change the line to read:
    rc_configured=YES

  8. Exit out of the single-user shell, by typing exit.

  9. Log in as root and have fun using your new NetBSD diskless workstation!

Now, you should continue on and finish up the diskless procedure by making sure your server(s) start all of the necessary daemons the next time they reboot.


Previous | Next | Table of Contents
NetBSD Home Page
NetBSD Documentation top level

(Contact us) $NetBSD: files.html,v 1.3 2007/08/01 15:36:01 kano Exp $
Copyright © 1998-2004 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.