Changes

Jump to: navigation, search
m
Text replacement - "<htmlet>xen<htmlet>" to "<htmlet>xen</htmlet>"
<table border="0" cellspacing="0" width="100%"><tr><td width="20%">[[Using QEMU Disk Images for Xen DomainU Systems|Previous]]<td align="center">[[Xen Virtualization Essentials|Table of Contents]]<td width="20%" align="right">[[Configuring a VNC based Graphical Console for a Xen Paravirtualized domainU Guest|Next]]</td><tr><td width="20%">Using QEMU Disk Images for Xen DomainU Systems<td align="center"><td width="20%" align="right">Configuring a VNC based Graphical Console for a Xen Paravirtualized domainU Guest</td></table><hr>  <htmlet>xen</htmlet>  In this chapter of [[Xen Virtualization Essentials]] we will be looking at creating a root filesystem for a Xen domainU system on an NFS mounted filesystem. In many ways this is little different from other techniques covered in preceding chapters in that , although similar techniques can be used to populate the root filesystem. The difference comes at the point that the domainU system is booted. Instead of running on a local filesystem, the root filesystem for our domainU system is instead located on a remote server. This is particularly useful when performing live migrations of running Xen based systems from one machine to another.
== Kernel Requirements for NFS based Root Filesystems ==
There is one key requirement for booting a Xen domU with an NFS mounted root filesystem. By default, most Linux kernels are not configured to support NFS mounted root filesystems. It is essential, therefore, that a custom kernel with CONFIG_ROOT_NFS support enabled be built and referenced in the ''kernel='' field of the Xen config file for the guest domain.The mechanism for achieving this varies between Linux distributions. A number of distribution specific tutorials are available on the internet, once such tutorial being [http://www.virtuatopia.com/index.php/CentOS_5_-_Build_a_Custom_Xen_Kernel_with_NFS_Root_Filesystem_(CONFIG_ROOT_NFS)_Support CentOS 5 - Build a Custom Xen Kernel with NFS Root Filesystem (CONFIG ROOT NFS) Support] 
== Populating the Root Filesystem ==
Once a custom Xen kernel with NFS root filesystem support enabled is available , the next step is to populate a suitable disk partition with a root filesystem. In this tutorial we will assume that this partition is mounted at /xen. A number of options for creating the root fielsystem are available and have been covered in preceding chapters. Recommended chapters to read for this are as follows:
* [[Building a Xen Virtual Guest Filesystem on a Physical Disk Partition (Cloning Host System)]]
</pre>
The ''rw'' indicates that the system with the specified IP address is able to read and write to the NFS mounted filesystem when it is mounted. The ''no_root_squash'' directive is used to allow the root user of the Xen domU to write to the NFS mounted root filesystem, (if this is not set they the root user will not have access to the guest system).
Once the ''/etc/exports'' file has been updated the ''exportfs'' command can be run to update the table of exported NFS filesystems. This command needs to be run as ''root'' using the '''-a''' flag:
</pre>
== Mounting Creating the Xen Guest Configuration File for the NFS Root Filesystem ==
At this point Now that we have a populated root filesystem for our Xen domainU system and have the filesystem exported on the NFS server it is now time to move to the remote system on which and set up the Xen domU system is to be booted (in other words environment for the Xen hosts guest system). In our example this is  Once we are on the remote system we need to copy the custom kernel with root NFS support enabled to the IP address specified local system so that it can be referenced in our Xen configuration file. Let''/etc/exports'' (is assume the kernel is named vmlinuz-2.e 1926.16818-53.21.11)14.el5.myxen and we have copied it to /boot on the local system.  For the purposes of this chapter tutorial we shall will also be assuming assume that the NFS server on which we configured and exported hosting our domainU root filesystem has an IP address of 192.168.2.412. In order to match the location of You will also recall that the root filesystem is mounted as /xen on the our NFS server . With this information we can create our Xen configuration file which we will created a /xen mount point on the current systemname xen_nfs.cfg:
<pre>
su kernel = "/boot/vmlinuz-2.6.18-53.1.14.el5.myxen"mkdir memory = 256name = "XenGuest"dhcp = "dhcp"vif = ['']nfs_root = "/xen"nfs_server = "192.168.2.12"root = "/dev/nfs"
</pre>
With the mount point created all that remains in this phase of the configuration One final change we need to make is to mount modify /xen on 192.168.2.4 using NFS etc/fstab file of our domainU root filesystem so that it the root partition is available at referenced as /xen on the host (192.168.2dev/nfs.11)For example:
<pre>
mount 192.168.2.4:/xen dev/xennfs / ext3 defaults 1 1#/dev/sdb2 none swap sw 0 0none /dev/pts devpts gid=5,mode=620 0 0none /dev/shm tmpfs defaults 0 0none /proc proc defaults 0 0none /sys sysfs defaults 0 0
</pre>
A directory listing of /xen All being well, it should reveal now be possible to boot the domainU system using an NFS mounted root filesystem ready for use by our Xen documanU system.
== Creating Booting the Xen Configuration File for domainU == The domainU with the NFS Root Filesystem mounted root filesystem is created in the same way that any other domainU would be started, using the ''xm create'' command: <pre>xm create xen_nfs.cfg</pre> Xen should now create the guest domain, mount the root filesystem over NFS and boot up the system.  <htmlet>xen</htmlet>  <hr><table border="0" cellspacing="0" width="100%"><tr><td width="20%">[[Using QEMU Disk Images for Xen DomainU Systems|Previous]]<td align="center">[[Xen Virtualization Essentials|Table of Contents]]<td width="20%" align="right">[[Configuring a VNC based Graphical Console for a Xen Paravirtualized domainU Guest|Next]]</td><tr><td width="20%">Using QEMU Disk Images for Xen DomainU Systems<td align="center"><td width="20%" align="right">Configuring a VNC based Graphical Console for a Xen Paravirtualized domainU Guest</td></table>

Navigation menu