LINUX開機失敗 將OS磁碟掛到另外一台虛擬機器進行修改

1.建立OS磁碟快照
  1. Stop the affected VM.
  2. Take a snapshot for the OS disk of the VM.
  3. Create a virtual hard disk from the snapshot.
  4. Attach and mount the virtual hard disk to another Windows VM for troubleshooting purposes.
  5. Connect to the troubleshooting VM. Edit files or run any tools to fix issues on the original virtual hard disk.
  6. Unmount and detach the virtual hard disk from the troubleshooting VM.
  7. Swap the OS disk for the VM

2.建立磁碟
   使用cloud powershell進行
#Provide the name of your resource group
$resourceGroupName ='Owncloud'

#Provide the name of the snapshot that will be used to create Managed Disks
$snapshotName = 'pccoc02-snapshot' 

#Provide the name of theManaged Disk
$diskName = 'newpccoc02OSDisk'

#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.
$diskSize = '128'

#Provide the storage type for Managed Disk. Premium_LRS or Standard_LRS.
$storageType = 'Standard_LRS'

#Provide the Azure region (e.g. westus) where Managed Disks will be located.
#This location should be same as the snapshot location
#Get all the Azure location using command below:
#Get-AzLocation
$location = 'Southeast Asia'

$snapshot = Get-AzSnapshot -ResourceGroupName $resourceGroupName -SnapshotName $snapshotName 

$diskConfig = New-AzDiskConfig -AccountType $storageType -Location $location -CreateOption Copy -SourceResourceId $snapshot.Id

New-AzDisk -Disk $diskConfig -ResourceGroupName $resourceGroupName -DiskName $diskName


3.掛接磁碟到其他VM並進行修改




4.完成修改後 de-attach disk

5.swap OS disk

footer See also :
https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshoot-recovery-disks-portal-linux

留言

這個網誌中的熱門文章

Office 2021 離線安裝封裝與KMS啟動步驟

Ollama使用心得與模型導入教學

ARC下NSMutableDictionary 無法使用retainCount