Question

I was reading a blog post by Microsoft's Brad Calder (link below) about how Azure uses VHD files backed by page blobs. One interesting bit of information reads:

It is also important to note that when you delete files within the file system used by the VHD, most operating systems do not clear or zero these ranges, so you can still be paying capacity charges within a blob for the data that you deleted via a disk/drive."

I take this to mean if I attached a 1TB drive, fill it up, and then delete all files I will still be using 1TB of backing pages because they weren't cleared, even though my drive in the VM will appear empty.

I decided to test this out, and my results were the opposite of what Brad states. I created a Win2012 R2 VM in Azure, attached a 1GB drive wrote some code to see the amount of page blob data I was using. I then copied files onto the drive and again recorded the amount of page blob data in use; this number went up as expected. To my surprise, when I deleted the files, the page blob data in use returned to the original number of an empty drive.

I ran this test multiple times with different size drives and different types of data. Each time my backing page blob data size accurately reflected what was on the drive (i.e. I never saw "ghost" data remaining).

Can anyone shed some light on my results? Is this to be expected? Did something change in Azure? I can't find any information regarding this topic besides Brad's blog post.

Thanks!

Brad Calder's blog: http://blogs.msdn.com/b/windowsazure/archive/2012/06/28/data-series-exploring-windows-azure-drives-disks-and-images.aspx

Was it helpful?

Solution

After posting I managed to discover what's going on. Back in October 2013, Microsoft added TRIM support to Windows Server 2012 VMs (Win2008 is supported with some caveats). When you delete a file in Windows, a TRIM command is now sent which causes Azure to delete the backing VHD pages.

Here's a post that discusses the addition of TRIM: http://mvwood.com/blog/trim-support-comes-to-windows-azure-virtual-machines/

Here's a YouTube video of Mark Russinovich talking about how Azure uses TRIM: https://www.youtube.com/watch?v=5PZ6wFXQ9-4

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top