Prerequisites
- XCP/Xenserver
Utilizing an ISO image in a VM's cdrom drive is fairly easy to do but because of the limited size of the Control Domain's (dom0) operating system partition it's difficult to download ISO images to /opt/xensource/packages/iso and it isn't really recommended to put them there anyway. In this tutorial we'll create a CD repository using an NFS share.
In our example we'll be using a share on the cloud0 host named /media/NFSISO. To set this up on cloud0 you'd log into cloud0 as root and add this line to the /etc/exports file of your NFS server.
/media/NFSISO/ *(rw)
I'd recommend that you secure your NFS share more tightly than I've done here but for the purpose of this tutorial we'll go with it. We need to make a directory that we can mount our NFS share on first.
[root@cloud1 ~]# mkdir /media/NFSISO
Add the entry to the fstab so it will be mounted on bootup. The following line for this tutorial should be added to the /etc/fstab using your favorite text editor.
cloud0:/media/NFSISO /media/NFSISO nfs defaults 0 0
Mount the NFS share and verify it's mounted using df.
[root@cloud1 ~]# mount /media/NFSISO/ [root@cloud1 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 4128448 2012164 1906572 52% / none 524444 0 524444 0% /dev/shm cloud0:/media/NFSISO 20642428 176200 19417652 1% /media/NFSISO
Create the iso Storage Repository using the /media/NFSISO location.
xe sr-create name-label="NFS ISO" type=iso \ device-config:location=/media/NFSISO/ device-config:legacy_mode=true \ content-type=iso
Verify using xe sr-list.
[root@cloud1 ~]# xe sr-list type=iso uuid ( RO) : 5dddd3c4-96bf-e316-2c84-8f4c80684d31 name-label ( RW): NFS ISO name-description ( RW): host ( RO): cloud1.acs.edcc.edu type ( RO): iso content-type ( RO): iso
Now we need to download an ISO disk for use in a VM. For this purpose we'll download the CentOS 6.3 Live DVD. CD into your new Storage Repository directory (/media/NFSISO) and use wget to download the iso file.
[root@cloud1 ~]# cd /media/NFSISO [root@cloud1 NFSISO]# wget \ http://mirror.flhsi.com/centos/6.3/isos/x86_64/CentOS-6.3-x86_64-LiveDVD.iso [root@cloud1 NFSISO]# xe sr-scan uuid=5dddd3c4-96bf-e316-2c84-8f4c80684d31
Verify that XCP sees it using xe cd-list.
[root@cloud1 NFSISO]# xe cd-list uuid ( RO) : 0549c68a-e38d-4cd8-9974-ba0b9167ff5a name-label ( RW): CentOS-6.3-x86_64-LiveCD.iso
Now that the CD ISO file shows up you can attach it to a VM.