Reputation: 221
The default Disk Size when creating a VM in azure is 30GB. I only use around 3GB of it. Now, Azure offers a 4GB disk, at a sixteenth of the cost. They decided to make it SO complicated to make it 4GB or 8GB, instead of just offering as an option when creating a VM.
All I need to do is to create a new 4GB managed disk.
How do I get the VHD file for ubuntu so I can finally make the disk? I was looking everywhere but can't find the answer.
Upvotes: 4
Views: 1520
Reputation: 1066
I managed to go as low as to just 3 GB and have Ubuntu 20.04 LTS (Focal Fossa) running as an Azure VM.
Prerequisites are below mentioned images downloaded from https://cloud-images.ubuntu.com/focal/current/, a tool to convert VMDK to VHD (e.g. 2Tware Convert VHD) and Hyper-V Manager installed/turned on under local Windows features.
focal-server-cloudimg-amd64-azure.vhd.zip
. When unpacked the file livecd.ubuntu-cpc.azure.vhd
is 30-31 GB large. I didn’t manage to shrink it (only an expansion was possible), so the result would have been worse than the original (30GB) Ubuntu VMs from Azure Marketplace.focal-server-cloudimg-amd64.vmdk
instead. Here a conversion to VHD was needed with help of 2Tware Convert VHD. Unfortunately, if uploaded to Azure this image is not accepted as it is a Dynamic VHD.Edit Disks…->Browse…->Convert->VHD->Fixed
the file I was getting was 10 GB large (noticeable improvement, but still larger than the final 3 GB).Edit Disks…
I went for Quick Create…
of a new Virtual Machine. I chose Local installation source
and selected the VHD file converted from VMDK. Finally, I clicked Create Virtual Machine
.New Virtual Machine.vhdx
under C:\Users\Public\Documents\Hyper-V\Virtual hard disks\
or C:\ProgramData\Microsoft\Windows\Virtual Hard Disks\
.Upvotes: 1
Reputation: 1595
As mentioned in the comments, what you require is the Desktop version of Ubuntu and not the Server one. In addition to Ubuntu NOT providing any Azure-compatible Desktop version of Ubuntu, Azure only endorses the Ubuntu versions below:
Ubuntu Server and Pro. 16.x, 18.x, 20.x Information about extended support for Ubuntu 12.04 and 14.04 can be found here: Ubuntu Extended Security Maintenance.
Additional distro support info here too.
For the images below, you rightly pointed out (apologies for overlooking) that it will still provide you with a 30GB image after conversion.
Also, because Ubuntu Server and Desktop editions share the same kernel, it should be possible for you to follow the same steps to download and create your custom image by following the same prep steps outlined for non-endorsed distros, convert it to VHD
and then upload it. Even if this is successful, it's also possible that it will cause some other issues with underlying Azure services.
One last option I thought of is using Azure Migrate to move an existing on-premises Ubuntu VM to Azure. This option failed when we tried but I should disclose our VM was running a much older version of CentOS. When using Azure Migrate, Azure will analyse your machine and tell you whether your VM is supported.
So here's the thing - you can only use images that are in an Azure Storage Account. Although it seems you've been through a lot already, I'm afraid it doesn't get any easier but steps are generally clear on how it can be done.
The Azure documentation on the topic actually recommends to download it from the official Ubuntu cloud repository.
Note
Before attempting to create your own custom Ubuntu image for Azure, please consider using the pre-built and tested images from https://cloud-images.ubuntu.com/ instead.
You can also just download one of the two versions listed on the documentation - this will provide you with a .VHDX
file.
Azure does not support the .VHDX
format. See:
The VHDX format is not supported in Azure, only fixed VHD. You can convert the disk to VHD format using Hyper-V Manager or the Convert-VHD cmdlet.
Here's an article which explains how to do this with both options.
Once you have the file in VHD
format, you can now upload it to Azure.
You can use AzCopy which is rather complicated when compared to a direct upload, but just mentioning that this can also be done. It also seems to be the recommended approach from Azure.
The easiest option is to upload manually through the Portal. See this article that goes into details - pick what's relevant to you.
(a) Choose your storage account, create/select a container you want to upload to
(b) Click Upload and select the Ubuntu VHD file to upload.
Ensure that the Blob type is set to Page Blob.
That should be all - it's very painful but possible
Upvotes: 2