Upload
oviroger
View
8
Download
0
Embed Size (px)
DESCRIPTION
Azure VM-Resizing the OS Disk
Citation preview
Steps to Resize a Windows Azure VM’s Root/C Drive
This was originally created by Drew McDaniel and Corey Sanders at Microsoft, so all credit goes to them. I’ve
simply filled in all of the questions and cleaned it up for publishing with my other Azure Gotcha’s Blog Entry.
Find their original entry here.
The operation will require one VM to create a base image from the platform image,
and then a second VM to modify the 30GB image to something larger.
1. Deploy 2 VMs using Windows Server 2008 R2 image
VM1: Original (Out of Space) VM
VM2: Resizer VM
2. From Azure Portal
Note the URL to the VHD’s OS Disk for VM1 (from portal under Virtual
Machines Disks)
Delete VM1 from under Virtual Machines (do not delete the underlying
VHD OS Disk)
Delete the VM1 OS Disk object in the portal for VM1 – when asked,
leave the Blob that = the VHD. Deleting the disk isn’t the same as
deleting the actual VHD file…that’s still there as a Blob file (This is
needed to release the lease on the blob that contains the VHD for VM1)
Create a new disk to store the VM1 OS Disk VHD file by clicking
Attach Empty Disk on VM2…call it “VHD Download.” Virtual Machines
Select VM Attach Attach empty disk
Create another new disk called “Expanded VHD Drive” to store the
newly-created VM1 OS Disk VHD file using Attach Empty Disk on
VM2. This drive should be large enough to hold the original VHD OS
image and the new expanded OS image that you will create. Virtual
Machines Select VM Attach Attach empty disk
3. Remote into VM2 – Resizer VM
Connect to VM2 as administrator
Open Admin Tools, Computer Management, Disk
Management…Attach to the new disks and format them etc.
Install CloudXplorer, Cloud Storage Studio 2 (My personal favorite) or
another Windows Azure storage management tool. You will also
need to install .NET 3.5 on the VM before installing CloudXplorer or
Cloud Storage Studio 2.
Set up the Azure Subscription in the Cloud Tool
Set up the Azure Storage Account in the Cloud Tool (you can do this
directly, you don’t have to do the entire Subscription if you don’t want to)
Download the VM1 VHD to the “VHD Download” drive you created
earlier
Install a VHD Utility such as VMResizer
Use VHD Resizer to extend the VHD to the desired size using Open,
point to the downloaded .VHD file, specify the new file to be saved
on the 2nd “Expanded VHD Drive” and give it a size (Do NOT exceed
128 GB…there is a 128GB limit for all OS VHDs and you will feel sick if
you create it larger, upload it, and then can’t create your VM
afterwards!!)
Use your Cloud Management Tool to Upload the new extended VHD
back to the Storage Account, blob store as a PAGE BLOB. You could
also use CSUpload for this step. CSUpload will be faster, but it is yet
another tool that you would need to install on VM2. Depending on
the tool that you use, you might get a Failed to Upload pretty
quickly…just try to do it again and make sure you’re specifying PAGE
BLOB, not just File Upload.
4. From Azure Portal
Once the upload completes, Shutdown VM2
Detach both data disks that were attached to VM2
Delete the disk object in the portal for both the extended image and
the data disk (remember this doesn’t delete the VHD blobs, just the Disks
and their attachment to VM2)
Add the extended OS image back as a disk using the
commands: Virtual Machines Disks Create Disk
5. Create a New VM like you normally would, but this time point to the new
OS Disk you just created. You can also point to just the disk instead of the
Image if you’d like. Make sure to name the VM exactly the same as the old
machine…if you give it a new name, you won’t be able to connect to it!!!
6. Boot your New VM and RDP into it
7. Open Disk Manager…you will see there is a new unformatted partition next
to C, but on the same disk
8. Go download the free utility by AOMEI called Partition Assistant Server &
Lite Toolkit from http://www.disk-partition.com/download-server.html. You
only need to install the Lite version, don’t install the Demo
9. Open PA Lite and click the C drive – drag the size to the end of the disk,
which will expand it to use the full space you resized earlier
10. Hit Apply, and watch the magic happen. Your C drive is now the full 100GB
or whatever you specified
11. Cleanup all VMs and VHDs other than the extended image