locked
Orphaned disks from ASM to ARM migration RRS feed

  • Question

  • Hi,

    We migrated a number of VMs from ASM to ARM a while back and I just found some apparent orphaned disks from the migration. Most of them I can only see using the Azure Storage Explorer reviewing the classic storage accounts and they all list as unattached there. But they don't even show up on the Azure Portal under Disks (Classic).

    However it seems all these servers have the classic disks as Source still:

    I'm just wondering if they should be safe to delete or not? They have the exact same name as the new ARM disks that do show as attached in the Azure Portal.

    Monday, February 11, 2019 2:23 PM

Answers

  • Migration of all the servers already using ASR from ASM to ARM, then classic disks may be stale replicated disks.  Definitely disks are not attached to ARM migrated servers those disks may be stale

    ARM VM -> they can find which disks are attached to VM - > virtual machines -> click on VM -> disks

    Wednesday, February 20, 2019 10:23 AM

All replies

  • Or put it this way, if these disks are actually in used by a running VM, it won't let me delete them will it? So if I just try one and it stops me because its in use, there's my answer?

    I've been trying to google 10 variations of "can you delete an attached disk in azure" but it just steers me toward irrelevant guides on how to find unattached disks.
    Tuesday, February 12, 2019 1:57 PM
  • Unused VHDs can accumulate after migration projects, diagnostic drives of VMs, or backups, but most unused VHDs are orphaned VHDs. Orphaned VHDs are created by deleting VMs in Azure using the Azure Portal or PowerShell. Refer to the suggestion mentioned in this link.

    When you delete a virtual machine (VM) in Azure, by default, any disks that are attached to the VM aren’t deleted. This feature helps to prevent data loss due to the unintentional deletion of VMs. After a VM is deleted, you will continue to pay for unattached disks.

    Unattached MANAGED disks:

    When a managed disk is attached to a VM, the ManagedBy property contains the resource ID of the VM. When a managed disk is unattached, the ManagedBy property is null. The script examines all the managed disks in an Azure subscription. When the script locates a managed disk with the ManagedBy property set to null, the script determines that the disk is unattached.

    Unattached UN-MANAGED disks:

    When an unmanaged disk is attached to a VM, the LeaseStatus property is set to Locked. When an unmanaged disk is unattached, the LeaseStatus property is set to Unlocked. The script examines all the unmanaged disks in all the Azure storage accounts in an Azure subscription. When the script locates an unmanaged disk with a LeaseStatus property set to Unlocked, the script determines that the disk is unattached.

    Download the script here

    PowerShell script to generate a report of unattached VHD disks. This script will create two files – unattached_managed_disks.csv, unattached_un_managed_disks.csv

    These two files will contain details about VHD files that are not attached to an Azure virtual machine.

    NOTE: You have to login into your account before running the script. “login-azurermaccount” to log into your account.

    You can use the generated CSV to better manage your Azure infrastructure. Understand why the disks are not in use and take an informed decision on whether you want to delete or re-use them. Thus, helping you to identify resources that are not being utilized and to reduce cost.

    Kindly let us know if the above helps or you need further assistance on this issue.

    Wednesday, February 13, 2019 9:16 AM
  • Thanks for your detailed response. I do understand what happens when deleting a VM, but the question here was specifically in regards to VMs migrated from ASM/Classic mode to ARM. The VMs haven't been deleted, but in Azure Storage Explorers these disks appear to not be attached. Which of course does suggest they can be deleted.

    But in the Azure portal these unattached classic/ASM disks don't even show up. Which has me worried that the disks might appear unattached in Storage Explorer but they are actually still used by the new ARM VM.

    Thoughts?

    Wednesday, February 13, 2019 9:57 AM
  • The Resource Manager deployment model doesn't have the concept of Classic images and disks. When the storage account is migrated, Classic images and disks are not visible in the Resource Manager stack but the backing VHDs remain in the storage account. If you wish you could create new ARM VMs with this unattached .VHDs. 

    Friday, February 15, 2019 8:16 AM
  • Thanks for your reply.

    But I'm looking in the Azure portal under Disks (Classic) and the disks don't show up there. However reviewing a classic Storage Account with Azure Storage Explorer they are there in the classic Storage Account. I just find this inconsistency worrisome. 

    Could it be that disks I'm seeing in Azure Storage Explorer inside classic Storage Accounts are actually the ARM disks in use by the migrated ARM servers? 

    Wednesday, February 20, 2019 9:20 AM
  • Migration of all the servers already using ASR from ASM to ARM, then classic disks may be stale replicated disks.  Definitely disks are not attached to ARM migrated servers those disks may be stale

    ARM VM -> they can find which disks are attached to VM - > virtual machines -> click on VM -> disks

    Wednesday, February 20, 2019 10:23 AM