Skip to content

Commit 5ad83e6

Browse files
authored
Merge pull request MicrosoftDocs#85785 from genlin/master11
Remove the "delele VM" from the troubleshoot articles
2 parents 797c009 + 5e775ae commit 5ad83e6

File tree

5 files changed

+138
-128
lines changed

5 files changed

+138
-128
lines changed

articles/virtual-machines/troubleshooting/troubleshoot-recovery-disks-portal-linux.md

+69-61
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ If your Linux virtual machine (VM) encounters a boot or disk error, you may need
2424
## Recovery process overview
2525
The troubleshooting process is as follows:
2626

27-
1. Delete the VM encountering issues, keeping the virtual hard disks.
28-
2. Attach and mount the virtual hard disk to another Linux VM for troubleshooting purposes.
29-
3. Connect to the troubleshooting VM. Edit files or run any tools to fix issues on the original virtual hard disk.
30-
4. Unmount and detach the virtual hard disk from the troubleshooting VM.
31-
5. Create a VM using the original virtual hard disk.
27+
1. Stop the affected VM.
28+
1. Create a snapshot for the OS disk of the VM.
29+
1. Create a virtual hard disk from the snapshot.
30+
1. Attach and mount the virtual hard disk to another Windows VM for troubleshooting purposes.
31+
1. Connect to the troubleshooting VM. Edit files or run any tools to fix issues on the original virtual hard disk.
32+
1. Unmount and detach the virtual hard disk from the troubleshooting VM.
33+
1. Swap the OS disk for the VM.
3234

