If you’re a regular follower of this blog then you’ve probably noticed that I’ve been doing a lot of work in Azure lately. I have several trials of Azure Site Recovery going and the beautiful thing about trials is that you get to bump into issues. During the trial phase I don’t try to pre-plan things but I do apply prior knowledge. Mostly the trial is to see what if any issue we find and document how to get past them so we can avoid them for the next trial. Speaking of trial and Azure Site Recovery did you see that it’s free for 31 days? You do still pay for Storage but that’s minimal. What this allows you to do for your client is upload their servers and work out any sync issues without incurring Azure costs.
Now back to the issue at hand. If you have a server virtualized already and you just want to move the VHD’s into an Azure virtual machine, then you’ll find out probably the hard way that the VHD sizes have to be a round number. As in 80GB not a single extra MB. So 80GB works fine but 80.01GB does not. You’ll be unable to add the VHD to a machine. At this point you’ll be saying something like AAARRGGGHHHH!
What to do? Azure officially would like you to download the VHD, resize it locally, then upload it again. Right…you just spent 36 hours waiting for that file to upload and now they want you to do it again? Surely there has to be a better way.
Well there is and we’re all very lucky that Microsoft allows their employees to post tools they write onto GitHub. Here’s the original blog post explaining the evolution of Azure Disk Resizer and how it works. http://blog.maartenballiauw.be/post/2013/01/07/Tales-from-the-trenches-resizing-a-Windows-Azure-virtual-disk-the-smooth-way.aspx
From the blog post…this is end result but you really, really, really should read the whole blog post
Since resizing Windows Azure VHD files is a well-known missing feature, I decided to wrap all my code in a console application and share it on GitHub. Feel free to fork, contribute and so on. WindowsAzureDiskResizer takes at least two parameters: the desired new size (in bytes) and a blob URL to the VHD. This can be a URL containing a Shared Access SIgnature.
Now let’s resize a disk. Here are the steps to take:
- Shutdown the VM
- Delete the VM -or- detach the disk if it’s not the OS disk
- In the Windows Azure portal, delete the disk (retain the data!) do that the lease Windows Azure has on it is removed
- Run WindowsAzureDiskResizer
- In the Windows Azure portal, recreate the disk based on the existing blob
- Recreate the VM -or- reattach the disk if it’s not the OS disk
- Start the VM
- Use diskpart / disk management to resize the partition
Here’s how fast the resizing happens:
We’re good for now, at least until Microsoft decides to switch to the newer VHDX file format…I
It works but the size parameter is now GB. Take that into consideration and you’ll be amazed at how fast the resize happens. Like the image shows it’s a second or two. Impressive and so useful.
Here’s the GibHub home. https://github.com/azure-contrib/WindowsAzureDiskResizer
Not a Third Tier customer yet? Let me introduce: We’re Third Tier. We provide advanced Third Tier support for IT Professionals and MicroStaffing for IT consulting firms. Come on over, create an account (no charge) and follow our social media locations. Attend our next chat or webinar: http://www.thirdtier.net/events