Jump to content
Welcome to our new Citrix community!
  • 0

XenServer snapshot changes the disk UUID


Marcel Zunnebeld

Question

Hello,

In an automated image (Ivanti Automation) process I create a new vDisk of a VM from a base snapshot (snapshot 1).
Then some applications are installed and another snapshot of the VM is made (snapshot2 ).
To then proceed with a custom installation, I resize the disk and take another snapshot (snapshot 3). That all goes fine, but when I want to go back to snapshot 2, the UUID of the disk has changed compared to snapshot 1 and my scripts that deal with commands for the disk no longer work.

Does anyone know if you can leave the UUID fixed? Or how to read the UUID from a disk and put it in a parameter?

Thanks in advance!

Link to comment

9 answers to this question

Recommended Posts

  • 0

The UUID of the disk is fixed and cannot be changed.

I'd suggest copying the current VDI to a new VDI, detaching the current VDI, and attaching the new VDI to the VM. Then if all is well, you can delete the old VDI along with its snapshots. I strongly suspect that growing the storage in the middle of a snapshot chain messed things up. At least then you could start with a "clean" VDI and start taking valid snapshots once again.

The caveat is that you'll probably have to shut down the VM to accomplish this.

 

-=Tobias

Link to comment
  • 0

Hi Tobias, apologies, I meant a variable instead of a parameter.
 

I need only the UUID itself to store as a variable in a .sh script from this output or any output like it that has a UUID:


Command:
xe snapshot-list name-label="snapshot2"

snapshots.png

 

With the PowerShell command
Get-XenVM | Where {$_.is_a_snapshot -eq $True} | select name_label i do get the snapshot names, and with
Get-XenVM | Where {$_.is_a_snapshot -eq $True} | select uuid  i do get the UUIDs

But I want to request the UUID of eg snapshot2 to store that as a variable in a .sh script

Link to comment
  • 0

Hi Tobias,

Thanks for the hint to the article.
With some trial and error it finally worked. I now have the following script which does exactly what it should:

xe vm-disk-list vm=<VMName>
xe vm-disk-list vm=<VMName> | grep -B 1 -A 1 "<name-label name of Disk 0 VDI>"


Then:

uuid=`xe vm-disk-list vm=<VMName> | grep -B 1 -A 1 "<name-label name of Disk 0 VDI>"| awk '/uuid/ {print $5}'`
xe vdi-resize disk-size=131GiB uuid=$uuid
 

For a VM named W10-GM-2 and a Disk 0 VDI name-label of W10-GM_2 0 it would be:
 

uuid=`xe vm-disk-list vm=W10-GM-2 | grep -B 1 -A 1 "W10-GM_2 0"| awk '/uuid/ {print $5}'`
xe vdi-resize disk-size=131GiB uuid=$uuid

Thanks for your help in this!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...