Select Language:
If you’re trying to figure out whether a managed disk in Azure is truly being used inside your virtual machine, here’s a simple step-by-step guide to help you get the full picture.
First, let’s check the Azure side to see if the disk is attached to your VM. Azure tracks whether a managed disk is connected through a property called ManagedBy. You can view this information easily using the Azure Command-Line Interface (CLI). Run this command:
az disk show –resource-group YourResourceGroup –name YourDiskName –query managedBy -o tsv
If the output gives you the VM’s resource ID, it means the disk is attached. If it’s blank, then the disk isn’t currently connected to any VM.
You can also double-check which disks are attached to your VM with this command:
az vm show –resource-group YourResourceGroup –name YourVM –query “storageProfile.dataDisks[].name” -o table
This will list all data disks linked with your VM.
Once you’ve confirmed that the disk is attached, the next step is to check if it is being used inside the virtual machine. This depends on the operating system your VM is running.
If your VM operates on Linux, you need to log in via SSH. Once inside, use the command lsblk to list all attached disks and df -h to see which disks are mounted. If the disk shows up in lsblk but isn’t listed in df -h as mounted, it means the disk is not in use currently.
For Windows VMs, connect via Remote Desktop. Then go to Disk Management by typing diskmgmt.msc. Here, you can see if the disk is initialized, online, and has a drive letter assigned. If the disk is offline, uninitialized, or without a partition or drive letter, it suggests that the disk is connected but not being used.
This method should give you a clear understanding of whether the disk is attached and actively in use inside your VM. If you want more details, Microsoft provides helpful guides for both Linux and Windows disks:
If you have any questions or need further assistance, feel free to ask. I’m happy to help!


