This week I had a fresh challenge, create a small demo environment utilising a single XenServer host, however the host was prohibited from communicating with any LAN based devices, so installation media for VMs was going to be a challenge!
I decided that using a local ISO library would be the best bet, unfortunately XenCentre doesn’t give the option to do this, so the CLI was the only option.
Step 1 – Creating the ISO Library Folder
Connect to the XenServer using SSH and then issue the following command:
“mkdir -p /var/opt/xen/ISO_Store”
Step 2 – Create a ISO Storage Repository
Issue the following command within an SSH session:
“xe sr-create name-label=LocalISO type=iso device-config:location=/var/opt/xen/ISO_Store device-config:legacy_mode=true content-type=iso“
XenCenter will then update and show the new SR:
Now that we have an SR we just need to place the ISO files in the directory and installation can then begin, however trying to find direct links to media download is not always as straight forward as you may think. I needed a copy of 2008 R2 evaluation edition, so I followed Microsoft’s many steps in order to get the media, only to be advised that it was going to force me to use the download manager. Once the download manager started the download I could see the source location, but the link was far too long to copy and then re-write. So instead I paused the download and noticed that when I clicked the resume shortcut that was now on my desktop I was taken to the following URL:
This link is the actual path that the 2008 R2 Eval ISO is available from! So all we had to was now download the ISO using the command line on the XenServer:
Step 3 – Change directory
Change to the ISO storage directory:
Step 4 – Use wget to download the file
You will see output similar to the below:
Unfortunately Domain 0 only has 4GB of storage allocated by default, this ISO as demonstrated above is 2.9G and will fail during the download process due to lack of space. A smaller ISO (XP etc) would be fine, but not Win7 or 2008 R2 eval editions.
Using the command “df -h” we can see the current disk usage:
Part 2 – Creating a larger ISO library
When running the df -h command you will see the GPT partition that is listed as my local storage in XenCenter (/var/run/sr-mount etc). This has plenty of capactiy and will be perfect for my ISO requirement.
So we now create a new ISO directory (note that the GUID after /sr-mount will be different for each installation):
“mkdir -p ISO_Storage“
We now have an ISO_Storage folder that can be used to store ISO files and not have to worry about consuming all of Domain 0’s space. Now that the directory is there we can change directory to it:
Then re-issue the wget command from earlier –
One thing to note is that this particular ISO will not have a .ISO extension once downloaded it will be .ISO?lcid=1033, thankfully this is easily rectified by renaming the file:
“mv 7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso?lcid=1033 7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso“
Finally we add the new ISO_Storage folder as an ISO library:
“xe sr-create name-label=ISO_Storage type=iso device-config:location=/var/run/sr-mount/1b042bc0-16b3-fa45-f94d-7a6e4e3dafbe/ISO_Storage device-config:legacy_mode=true content-type=iso“
XenCenter will then display our newly created ISO library with any available .ISO files: