0

Is there any way to export an OS image (in my case, Debian distro) directly, without having to download the entire VHD (30 gigs for mine, while the actual system is 1-2gigs) that I understand to be filled with 0's and a 512b footer ? I'm just looking to get an ISO I can deploy locally.

taze totero
  • 199
  • 1
  • 1
  • 8

1 Answers1

0

As you may already know, the OS Image is actually stored as Page Blob in Azure Storage. For Page Blobs, you're only charged for the the bytes you occupy. For example, if the total size of the Page Blob is 30 GB and you only use 1 GB of that you're only charged for 1 GB and not the entire 30 GB.

This concept actually applies to downloads/uploads as well. It is called Sparsed Download/Upload. Essentially when you download a Page Blob using any Storage Explorer that supports it, it first gets the page ranges that are occupied (i.e. 512 byte ranges containing at least 1 non-zero byte). These tools are smart enough to download only those page ranges that are occupied.

So in your scenario, only 1-2 GB of data will actually be transferred and not entire 30 GB. The resulting file size will be 30 GB but the actual data that will get transferred will be 1-2 GB.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thank you for clarifying all that ! I figured that I was doing something wrong by download a VHD image of my disk... but from the "Image" that I have of the system, that I can successfully use to deploy a VM, the Blob URI is ... empty. Would you have any insight on that ? Thank you ! – taze totero May 15 '19 at 19:41
  • For managed disks, please see https://stackoverflow.com/questions/54207777/download-azure-managed-disk-to-local-via-powershell and https://learn.microsoft.com/en-us/azure/virtual-machines/scripts/virtual-machines-windows-powershell-sample-copy-managed-disks-vhd. HTH. – Gaurav Mantri May 15 '19 at 19:54
  • So if I understand well, these links explain how to download the VHD right? Which you can also do via GUI on the portal, and I did already, ending up with a 31GB VHD file that I am unable to shrink since I can not activate Hyper-V on W10 Family... any idea on that? Sorry for the hassle and thank you for your help Gaurav! – taze totero May 16 '19 at 09:24
  • OS Images are Managed Disks, and for Managed Disks, we are charged for their entire capacity, not actual usage. Though, this is not true for Snapshots (which are again Page Blobs). So, is it exception for Managed Disk? – Ankush Jain Feb 11 '21 at 08:02