33-
For the VM that uses managed disk, see [Troubleshoot a Managed Disk VM by attaching a new OS disk](#troubleshoot-a-managed-disk-vm-by-attaching-a-new-os-disk).
35+
> [!NOTE]
36+
> This article does not apply to the VM with unmanaged disk.
3437
3538
## Determine boot issues
3639
Examine the boot diagnostics and VM screenshot to determine why your VM is not able to boot correctly. A common example would be an invalid entry in `/etc/fstab`, or an underlying virtual hard disk being deleted or moved.
@@ -41,58 +44,62 @@ Select your VM in the portal and then scroll down to the **Support + Troubleshoo
4144

4245
You can also click **Screenshot** across the top of the boot diagnostics log to download a capture of the VM screenshot.
4346

47+
## Take a snapshot of the OS Disk
48+
A snapshot is a full, read-only copy of a virtual hard drive (VHD). We recommend that you cleanly shut down the VM before taking a snapshot, to clear out any processes that are in progress. To take a snapshot of an OS disk, follow these steps:
49+
50+
1. Go to [Azure portal](https://portal.azure.com). Select **Virtual machines** from the sidebar, and then select the VM that has problem.
51+
1. On the left pane, select **Disks**, and then select the name of the OS disk.
52+
![Image about the name of the OS disk](./media/troubleshoot-recovery-disks-portal-windows/select-osdisk.png)
53+
1. On the **Overview** page of the OS disk, and then select **Create snapshot**.
54+
1. Create a snapshot in the same location as the OS disk.
55+
56+
## Create a disk from the snapshot
57+
To create a disk from the snapshot, follow these steps:
58+
59+
1. Select **Cloud Shell** from the Azure portal.
60+
61+
![Image about Open Cloud Shell](./media/troubleshoot-recovery-disks-portal-windows/cloud-shell.png)
62+
1. Run the following PowerShell commands to create a managed disk from the snapshot. You should replace these sample names with the appropriate names.
63+
64+
```powershell
65+
#Provide the name of your resource group
66+
$resourceGroupName ='myResourceGroup'
67+
68+
#Provide the name of the snapshot that will be used to create Managed Disks
69+
$snapshotName = 'mySnapshot'
70+
71+
#Provide the name of theManaged Disk
72+
$diskName = 'newOSDisk'
73+
74+
#Provide the size of the disks in GB. It should be greater than the VHD file size. In this sample, the size of the snapshot is 127 GB. So we set the disk size to 128 GB.
75+
$diskSize = '128'
76+
77+
#Provide the storage type for Managed Disk. PremiumLRS or StandardLRS.
78+
$storageType = 'StandardLRS'
79+
80+
#Provide the Azure region (e.g. westus) where Managed Disks will be located.
81+
#This location should be same as the snapshot location
82+
#Get all the Azure location using command below:
83+
#Get-AzLocation
84+
$location = 'westus'
85+
86+
$snapshot = Get-AzSnapshot -ResourceGroupName $resourceGroupName -SnapshotName $snapshotName
87+
88+
$diskConfig = New-AzDiskConfig -AccountType $storageType -Location $location -CreateOption Copy -SourceResourceId $snapshot.Id
89+
90+
New-AzDisk -Disk $diskConfig -ResourceGroupName $resourceGroupName -DiskName $diskName
91+
```
92+
3. If the commands run successfully, you will see the new disk in the resource group that you provided.
4493
45-
## View existing virtual hard disk details
46-
Before you can attach your virtual hard disk to another VM, you need to identify the name of the virtual hard disk (VHD).
47-
48-
Select your resource group from the portal, then select your storage account. Click **Blobs**, as in the following example:
49-
50-
![Select storage blobs](./media/troubleshoot-recovery-disks-portal-linux/storage-account-overview.png)
51-
52-
Typically you have a container named **vhds** that stores your virtual hard disks. Select the container to view a list of virtual hard disks. Note the name of your VHD (the prefix is usually the name of your VM):
53-
54-
![Identify VHD in storage container](./media/troubleshoot-recovery-disks-portal-linux/storage-container.png)
55-
56-
Select your existing virtual hard disk from the list and copy the URL for use in the following steps:
57-
58-
![Copy existing virtual hard disk URL](./media/troubleshoot-recovery-disks-portal-linux/copy-vhd-url.png)
59-
60-
61-
## Delete existing VM
62-
Virtual hard disks and VMs are two distinct resources in Azure. A virtual hard disk is where the operating system itself, applications, and configurations are stored. The VM itself is just metadata that defines the size or location, and references resources such as a virtual hard disk or virtual network interface card (NIC). Each virtual hard disk has a lease assigned when attached to a VM. Although data disks can be attached and detached even while the VM is running, the OS disk cannot be detached unless the VM resource is deleted. The lease continues to associate the OS disk with a VM even when that VM is in a stopped and deallocated state.
63-
64-
The first step to recover your VM is to delete the VM resource itself. Deleting the VM leaves the virtual hard disks in your storage account. After the VM is deleted, you attach the virtual hard disk to another VM to troubleshoot and resolve the errors.
65-
66-
Select your VM in the portal, then click **Delete**:
67-
68-
![VM boot diagnostics screenshot showing boot error](./media/troubleshoot-recovery-disks-portal-linux/stop-delete-vm.png)
69-
70-
Wait until the VM has finished deleting before you attach the virtual hard disk to another VM. The lease on the virtual hard disk that associates it with the VM needs to be released before you can attach the virtual hard disk to another VM.
71-
72-
73-
## Attach existing virtual hard disk to another VM
74-
For the next few steps, you use another VM for troubleshooting purposes. You attach the existing virtual hard disk to this troubleshooting VM to be able to browse and edit the disk's content. This process allows you to correct any configuration errors or review additional application or system log files, for example. Choose or create another VM to use for troubleshooting purposes.
75-
76-
1. Select your resource group from the portal, then select your troubleshooting VM. Select **Disks** and then click **Attach existing**:
77-
78-
![Attach existing disk in the portal](./media/troubleshoot-recovery-disks-portal-linux/attach-existing-disk.png)
79-
80-
2. To select your existing virtual hard disk, click **VHD File**:
81-
82-
![Browse for existing VHD](./media/troubleshoot-recovery-disks-portal-linux/select-vhd-location.png)
83-
84-
3. Select your storage account and container, then click your existing VHD. Click the **Select** button to confirm your choice:
85-
86-
![Select your existing VHD](./media/troubleshoot-recovery-disks-portal-linux/select-vhd.png)
87-
88-
4. With your VHD now selected, click **OK** to attach the existing virtual hard disk:
89-
90-
![Confirm attaching existing virtual hard disk](./media/troubleshoot-recovery-disks-portal-linux/attach-disk-confirm.png)
94+
## Attach disk to another VM
95+
For the next few steps, you use another VM for troubleshooting purposes. After you attach the disk to the troubleshooting VM, you can browse and edit the disk's content. This process allows you to correct any configuration errors or review additional application or system log files. To attach the disk to another VM, follow these steps:
9196
92-
5. After a few seconds, the **Disks** pane for your VM lists your existing virtual hard disk connected as a data disk:
97+
1. Select your resource group from the portal, then select your troubleshooting VM. Select **Disks**, select **Edit**, and then click **Add data disk**:
9398
94-
![Existing virtual hard disk attached as a data disk](./media/troubleshoot-recovery-disks-portal-linux/attached-disk.png)
99+
![Attach existing disk in the portal](./media/troubleshoot-recovery-disks-portal-windows/attach-existing-disk.png)
95100
101+
2. In the **Data disks** list, select the OS disk of the VM that you identified. If you do not see the OS disk, make sure that troubleshooting VM and the OS disk is in the same region (location).
102+
3. Select **Save** to apply the changes.
96103
97104
## Mount the attached data disk
98105
@@ -152,19 +159,20 @@ Once your errors are resolved, detach the existing virtual hard disk from your t
152159
153160
2. Now detach the virtual hard disk from the VM. Select your VM in the portal and click **Disks**. Select your existing virtual hard disk and then click **Detach**:
154161
155-
![Detach existing virtual hard disk](./media/troubleshoot-recovery-disks-portal-linux/detach-disk.png)
162+
![Detach existing virtual hard disk](./media/troubleshoot-recovery-disks-portal-windows/detach-disk.png)
156163
157164
Wait until the VM has successfully detached the data disk before continuing.
158165
159-
## Create VM from original hard disk
160-
To create a VM from your original virtual hard disk, use [this Azure Resource Manager template](https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-specialized-vhd-existing-vnet). The template deploys a VM into an existing virtual network, using the VHD URL from the earlier command. Click the **Deploy to Azure** button as follows:
161-
162-
![Deploy VM from template from GitHub](./media/troubleshoot-recovery-disks-portal-linux/deploy-template-from-github.png)
166+
## Swap the OS disk for the VM
163167
164-
The template is loaded into the Azure portal for deployment. Enter the names for your new VM and existing Azure resources, and paste the URL to your existing virtual hard disk. To begin the deployment, click **Purchase**:
168+
Azure portal now supports change the OS disk of the VM. To do this, follow these steps:
165169
166-
![Deploy VM from template](./media/troubleshoot-recovery-disks-portal-linux/deploy-from-image.png)
170+
1. Go to [Azure portal](https://portal.azure.com). Select **Virtual machines** from the sidebar, and then select the VM that has problem.
171+
1. On the left pane, select **Disks**, and then select **Swap OS disk**.
172+
![The image about Swap OS disk in Azure portal](./media/troubleshoot-recovery-disks-portal-windows/swap-os-ui.png)
167173
174+
1. Choose the new disk that you repaired, and then type the name of the VM to confirm the change. If you do not see the disk in the list, wait 10 ~ 15 minutes after you detach the disk from the troubleshooting VM. Also make sure that the disk is in the same location as the VM.
175+
1. Select OK.
168176
169177
## Re-enable boot diagnostics
170178
When you create your VM from the existing virtual hard disk, boot diagnostics may not automatically be enabled. To check the status of boot diagnostics and turn on if needed, select your VM in the portal. Under **Monitoring**, click **Diagnostics settings**. Ensure the status is **On**, and the check mark next to **Boot diagnostics** is selected. If you make any changes, click **Save**:

0 commit comments

Comments
 (0)