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

How to count number of snapshots in a chain?

Chirag Katbamna


Hello all,


I had run into the issue “Snapshot chain is too long” some time back and took a lot of work to get out of it (see my other thread on that). However it happened again!! I got out of the issue easier this time by migrating the vhd to another SR.


however, I would like to have active monitoring on this - but besides running cli command like below, I do not know how else I can get a count of snapshots in the chain of a vhd. These snapshots are hidden so not visible via GUI console.


usr/bin/vhd-util scan -f -a -p -c -m d2ff04e8-16b9-434a-b89e-c0e9b3efd830.vhd


A command like the above lists out the vhd and any chain snapshots.

has anyone setup any script or API call to count the chain length? I would like yo do this automatically daily and setup an alert email if the chain gets over 5 snapshots for example.


Link to comment

6 answers to this question

Recommended Posts

  • 0

I wanted to count snapshots of volumes/vhd files as I do not do VM snapshots from console. 

 I ended up doing simple word count (wc -l) which counts line feeds but still works for my needs 


For example 

 /usr/bin/vhd-util scan -f -a -p -c -m d2ff04e8-16b9-434a-b89e-c0e9b3efd830.vhd |wc -l


where 2 is the output and count of snapshot chain (base parent plus current changes)


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...