DISKLESS(8)

NAME
diskless - booting a system over the network

DESCRIPTION
The ability to boot a machine over the network is useful for diskless or dataless machines, or as a temporary measure while repairing or re-installing filesystems on a local disk. This file provides a general description of the interactions between a client and its server when a client is booting over the network.

OPERATION
When booting a system over the network, there are three phases of interaction between client and server:

1.  The stage-1 bootstrap loads a boot program, from
2.  The boot program loads a kernel.
3.  The kernel does NFS mounts for root.

Each of these phases are described in further detail below.

In phase 1, the stage-1 bootstrap code loads a boot program, which is typically able to control the network card. The boot program can be stored in the BIOS, in a BOOT ROM located on the network card (PXE, etherboot, netboot), or come from a disk unit (e.g. etherboot or netboot).

In phase 2, the boot program loads a kernel. Operation in this phase depends on the design of the boot program. Typically, the boot program uses the BOOTP or DHCP protocol to get the client's IP address and other boot information, including but not limited to the IP addresses of the NFS server, router and nameserver, and the name of the kernel to load. Then the kernel is loaded, either directly using NFS (as it is the case for etherboot and netboot), or through an intermediate loader called pxeboot and loaded using TFTP or NFS.

In phase 3, the kernel again uses DHCP or BOOTP to acquire configuration information, and proceeds to mount the root filesystem and start operation. The boot scripts recognize a diskless startup and perform the actions found in /etc/rc.d/initdiskless and /etc/rc.d/diskless.

CONFIGURATION
In order to run a diskless client, you need the following:

•   An NFS server which exports a root and /usr partition with appropriate permissions. The diskless scripts work with readonly partitions, as long as root is exported with -maproot=0 so that some system files can be accessed. As an example, /etc/exports can contain the following lines:

        <ROOT> -ro -maproot=0 -alldirs <list of diskless clients>
        /usr -ro -alldirs <list of diskless clients>

    where <ROOT> is the mountpoint on the server of the root partition. The script /usr/share/examples/diskless/clone_root can be used to create a shared readonly root partition, but in many cases you may decide to export (again as readonly) the root directory used by the server itself.

•   a BOOTP or DHCP server. bootpd(8) can be enabled by uncommenting the bootps line in /etc/inetd.conf. A sample /etc/bootptab can be the following:

         .default:\
            hn:ht=1:vm=rfc1048:\
            :sm=255.255.255.0:\
            :sa=<SERVER>:\
            :gw=<GATEWAY>:\
            :rp="<SERVER>:<ROOT>":
        <CLIENT>:ha=0123456789ab:tc=.default

    where <SERVER>, <GATEWAY> and <ROOT> have the obvious meanings.

•   A properly initialized root partition. The script /usr/share/examples/diskless/clone_root can help in creating it, using the server's root partition as a reference. If you are just starting out you should simply use the server's own root directory, /, and not try to clone it.

    You often do not want to use the same rc.conf or rc.local files for the diskless boot as you do on the server. The diskless boot scripts provide a mechanism through which you can override various files in /etc (as well as other subdirectories of root). The scripts provide four overriding directories situated in /conf/base, /conf/default, /conf/<BROADCAST-IP>, and /conf/<MACHINE-IP>. You should always create /conf/base/etc, which will entirely replace the server's /etc on the diskless machine. You can clone the server's /etc here or you can create a special file which tells the diskless boot scripts to remount the server's /etc onto /conf/base/etc. You do this by creating the file /conf/base/etc/diskless_remount containing the mount point to use as a basis of the diskless machine's /etc. For example, the file might contain:

        10.0.0.1:/etc

    The diskless scripts create memory filesystems to hold the overridden directories. Only a 2MB partition is created by default, which may not be sufficient for your purposes. To override this you can create the file /conf/base/etc/md_size containing the size, in 512 byte sectors, of the memory disk to create for that directory.

    You then typically provide file-by-file overrides in the /conf/default/etc directory. At a minimum you must provides overrides for /etc/fstab, /etc/rc.conf, and /etc/rc.local via /conf/default/etc/fstab, /conf/default/etc/rc.conf, and /conf/default/etc/rc.local.

    Overrides are hierarchical. You can supply network-specific defaults in the /conf/<BROADCAST-IP>/etc directory, where <BROADCAST-IP> represents the broadcast IP address of the diskless system as given to it via BOOTP. The diskless_remount and md_size features work in any of these directories. The configuration feature works on directories other than /etc, you simply create the directory you wish to replace or override in /conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/* and work it in the same way that you work /etc.

    As a minimum, you normally need to have the following in /conf/default/etc/fstab

        <SERVER>:<ROOT> /     nfs    ro 0 0
        <SERVER>:/usr   /usr  nfs    ro 0 0
        proc            /proc procfs rw 0 0

    You also need to create a customized version of /conf/default/etc/rc.conf which should contain the startup options for the diskless client, and /conf/default/etc/rc.local which could be empty but prevents the server's own /etc/rc.local from leaking onto the diskless system.

    In rc.conf, most likely you will not need to set hostname and ifconfig_* because these will be already set by the startup code. Finally, it might be convenient to use a case statement using `hostname` as the switch variable to do machine-specific configuration in case a number of diskless clients share the same configuration files.

•   The kernel for the diskless clients, which will be loaded using NFS or TFTP, should be built with at least the following options:

        options MFS
        options BOOTP
        options BOOTP_NFSROOT
        options BOOTP_COMPAT

    If you use the firewall, remember to default to open or your kernel will not be able to send/receive the bootp packets.

SECURITY ISSUES
Be warned that using unencrypted NFS to mount root and user partitions may expose information such as encryption keys.

FILES
/usr/share/examples/diskless/clone_root
    script to clone root filesystem
/conf/base
    1st override
/conf/default
    2nd override
/conf/<BROADCAST-IP>
    3rd override
/conf/<MACHINE-IP>
    4th override
/conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>
    override for /<DIR>
/conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>/md_size
    size of memory disk for /<DIR>
/conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>/diskless_remount
    path to mount on /<DIR>
/conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>.cpio.gz
    archive to unpack to /<DIR>
/conf/{base,default,<BROADCAST-IP>,<MACHINE-IP>}/<DIR>.remove
    files to remove from /<DIR>

SEE ALSO
bootptab(5), ethers(5), exports(5), rc.conf(5), bootpd(8), dhcpd(8) (net/isc-dhcp42-server), mountd(8), nfsd(8), pxeboot(8), rc(8), reboot(8), tftpd(8)

BUGS
This manpage is probably incomplete.

DragonFly sometimes requires to write onto the root partition, so the startup scripts mount MFS filesystems on some locations (e.g. /etc and /var), while trying to preserve the original content. The process might not handle all cases.