1

I am writing a script that:

  • takes a snapshot of a data disk that is attached to a running VM
  • copies the snapshot to different storage account (using Start-AzureStorageBlobCopy)
  • deletes the snapshot

This seems to work as it is. However, I note that the copy operation is asynchronous, and is not likely complete by the time I run the command to delete the snapshot. The snapshot appears to be gone right away.

Do I need to wait for the copy status of the blob to be 'complete' before I delete the snapshot, or does the Azure infrastructure handle this in the background? I am not getting any exceptions thrown in the script.

1 Answer 1

0

You'll want to complete your blob-copy operation prior to deleting the snapshot.

If you're concerned about storage costs due to leaving snapshots around longer than necessary, consider the following:

  • snapshots don't initially take up space
  • snapshots only accrue space when pages in the original blob are modified
  • storage costs are amortized daily, so even if you left a snapshot around for a few hours, and pages were changed, an extra 1GB accrued would be almost negligible cost-wise (e.g. with locally-redundant storage, daily cost is 0.002 / GB - and that's list price, no discounts applied).
1
  • It's not a cost issue. I just wanted to clean up after the copy operation. I will add code my script to wait for the copy to complete.
    – TDL
    Oct 15, 2013 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .