This article describes how to create a local NFS-based ISO Library on a XenServer host. This procedure will destroy the Local Storage Repository and replace it with an NFS share.
CHANGES TO THE DOMAIN 0 VM ON A XENSERVER HOST MAY RENDER THE HOST UNSUPPORTED. This procedure describes several changes to the XenServer host’s configuration that may cause it to become unsupported.
A better option to obtain this same functionality would be to build a hosted NFS server VM and connect the shared ISO Library to the hosted VM.
– How To Change the Default Storage Repository to File-based VHD-on-EXT3 http://support.citrix.com/article/ctx116324
– Allow NFS through iptables on a RedHat system http://pario.no/2008/01/15/allow-nfs-through-iptables-on-a-redhat-system/
First, install XenServer Enterprise on the system with the default Logical Volume Manager (LVM)-backed storage repository (SR).
Next, we need to remove the LVM-backed Local Storage repository.
*NOTE* If you have virtual machines (VMs) on your existing local LVM-backed SR please backup (export) and afterwards delete them before continuing.
a. Find the default SR device ID, universal unique identifier (UUID), and remove the default SR.
i. Log on to the XenServer server console.
ii. Type the following command to display information about your default SR.
# xe sr-list type=lvm
Make a note of the default UUID.
In this case, the SR UUID = 63276e9a-4d15-dd2e-f437-599d6c01e4b4
iii. Determine the UUID for your default SR’s physical block device (PBD) using the following command:
# xe pbd-list sr-uuid=your SR UUID
Make a note of the PBD UUID.
In this case, the PBD UUID = 28f63f05-a5b4-96df-072a-f7232acefb24
iv. Disconnect the Local Storage SR using the following command:
# xe pbd-unplug uuid=your PBD UUID
At this point, the Local Storage SR should show as disconnected in the XenCenter console denoted with a red exclamation point.
v. Now remove the Local Storage SR using the following command:
# xe sr-destroy uuid=your SR UUID
At this point, the Local Storage SR should show as removed in the XenCenter console.
Now if we issue the #xe sr-list type-lvm command, we can see that the Local Storage SR no longer exists…
…but if we issue the # fdisk –l command, we can see that we have a nice empty partition on which to build our NFS share.
b. The next step is to ready this partition for an NFS share by installing a file system on it.
i. Install file system on /dev/sda3
# mkfs -t ext3 /dev/sda3
Now let’s make sure the NFS service is started and set to export our share. NFS exports from a server are controlled by the file /etc/exports. Each line begins with the path of a directory to be exported, followed by a space-separated list of allowed clients.
a. First create a mount point and mount the new disk.
# mkdir /mnt/nfs
# mount –t ext3 /dev/sda3 /mnt/nfs
b. Confirm that it is mounted with the mount command.
c. Edit the /etc/exports file and add something like the following:
This will allow all clients on the subnet to attach to the share.
d. Next start the NFS service.
Now we can work on opening up the firewall. XenServer ships with a firewall enabled and running. There are a couple of ways to ‘open’ the firewall.
a. The Lazy Man’s way is to turn off the firewall altogether. (THIS IS NOT RECOMMENDED)
i. Simply stop the iptables service
b. The better way is to open the ports on the firewall.
This command will show the ports that are actively being used by services that NFS will need.
c. We can now make entries to the /etc/sysconfig/iptables to open those ports to allow communication. (In my case I only needed to open ports 111 and 2049 – portmapper and nfs)
We can now attach our NFS share to the XenServer pool as a NFS based ISO SR.
…and there she be!
Copy some files up to the share and you’re ready to go.