Azure主机windows2008就地升级十步
Azure上云主机的windows2008体系必要进行就地升级。按着微软的升级路径:win2008-->win2012-->win2016-->win2022
第一步:创建快照备份,防止升级失败
第二步:升级托管磁盘,在VM管理的地方将磁盘升级成托管磁盘,注意此过程是不可逆的。
第三步:创建升级介质磁盘
打开Portal上的cloud shell,结果是一片黑屏,没有任何下令行显示,切换到浏览器无痕模式重新登录,OK.
按微软提供的下令行,修改$sku = "server2012Upgrade",拷贝粘贴到了cloud shell中执行。
#
# Customer specific parameters
# Resource group of the source VM
$resourceGroup = "WindowsServerUpgrades"
# Location of the source VM
$location = "WestUS2"
# Zone of the source VM, if any
$zone = ""
# Disk name for the that will be created
$diskName = "WindowsServer2012UpgradeDisk"
# Target version for the upgrade - must be either server2022Upgrade, server2019Upgrade, server2016Upgrade or server2012Upgrade
$sku = "server2012Upgrade"
# Common parameters
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServerUpgrade"
$managedDiskSKU = "Standard_LRS"
#
# Get the latest version of the special (hidden) VM Image from the Azure Marketplace
$versions = Get-AzVMImage -PublisherName $publisher -Location $location -Offer $offer -Skus $sku | sort-object -Descending { $_.Version }
$latestString = $versions.Version
# Get the special (hidden) VM Image from the Azure Marketplace by version - the image is used to create a disk to upgrade to the new version
$image = Get-AzVMImage -Location $location -PublisherName $publisher -Offer $offer -Skus $sku -Version $latestString
#
# Create Resource Group if it doesn't exist
#
if (-not (Get-AzResourceGroup -Name $resourceGroup -ErrorAction SilentlyContinue)) {
New-AzResourceGroup -Name $resourceGroup -Location $location
}
#
# Create Managed Disk from LUN 0
#
if ($zone){
$diskConfig = New-AzDiskConfig -SkuName $managedDiskSKU -CreateOption FromImage -Zone $zone -Location $location
} else {
$diskConfig = New-AzDiskConfig -SkuName $managedDiskSKU -CreateOption FromImage -Location $location
}
Set-AzDiskImageReference -Disk $diskConfig -Id $image.Id -Lun 0
New-AzDisk -ResourceGroupName $resourceGroup -DiskName $diskName -Disk $diskConfig
乐成创建介质
Name : WindowsServer2012UpgradeDisk
附加升级安装介质到VM,结果发现找不到这个盘,细致比对发现,原来内里还有一个地方要修改和VM实际环境一致,$location = "WestUS",在资源中删除刚才生成的安装介质,重新运行下令创建介质。
第五步:升级windows2012
在VM中附加安装介质盘乐成。
运行安装升级:
PS E:\Windows Server 2012> .\setup.exe
安装出现问题:
提示:
1.Active Directory on this domain controller does not contain Windows Server 2012 ADPREP /FORESTPREP updates
2.These devices might not work properly in Windows. We recommend updating the drivers for these devices before you continue.
System devices: Microsoft Hyper-V S3 Cap
在E:\Windows Server 2012\resource下面没有找到ADPREP,在E:\Windows Server 2012\support\adprep>adprep /forestprep中搜刮找到
E:\Windows Server 2012\support\adprep>adprep /forestprep
执行结果:
Adprep failed to verify whether schema master has completed a replication cycle
after last reboot.
The schema is not upgraded.
Check the log file ADPrep.log in the C:\Windows\debug\adprep\logs\20241217071508 directory for possible cause of failure.
Adprep encountered an LDAP error.
Error code: 0xc. Server extended error code: 0x20ae, Server error message: 00002
0AE: SvcErr: DSID-032103B3, problem 5010 (UNAVAIL_EXTENSION), data 8610
Check the log file ADPrep.log in the C:\Windows\debug\adprep\logs\20241217071508 directory for possible cause of failure.
Adprep encountered an LDAP error.
Error code: 0xc. Server extended error code: 0x20ae, Server error message: 000020AE: SvcErr: DSID-032103B3, problem 5010 (UNAVAIL_EXTENSION), data 8610
第六步:清除域控DC的垃圾信息
末了发现adprep /forestprep失败的缘故原由是此前有辅助域控离线后没有清理导致的。
ntdsutil:metadata cleanup删除了另外一台DC的残余信息
第七步:安装更新windows 2012
adprep /forestprep执行乐成
再次执行win2012安装,又出现错误提示必要执行:ADPREP /DOMAINPREP
执行后通过,提示新错误:Windows Setup cannot locate a valid hard drive to store temporary installation files. To install Windows, create more free space on the hard drive or add a new hard drive.
缘故原由是C盘的磁盘空间不敷导致。删除没有的文件腾出了空间,进入到了更新界面,collecting files,settings, and applications 等候很久,直到乐成更新。
第八步:制作windows2016安装盘,升级到windows2016
卸载windows2012的安装盘,执行第三步创建2016的安装介质,注意修改$sku = "server2016Upgrade"
VM中挂载的安装介质,执行更新:
PS G:\Windows Server 2016> .\setup.exe /auto upgrade /dynamicupdate disable /eula accept
发现磁盘空间不足,必要清理调windows.old
--安装磁盘清理工具
Import-Module ServerManager
Install-WindowsFeature Desktop-Experience
清理空间后再次执行安装更新。
第九步:升级window2022
重复第八步的动作升级到2022
PS G:\Windows Server 2022> .\setup.exe /auto upgrade /dynamicupdate disable /eula accept
第十步:转原来的Blob vhd磁盘到托管磁盘
原来主机挂载的数据盘是非托管的blob存储,现在主机转换成了托管磁盘后,原来的这些非托管磁盘无法挂载到主机了,托管的主机也不能回退到非托管主机,怎么办?
VM内里blob磁盘转托盘磁盘很简单,但是这些分离掉的blob存储盘转托管磁盘却找不到地方。
找了半资质料,末了终于找到了方案,那就是用blob的vhd创建一个托管磁盘:
全部服务--Disks--新建磁盘:资源组必要选和VM一致的,选择磁盘范例,源选择存储blob, OS选择windows,VM选择第一代,x64,创建乐成。
在VM上附加磁盘就可以找到新创建的磁盘添加。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]