You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Detach a data disk from a Linux VM - Azure| Microsoft Docs
3
+
description: Learn to detach a data disk from a virtual machine in Azure using CLI 2.0 or the Azure portal.
4
+
services: virtual-machines-linux
5
+
documentationcenter: ''
6
+
author: cynthn
7
+
manager: timlt
8
+
editor: ''
9
+
tags: azure-service-management
10
+
11
+
ms.assetid:
12
+
ms.service: virtual-machines-linux
13
+
ms.workload: infrastructure-services
14
+
ms.tgt_pltfrm: vm-windows
15
+
ms.devlang: na
16
+
ms.topic: article
17
+
ms.date: 03/21/2017
18
+
ms.author: cynthn
19
+
20
+
---
21
+
# How to detach a data disk from a Linux virtual machine
22
+
23
+
When you no longer need a data disk that's attached to a virtual machine, you can easily detach it. This removes the disk from the virtual machine, but doesn't remove it from storage.
24
+
25
+
> [!WARNING]
26
+
> If you detach a disk it is not automatically deleted. If you have subscribed to Premium storage, you will continue to incur storage charges for the disk. For more information refer to [Pricing and Billing when using Premium Storage](../storage/storage-premium-storage.md#pricing-and-billing).
27
+
>
28
+
>
29
+
30
+
If you want to use the existing data on the disk again, you can reattach it to the same virtual machine, or another one.
31
+
32
+
## Detach a data disk using CLI 2.0
33
+
34
+
```azurecli
35
+
az vm disk detach -g myResourceGroup --vm-name myVm -n myDataDisk
36
+
```
37
+
38
+
The disk remains in storage but is no longer attached to a virtual machine.
39
+
40
+
41
+
## Detach a data disk using the portal
42
+
1. In the portal hub, select **Virtual Machines**.
43
+
2. Select the virtual machine that has the data disk you want to detach and click **Stop** to deallocate the VM.
44
+
3. In the virtual machine blade, select **Disks**.
45
+
4. At the top of the **Disks** blade, select **Edit**.
46
+
5. In the **Disks** blade, to the far right of the data disk that you would like to detach, click the  detach button.
47
+
5. After the disk has been removed, click Save on the top of the blade.
48
+
6. In the virtual machine blade, click **Overview** and then click the **Start** button at the top of the blade to restart the VM.
49
+
50
+
The disk remains in storage but is no longer attached to a virtual machine.
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
## Next steps
60
+
If you want to reuse the data disk, you can just [attach it to another VM](virtual-machines-linux-add-disk.md?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
@@ -30,12 +30,14 @@ If you want to use the existing data on the disk again, you can reattach it to t
30
30
31
31
## Detach a data disk using the portal
32
32
1. In the portal hub, select **Virtual Machines**.
33
-
2. Select the virtual machine that has the data disk you want to detach and then click **All settings**.
34
-
3. In the **Settings** blade, select **Disks**.
35
-
4. In the **Disks** blade, select the data disk that you would like to detach.
36
-
5. In the blade for the data disk, click **Detach**.
33
+
2. Select the virtual machine that has the data disk you want to detach and click **Stop** to deallocate the VM.
34
+
3. In the virtual machine blade, select **Disks**.
35
+
4. At the top of the **Disks** blade, select **Edit**.
36
+
5. In the **Disks** blade, to the far right of the data disk that you would like to detach, click the  detach button.
37
+
5. After the disk has been removed, click Save on the top of the blade.
38
+
6. In the virtual machine blade, click **Overview** and then click the **Start** button at the top of the blade to restart the VM.
39
+
37
40
38
-

39
41
40
42
The disk remains in storage but is no longer attached to a virtual machine.
For more information, see [Remove-AzureRmVMDataDisk](https://msdn.microsoft.com/library/mt603614.aspx)
57
+
For more information, see [Remove-AzureRmVMDataDisk](/powershell/remove-azurermvmdatadisk).
57
58
58
59
## Next steps
59
60
If you want to reuse the data disk, you can just [attach it to another VM](virtual-machines-windows-attach-disk-portal.md?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
0 commit comments