Every Windows virtual machine in Azure automatically has 2 drives connected. But what if you need more space? File storage in Azure can be quite daunting. Blobs, files, queues,… what do I really need? And what about managing those storage accounts with their nice, ahem…, naming convention?
Managed disks to the rescue
So, what makes a managed disk better?
First, an Azure managed disk simplifies the creation and management of disks in Azure. It automatically creates a storage account and manages the sizing.
Here is a list of some more benefits:
- No more need for creating storage accounts manually
- 99.999% availability (that’s a lot of 9’s)
- Automatically encrypted at rest
- More granular access control
- Better reliability for availability sets
VM’s need to be configured to use managed disks only. No mixing and matching with unmanaged and managed disks.
New virtual machine
Just select “Yes” when given the choice to enable “Use managed disks”. This is enabled by default.
Existing virtual machines
You can convert existing VM’s, which are currently using unmanaged disk. Check out this Microsoft article.
This action is quite impactful and cannot be reversed. So best to take precaution when performing this conversion.
Create and attach a new managed disk
Create a managed disk
- Search for “Managed disks” in the Azure Marketplace.
- Choose a nice name (Ooooooh… This-is-a-great-naming-convention-01-DISK).
- Location is next up.
- Select your favorite type of storage (SSD or HDD).
- If necessary select your source data or create an empty disk
- Size your disk (1GiB – 4TiB)
Add an existing disk to your virtual machine
This one is easy.
- Select your VM.
- Select “Disks” under “Settings”.
- Push the blue button “Add data disk”.
- Your disk should be waiting for you.
You can also choose “Create disk” in this menu. This will summon the “Create disk” wizard again. Mind that you might have some more options available when using the wizard in the Marketplace.
Attach the disk to your machine
Things do not become complicated now. Nice.
The only thing to keep in mind:
It is advised to enable TRIM on HDD drives. TRIM discards unused blocks on the disk so you are only billed for storage that you are actually using.
Now, all we need to do is connect to the machine using RDP. We open our trusty disk management tool (diskmgmt.msc) using the Start menu or Run.
- Disk Management recognizes that you have a new, un-initialized disk and the “Initialize Disk” window pops up.
- Make sure the new disk is selected and click “OK” to initialize it.
- The new disk appears as unallocated. Right-click anywhere on the disk and select “New simple volume”. The “New Simple Volume” Wizard opens.
- Go through the wizard, keeping all of the defaults, when you are done select “Finish”.
Last thing remaining now is formatting and assigning a beautiful drive letter and label. Be creative 🙂