From Fedora Project Wiki


Boot a root filesystem located on a Network File System (NFS) using dracut.

How to test

Prepare NFS server and a root directory containing the OS version we want to boot.

  1. Install needed packages
    yum install anaconda anaconda-runtime
  2. Prepare a directory for root
     mkdir /mnt/nfs_root
  3. Install the OS under /mnt/nfs_root using anaconda
     anaconda --text --rootPath=/mnt/nfs_root --method=
As a result of RHBZ #519665 you may want to try using yum instead. You should modify your yum repos to explicitly list architecture and release version instead of meta variables:
 yum groupinstall Base --installroot=/mnt/nfs_root
  1. Export the /mnt/nfs_root directory using NFS server. Make sure your firewall is not blocking traffic to the NFS server. Edit file /etc/exports:
    /mnt/nfs_root *(rw,no_root_squash)
  1. Start NFS server:
    service nfs start

Prepare the test system to use the exported NFS directory. You need to boot the kernel and initrd.img generated from Dracut with the correct parameters. You can use DHCP/PXE, bootable floppy/CD-ROM/USB drive or local /boot disk on the test system. This example uses local /boot disk.

  1. The test system is pre-installed and /boot is on the local disk
  2. You need to use dracut to generate initrd.img and get the kernel image as well. If the test system has the same OS version as the one installed in the /mnt/nfs_root directory you can generate the dracut image on the test system:
     dracut /boot/dracut.img $(uname -r)
  3. Place the vmlinuz and initrd.img files under /boot and configure grub.conf. Adjust server IP and directory. It should look like:
    # grub.conf generated by anaconda
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE: You have a /boot partition. This means that
    # all kernel and initrd paths are relative to /boot/, eg.
    # root (hd0,0)
    # kernel /vmlinuz-version ro root=/dev/sda1
    # initrd /initrd-version.img
    title dracut NFS
    root (hd0,0)
    kernel /vmlinuz- rw root=
    initrd /dracut.img
  4. Reboot the test system

Expected Results

The following must be true to consider this a successful test run.

  1. The system will boot from the kernel+initrd pair
  2. init will bring up the network interface and mount the NFS directory
  3. The init process will successfully switch to the new root and the system will boot into default runlevel