Have you ever come across a situation where you need to export or backup a VM, but can’t find the storage to do so as so XenServer reflects it?
NO PROBLEM. This is where we leverage the CIFS ISO share for a “temporary storage repository”.
There can be many reasons for this, such as snapshot chains being too long, the need of making a quick (and full) backup of a VM, or in general — just storing a VM export to save space on your production storage repositories.
Bare with me through this tutorial and a big thank you to all my clients (you know who you are) who have led me to use this personal tactic to overcome a lack of storage!
An ISO repository shows just that: ISO files. That being said, well, you can store anything you would like on that storage repository that isn’t an ISO. Yup, XenCenter only cares about ISO files and will only show ISO files that are available to you and every other administrator with access to this “temporary storage” we are about to create. What we have is a quick method to create storage to perform temporary tasks for VMs that will not be seen by other administrators!
I will use a real-life example of this as I have a Windows 2003 Server that is responsible for my backups and I need to preserve, but the only machine on my network with enough space is my local laptop.
Step 1: Create a directory on your local machine or server that has space to store exports
We take a look at the local C: or D: drive on your target machine and find it has enough space to hold a VM export or backup:
PERFECT. I only need 100GB of temporary space to backup a VM! So, what I do is head to the root of C:\ of the system I have identified with enough space to make a VM backup and create a directory called “C:\TEMPSTORAGE” and I share it (permissions applied or globally):
Next, I ensure that C:\TEMPSTORAGE on my targeted system is either open to EVERYONE or particular users: it depends on your security/timeline.
With this now setup, we have to lean to XenCenter: establishing a NEW CIFS ISO SHARE to the \\SERVER_IP\tempstorage directory we created on our local compute or local server
Now, from XenCenter we will see our Temporary ISO storage:
Now, from the command line we can export a SHUTDOWN VM from the command line. However, we need to know what the MOUNT POINT/DIRECTORY is for this temporary ISO storage:
Run the ‘mount’ command which will produce something such as this:
[root@bucketbox ~]# mount
/dev/sda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw)
none on /dev/shm type tmpfs (rw)
/opt/xensource/packages/iso/XenCenter.iso on /var/xen/xc-install type iso9660 (ro,loop=/dev/loop0)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
10.0.0.5:/storage00/bfb0eda9-6fb2-7778-ba0c-923c7a004f44 on /var/run/sr-mount/bfb0eda9-6fb2-7778-ba0c-923c7a004f44 type nfs (rw,soft,timeo=133,retrans=2147483647,tcp,actimeo=0,addr=10.0.0.5)
//10.0.0.6/tempstorage on /var/run/sr-mount/6f35b92e-b754-a000-e7d4-37fc05350153 type cifs (rw,mand)
We can see that “tempstorage” is mounted to XenServer’s directory /var/run/sr-mount/6f35b92e-b754-a000-e7d4-37fc05350153
Now, we can execute the following commands to export a VM to XVA format on the “Temporary Storage”/”CIFS ISO Share” we created. In this example, I have a performance VM I am testing and I want to export it, so I run:
cd /var/run/sr-mount/6f35b92e-b754-a000-e7d4-37fc05350153 (again, the mount point for out temporary SR)
xe vm-export vm=xs-performance-test-01 filename=/var/run/sr-mount/6f35b92e-b754-a000-e7d4-37fc05350153/performance_backup.xva &
This will run the export of the VM will allow you to import it back to your XenServer once it is complete using:
xe vm-import filename=/var/run/sr-mount/6f35b92e-b754-a000-e7d4-37fc05350153/performance_backup.xva host-username=root host-password=password sr-uuid=<UUID of the SR you want to store the VM to>
So, yeah – that is it in a nutshell! CIFS Shares can be used for temporary, quick storage and deleted after your task is accomplished!
And this is from my Virtual Desktop to you.