Just found out I was taking up - and paying for - a lot of storage due to abandoned disks from long ago deleted VMs. I manged to delete most of them, but now I'm stuck with a set that cannot be deleted as they remain attached to VMs nowhere to be found.
刚刚发现,由于很久以前被删除的虚拟机放弃了磁盘,我正在占用并支付大量存储空间。我想要删除大部分内容,但现在我遇到了一个无法删除的集合,因为它们仍然无法找到虚拟机。
Any ideas how to get rid of these disks, PowerShell tricks maybe?
任何想法如何摆脱这些磁盘,PowerShell技巧可能?
4 个解决方案
#1
3
If I am understanding correct, Once you delete a Virtual Machine, it delete the service but keep a copy of the VHD image under Disks. So please go to the Disks tab under virtual Machine and try to delete it.
如果我理解正确,删除虚拟机后,它会删除该服务,但会在“磁盘”下保留VHD映像的副本。所以请转到虚拟机下的磁盘选项卡并尝试删除它。
If that is not the case, please add a screenshot with error message from where your trying to delete VM.
如果不是这种情况,请添加一个屏幕截图,其中包含您尝试删除VM的错误消息。
#2
1
The only way to do this that I can see is through PowerShell
. I ran into the same problem and here's how I fixed it. I installed the Azure PowerShell
extensions and configured my subscription and then my storage account. Once I did that I then ran this command
我能看到的唯一方法就是通过PowerShell。我遇到了同样的问题,这就是我修复它的方法。我安装了Azure PowerShell扩展并配置了我的订阅,然后配置了我的存储帐户。一旦我这样做,我就运行了这个命令
get-azuredisk | Remove-AzureDisk
Get-azuredisk
will grab all disks In my case I needed all of them removed. If you need to do individual then you need to get the name of the disk and then run remove-azuredisk
with the name switch and specify the disk name to remove it. That fixed it for me. Hope this helps someone in the future.
Get-azuredisk将抓取所有磁盘在我的情况下,我需要删除所有磁盘。如果您需要单独执行,则需要获取磁盘的名称,然后使用名称switch运行remove-azuredisk并指定磁盘名称以将其删除。那为我修好了。希望这可以帮助将来的某个人。
#3
1
In the "new" Azure portal. Select Storage Accounts, then click on the storage account" where your none used VHD's are located, Click Blobs under Services, Click vhds under Essentials, search for unwanted vhd and click delete.
在“新”Azure门户中。选择存储帐户,然后单击存储帐户“未使用VHD的位置,单击服务下的Blob,单击Essentials下的vhds,搜索不需要的vhd,然后单击删除”。
#4
0
I was unable to use the (2016) web portal to delete orphaned disks in my (classic) storage account. The answers here work, but here is a more detailed walk-through for deleteing these orphaned disks with PowerShell.
我无法使用(2016)Web门户删除我的(经典)存储帐户中的孤立磁盘。这里的答案有效,但这里是使用PowerShell删除这些孤立磁盘的更详细的演练。
PowerShell
Download and install PowerShell if you haven't already. (Install and configure Azure PowerShell.) Initial steps from this doclink:
如果您还没有,请下载并安装PowerShell。 (安装和配置Azure PowerShell。)此doclink的初始步骤:
-
Check that the Azure PowerShell module is available after installing:
Get-Module –ListAvailable
安装后检查Azure PowerShell模块是否可用:Get-Module -ListAvailable
-
If the Azure PowerShell module is not listed, you may need to import it:
Import-Module Azure
如果未列出Azure PowerShell模块,则可能需要导入它:Import-Module Azure
-
Login to Azure Resource Manager:
Login-AzureRmAccount
登录Azure资源管理器:Login-AzureRmAccount
AzurePublishSettingsFile
-
Retreive your PublishSettingsFile.
Get-AzurePublishSettingsFile
检索您的PublishSettingsFile。 GET-AzurePublishSettingsFile
- Get-AzurePublishSettingsFile launches manage.windowsazure.com and prompts you to download an XML file that you can be saved anywhere.
- Get-AzurePublishSettingsFile启动manage.windowsazure.com并提示您下载可以在任何地方保存的XML文件。
- Reference: Get-AzurePublishSettingsFile Documentation
- 参考:Get-AzurePublishSettingsFile文档
- Get-AzurePublishSettingsFile launches manage.windowsazure.com and prompts you to download an XML file that you can be saved anywhere.
-
Import-AzurePublishSettingsFile and specify the path to the file just saved.
Import-AzurePublishSettingsFile -PublishSettingsFile '<your file path>'
导入-AzurePublishSettingsFile并指定刚刚保存的文件的路径。导入-AzurePublishSettingsFile -PublishSettingsFile' <您的文件路径> '
Show and Remove Disks
-
Show current disks. (Reference: Azure Storage Cmdlets)
Get-AzureDisk
显示当前磁盘。 (参考:Azure存储Cmdlet)Get-AzureDisk
-
Quickly remove all disks. (Credit to Mike's answer)
get-azuredisk | Remove-AzureDisk
快速删除所有磁盘。 (相信Mike的回答)get-azuredisk |删除 - AzureDisk
-
Or remove disks by name. (Credit to Remove-AzureDisk Documentation)
Remove-AzureDisk -DiskName disk-name-000000000000000000 -DeleteVHD
或按名称删除磁盘。 (感谢Remove-AzureDisk文档)删除-AzureDisk -DiskName disk-name-000000000000000000 -DeleteVHD
#1
3
If I am understanding correct, Once you delete a Virtual Machine, it delete the service but keep a copy of the VHD image under Disks. So please go to the Disks tab under virtual Machine and try to delete it.
如果我理解正确,删除虚拟机后,它会删除该服务,但会在“磁盘”下保留VHD映像的副本。所以请转到虚拟机下的磁盘选项卡并尝试删除它。
If that is not the case, please add a screenshot with error message from where your trying to delete VM.
如果不是这种情况,请添加一个屏幕截图,其中包含您尝试删除VM的错误消息。
#2
1
The only way to do this that I can see is through PowerShell
. I ran into the same problem and here's how I fixed it. I installed the Azure PowerShell
extensions and configured my subscription and then my storage account. Once I did that I then ran this command
我能看到的唯一方法就是通过PowerShell。我遇到了同样的问题,这就是我修复它的方法。我安装了Azure PowerShell扩展并配置了我的订阅,然后配置了我的存储帐户。一旦我这样做,我就运行了这个命令
get-azuredisk | Remove-AzureDisk
Get-azuredisk
will grab all disks In my case I needed all of them removed. If you need to do individual then you need to get the name of the disk and then run remove-azuredisk
with the name switch and specify the disk name to remove it. That fixed it for me. Hope this helps someone in the future.
Get-azuredisk将抓取所有磁盘在我的情况下,我需要删除所有磁盘。如果您需要单独执行,则需要获取磁盘的名称,然后使用名称switch运行remove-azuredisk并指定磁盘名称以将其删除。那为我修好了。希望这可以帮助将来的某个人。
#3
1
In the "new" Azure portal. Select Storage Accounts, then click on the storage account" where your none used VHD's are located, Click Blobs under Services, Click vhds under Essentials, search for unwanted vhd and click delete.
在“新”Azure门户中。选择存储帐户,然后单击存储帐户“未使用VHD的位置,单击服务下的Blob,单击Essentials下的vhds,搜索不需要的vhd,然后单击删除”。
#4
0
I was unable to use the (2016) web portal to delete orphaned disks in my (classic) storage account. The answers here work, but here is a more detailed walk-through for deleteing these orphaned disks with PowerShell.
我无法使用(2016)Web门户删除我的(经典)存储帐户中的孤立磁盘。这里的答案有效,但这里是使用PowerShell删除这些孤立磁盘的更详细的演练。
PowerShell
Download and install PowerShell if you haven't already. (Install and configure Azure PowerShell.) Initial steps from this doclink:
如果您还没有,请下载并安装PowerShell。 (安装和配置Azure PowerShell。)此doclink的初始步骤:
-
Check that the Azure PowerShell module is available after installing:
Get-Module –ListAvailable
安装后检查Azure PowerShell模块是否可用:Get-Module -ListAvailable
-
If the Azure PowerShell module is not listed, you may need to import it:
Import-Module Azure
如果未列出Azure PowerShell模块,则可能需要导入它:Import-Module Azure
-
Login to Azure Resource Manager:
Login-AzureRmAccount
登录Azure资源管理器:Login-AzureRmAccount
AzurePublishSettingsFile
-
Retreive your PublishSettingsFile.
Get-AzurePublishSettingsFile
检索您的PublishSettingsFile。 GET-AzurePublishSettingsFile
- Get-AzurePublishSettingsFile launches manage.windowsazure.com and prompts you to download an XML file that you can be saved anywhere.
- Get-AzurePublishSettingsFile启动manage.windowsazure.com并提示您下载可以在任何地方保存的XML文件。
- Reference: Get-AzurePublishSettingsFile Documentation
- 参考:Get-AzurePublishSettingsFile文档
- Get-AzurePublishSettingsFile launches manage.windowsazure.com and prompts you to download an XML file that you can be saved anywhere.
-
Import-AzurePublishSettingsFile and specify the path to the file just saved.
Import-AzurePublishSettingsFile -PublishSettingsFile '<your file path>'
导入-AzurePublishSettingsFile并指定刚刚保存的文件的路径。导入-AzurePublishSettingsFile -PublishSettingsFile' <您的文件路径> '
Show and Remove Disks
-
Show current disks. (Reference: Azure Storage Cmdlets)
Get-AzureDisk
显示当前磁盘。 (参考:Azure存储Cmdlet)Get-AzureDisk
-
Quickly remove all disks. (Credit to Mike's answer)
get-azuredisk | Remove-AzureDisk
快速删除所有磁盘。 (相信Mike的回答)get-azuredisk |删除 - AzureDisk
-
Or remove disks by name. (Credit to Remove-AzureDisk Documentation)
Remove-AzureDisk -DiskName disk-name-000000000000000000 -DeleteVHD
或按名称删除磁盘。 (感谢Remove-AzureDisk文档)删除-AzureDisk -DiskName disk-name-000000000000000000 -DeleteVHD