From Fedora Project Wiki

(Created page with '{{QA/Test_Case |description=Boot from NBD root fs with dracut |actions= IN PROGRESS # Start here ... # Next do this ... # Finally click that |results= The following must be true ...')
 
(Package specific category)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{QA/Test_Case
{{QA/Test_Case
|description=Boot from NBD root fs with dracut
|description=Boot a root filesystem located on a Network Block Device (NBD) using dracut.  For more information on nbd, please see [http://nbd.sourceforge.net].
|actions=
|actions=
IN PROGRESS
 
# Start here ...
Prepare NBD server and a root fs containing the OS version we want to boot.
# Next do this ...
# Install needed packages
# Finally click that
#: <pre>yum install nbd anaconda anaconda-runtime</pre>
# Prepare a disk image (can be a file, disk partition, LVM volume):
#: <pre> dd if=/dev/zero of=/tmp/nbd.img bs=1M count=5120</pre>
# Create a file system on the image and mount it so we can install onto it
#: <pre> mkfs.ext3 /tmp/nbd.img
#: mkdir -p /mnt/nbdroot
#: mount -o loop /tmp/nbd.img /mnt/nbdroot</pre>
# Install the OS under /mnt/nbdroot using anaconda
#: <pre> anaconda --text --rootpath=/mnt/nbdroot --method=http://fedora.nano-box.net/linux/releases/11/Fedora/i386/os/</pre>
 
{{admon/tip|Note|As a result of {{bz|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:
<pre> yum groupinstall Base --installroot=/mnt/nbdroot</pre>
}}
 
#<li value=5> Export the image with NBD (2345 is the TCP port). Make sure your firewall is not blocking traffic to the NBD server.
#: <pre> nbd-server 2345 /tmp/nbd.img</pre>
 
Prepare the test system to use the exported NBD image. 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 on the NBD image you can generate the dracut image on the test system:
#: <pre> dracut /boot/dracut.img $(uname -r)</pre>
# Place the vmlinuz and initrd.img files under /boot and configure grub.conf. Adjust server IP and port values. UUID is the value from blkid executed on the loopback mounted (NBD) image on the server. It should look like:
#: <pre># 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
#: #boot=/dev/xvda
#: default=0
#: timeout=10
#: title dracut NBD
#:        root (hd0,0)
#:        kernel /vmlinuz-2.6.29.4-167.fc11.i686.PAE rw root=UUID=123456 netroot=nbd:192.168.0.4:2345:ext3 ip=eth0:dhcp
#:        initrd /dracut.img</pre>
# Reboot the test system
 
{{admon/note|NOTE|You may want to use root{{=}}nbd:ip:port:fstype instead of root{{=}}UUID{{=}} netroot{{=}}. root{{=}}nbd: has been tested more and works. }}
 
|results=
|results=
The following must be true to consider this a successful test run. Be brief ... but explicit.  
The following must be true to consider this a successful test run.
# Step #1 completes without error
# The system will boot from the kernel+initrd pair
# The system boots into runlevel 5
# init will bring up the network interface and mount the NBD image
# Program completes wth exit code 0
# The init process will successfully switch to the new root and the system will boot into default runlevel
}}
}}
[[Category:Dracut Test Cases]]
[[Category:Package_dracut_test_cases]]

Latest revision as of 19:34, 19 June 2011

Description

Boot a root filesystem located on a Network Block Device (NBD) using dracut. For more information on nbd, please see [1].


How to test

Prepare NBD server and a root fs containing the OS version we want to boot.

  1. Install needed packages
    yum install nbd anaconda anaconda-runtime
  2. Prepare a disk image (can be a file, disk partition, LVM volume):
     dd if=/dev/zero of=/tmp/nbd.img bs=1M count=5120
  3. Create a file system on the image and mount it so we can install onto it
     mkfs.ext3 /tmp/nbd.img
    mkdir -p /mnt/nbdroot
    mount -o loop /tmp/nbd.img /mnt/nbdroot
  4. Install the OS under /mnt/nbdroot using anaconda
     anaconda --text --rootpath=/mnt/nbdroot --method=http://fedora.nano-box.net/linux/releases/11/Fedora/i386/os/
Idea.png
Note
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/nbdroot
  1. Export the image with NBD (2345 is the TCP port). Make sure your firewall is not blocking traffic to the NBD server.
     nbd-server 2345 /tmp/nbd.img

Prepare the test system to use the exported NBD image. 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 on the NBD image 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 port values. UUID is the value from blkid executed on the loopback mounted (NBD) image on the server. 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
    #boot=/dev/xvda
    default=0
    timeout=10
    title dracut NBD
    root (hd0,0)
    kernel /vmlinuz-2.6.29.4-167.fc11.i686.PAE rw root=UUID=123456 netroot=nbd:192.168.0.4:2345:ext3 ip=eth0:dhcp
    initrd /dracut.img
  4. Reboot the test system
Note.png
NOTE
You may want to use root=nbd:ip:port:fstype instead of root=UUID= netroot=. root=nbd: has been tested more and works.

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 NBD image
  3. The init process will successfully switch to the new root and the system will boot into default runlevel