24.3. Configuring an Exported File System for Diskless Clients
Prerequisites
- Install the necessary packages. See Chapter 24, Setting up a Remote Diskless System
- Configure the
tftp
service. See Section 24.1, “Configuring a tftp Service for Diskless Clients”. - Configure DHCP. See Section 24.2, “Configuring DHCP for Diskless Clients”.
Procedure
- The root directory of the exported file system (used by diskless clients in the network) is shared via NFS. Configure the NFS service to export the root directory by adding it to
/etc/exports
. For instructions on how to do so, see the Section 8.6.1, “The/etc/exports
Configuration File”. - To accommodate completely diskless clients, the root directory should contain a complete Red Hat Enterprise Linux installation. You can either clone an existing installation or install a new base system:
- To synchronize with a running system, use the
rsync
utility:#
rsync -a -e ssh --exclude='/proc/*' --exclude='/sys/*' \ hostname.com:/exported-root-directory- Replace hostname.com with the hostname of the running system with which to synchronize via
rsync
. - Replace exported-root-directory with the path to the exported file system.
- To install Red Hat Enterprise Linux to the exported location, use the
yum
utility with the--installroot
option:#
yum install @Base kernel dracut-network nfs-utils \ --installroot=exported-root-directory --releasever=/
The file system to be exported still needs to be configured further before it can be used by diskless clients. To do this, perform the following procedure:
Procedure 24.2. Configure File System
- Select the kernel that diskless clients should use (
vmlinuz-kernel-version
) and copy it to thetftp
boot directory:#
cp /boot/vmlinuz-kernel-version /var/lib/tftpboot/
- Create the
initrd
(that is,initramfs-kernel-version.img
) with NFS support:#
dracut --add nfs initramfs-kernel-version.img kernel-version
- Change the initrd's file permissions to 644 using the following command:
#
chmod 644 initramfs-kernel-version.img
Warning
If the initrd's file permissions are not changed, thepxelinux.0
boot loader will fail with a "file not found" error. - Copy the resulting
initramfs-kernel-version.img
into thetftp
boot directory as well. - Edit the default boot configuration to use the
initrd
and kernel in the/var/lib/tftpboot/
directory. This configuration should instruct the diskless client's root to mount the exported file system (/exported/root/directory
) as read-write. Add the following configuration in the/var/lib/tftpboot/pxelinux.cfg/default
file:default rhel7 label rhel7 kernel vmlinuz-kernel-version append initrd=initramfs-kernel-version.img root=nfs:server-ip:/exported/root/directory rw
Replaceserver-ip
with the IP address of the host machine on which thetftp
and DHCP services reside.
The NFS share is now ready for exporting to diskless clients. These clients can boot over the network via PXE.