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.
- Install needed packages
yum install anaconda anaconda-runtime
- Prepare a directory for root
- Install the OS under /mnt/nfs_root using anaconda
anaconda --text --rootPath=/mnt/nfs_root --method=ftp://ftp.fi.muni.cz/pub/linux/fedora/linux/releases/11/Fedora/x86_64/os/
- 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:
- 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.
- The test system is pre-installed and /boot is on the local disk
- 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)
- 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-22.214.171.124-167.fc11.x86_64 rw root=10.34.33.114:/mnt/nfs_root
- initrd /dracut.img
- Reboot the test system
The following must be true to consider this a successful test run.
- The system will boot from the kernel+initrd pair
- init will bring up the network interface and mount the NFS directory
- The init process will successfully switch to the new root and the system will boot into default runlevel