从快照创建的Windows Server 2012 VM无法在GCE上启动 [英] Windows Server 2012 VM created from Snapshot fails to Boot on GCE

查看:165
本文介绍了从快照创建的Windows Server 2012 VM无法在GCE上启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是Windows专家,并且从Snapshot恢复Windows Server 2012时遇到问题.我试图从几周前从Windows Server 2012 VM实例创建的快照在Google Compute Engine-GCE上创建新的VM实例.每当创建新VM时,我都永远无法执行RDP,然后在阅读GCE故障排除指南后,我确定Windows可能无法正常启动.我能够按以下方式查看串行端口输出

I am not a Windows expert and stuck while recovering Windows Server 2012 from Snapshot. I am trying to create a new VM instance on Google Compute Engine - GCE from a Snapshot which I created from Windows Server 2012 VM Instance couple of weeks ago . Whenever I create a new VM I am never able to do RDP then after reading GCE Troubleshooting guide I determined that may be Windows is not booting up properly. I was able to view the Serial Port Output as following

SeaBIOS (version 1.8.2-20161003_105447-google)
Total RAM Size = 0x00000003c0000000 = 15360 MiB
CPUs found: 4     Max CPUs supported: 4
found virtio-scsi at 0:3
virtio-scsi vendor='Google' product='PersistentDisk' rev='1' type=0 removable=0
virtio-scsi blksize=512 sectors=314572800 = 153600 MiB
drive 0x000f3120: PCHS=0/0/0 translation=lba LCHS=1024/255/63 s=314572800
Booting from Hard Disk 0...

它停留在从硬盘0启动...

我进一步深入研究,并按如下方式读取串行端口2"日志

I dig further into it and read the Serial Port 2 log as following

Windows Boot Manager
Windows failed to start. A recent hardware or software change might be the cause. To fix the problem: 

Insert your Windows installation disc and restart your computer.
Choose your language settings, and then click "Next."
Click "Repair your computer.
If you do not have this disc, contact your system administrator or computer manufacturer for assistance. 

Status: 
A required device isn't connected or can't be accessed.  

我将磁盘连接到另一台计算机,并且可以看到磁盘上的所有文件.但是由于磁盘已写保护,因此无法修改任何内容.

I attached the disk to another machine and I can see all files on the disk. But can't modify any thing as the disk is write-protected.

我从中创建快照的原始VM仍然存在,因此我尝试将快照作为启动磁盘附加到原始VM实例,以便具有相同的硬件配置,但是我无法分离与该实例关联的磁盘,它给了我跟随错误.

Original VM from which I created Snapshot is still there so I tried to attach the snapshot to original VM instance as Boot Disk in order to have same hardware configuration but I can't detach the disk associated with that instance and it gives me following error.

Hot-remove of the root disk is not supported.

我尝试使用与获取快照之前相同的计算机类型创建VM.但是也失败了.

I tried creating VM with same Machine Type as before taking the Snapshot. But failed as well.

关于如何从Snapshot创建新的VM实例并正确启动Windows的任何建议?

Any suggestions on how I can create new VM instance from Snapshot and boot Windows properly?

推荐答案

浏览了许多文章,论坛和用户指南之后,终于可以从Snapshot成功旋转Windows VM实例了.

After going through number of articles, forums and user guides, finally I am able to spin the Windows VM Instance successfully from Snapshot.

问题出在引导加载程序和引导配置数据(BCD).理想情况下,您将映像用于OS磁盘.就我而言,操作系统和数据位于同一磁盘中,而我们只有一个快照. GCE允许从Snapshot创建新的VM实例,但就我而言,该实例未启动.

The issue was with bootloader and Boot Configuration Data (BCD). Ideally you use Images for OS Disk. In my case OS and data were in same disk and we just had a Snapshot. GCE allows creating new VM instance from Snapshot but in my case the instance was not booting up.

按照分步指南从快照中恢复OS/数据.

Follow the step by step guide to recover your OS/Data from snapshot.

从快照创建磁盘,并使用新的临时VM实例修复磁盘BCD.

Create Disk from Snapshot and fix the disk BCD using new temporary VM Instance.

此实例是临时实例,恢复操作系统/数据后可以将其删除.

This instance is temporary instance and you may delete it after you recover your OS / data.

从Google Cloud Console

From Google Cloud Console

选择 Compute Engine> VM实例,然后选择 CREATE INSTANCE

确保选择与快照相同的操作系统.启动后,请确保您可以进行远程桌面并登录到新的VM实例.

记下实例名称和实例在其中运行的区域.

Note down instance name and zone in which the instance is running.

从Google Cloud Console

From Google Cloud Console

选择 Compute Engine>磁盘,然后选择 CREATE DISK

确保拍摄快照之前/之前选择与打开"相同的磁盘大小/磁盘类型,否则Windows可能会引发启动错误.另外,请确保磁盘与恢复实例位于同一区域.如果您的磁盘与实例所在的区域不在同一区域,则将无法附加该磁盘.

在此步骤中,将您在步骤2中创建的磁盘连接到VM实例(在步骤1中创建的磁盘)

In this step you attach the disk you (created in Step-2) to VM instance (created in Step-1)

打开Goog​​le Cloud Shell,然后键入以下命令

Open Google Cloud Shell and type the following command

gcloud compute instances attach-disk [INSTANCE-NAME] --disk [DISK-NAME] --zone [ZONE]

用实例名称,磁盘名称和运行实例的区域替换变量.

Replace the variables with your Instance name, Disk name and Zone in which you are running the instance.

转到开始">搜索",然后键入 diskmgmt.msc 以打开磁盘管理"工具.如果您刚刚连接的磁盘显示为离线,请右键单击该磁盘,然后选择在线.

Go to Start > Search and type diskmgmt.msc to open the Disk Management tool. If the disk you just attached, shows up as Offline, right-click on it and select Online.

确保磁盘处于联机状态后,请确认磁盘上的每个卷均已分配了驱动器号.分配的特定驱动器号并不重要.如果没有任何卷分配驱动器号,请右键单击该卷,然后选择更改驱动器号和路径",然后选择添加".选择分配以下驱动器号,让它选择下一个可用的驱动器号,然后单击确定.同样,实际使用的驱动器号无关紧要.

After making sure the disk is Online, verify that each volume on the disk has a drive letter assigned. The specific drive letters assigned is not important. If any of the volumes do not have a drive letter assignment, right-click the volume and select Change Drive Letter and Paths, then Add. Select Assign the following drive letter, let it choose the next available drive letter, then click OK. Again, the actual drive letters used doesn’t matter.

记下驱动器号.对我来说D:开车.

Note down the Drive letter. For me its D: drive.

尝试在连接的驱动器中创建一个新文件夹.如果磁盘是写保护的,并且无法在驱动器中创建任何文件或文件夹,则需要关闭写保护,否则可以跳过此步骤.

Try creating a new folder in your attached drive. If your disk is write-protected and you are not able to create any file or folder in the drive then you need to turn-off the write-protection, otherwise you can skip this step.

打开高架命令提示符(以管理员身份运行),然后键入

Open Elevated Command Prompt (run as Administrator) and type

diskpart 

,您将得到DISKPART>提示

and you will get DISKPART> prompt

类型:

list volume 

系统将显示所有带有编号的卷.接下来,您需要输入以下内容来选择音量:

System will display all volumes with number. Next you need to select the volume by typing:

select volume # 

其中#是卷号.对我来说是1.

where # is the volume number. For me it's 1.

然后键入以下命令以删除写保护

Then type following commands remove write-protection

attr disk clear readonly 
attr volume clear readonly
attr volume clear hidden
attr volume clear shadowcopy

通过输入 exit 或关闭命令提示符窗口,

退出diskpart.在Windows资源管理器中打开驱动器.您应该能够看到所有数据和Windows系统文件.在驱动器中创建一个新文件夹,以确保磁盘不受写保护.

Exit diskpart by typing exit or closing command prompt window. Open the drive in Windows Explorer. You should be able to see all your data and Windows system files. Create a new folder in the drive to make sure disk is not write-protected.

如果您熟悉Windows bcedit命令,则一定要使用bcedit,但是我使用了 EasyBCD 来修复启动配置数据.

If you are familiar with Windows bcedit command, then by all means use bcedit, but I used EasyBCD for fixing the boot configuration data.

https://neosmart.net/EasyBCD

安装后,打开EasyBCD并单击

Once installed open EasyBCD and click on

文件>选择BCD存储

,然后在文件名下的文件选择对话框中输入 D:\ Boot \ BCD 或在步骤5中分配的任何驱动器号.系统将显示驱动器的启动配置数据.

and file selection dialog under filename enter D:\Boot\BCD or whatever drive letter you assigned in Step 5. The system will show you Boot Configuration Data for your drive.

点击编辑启动菜单按钮,然后选择跳过启动菜单,然后点击保存设置.

Click on Edit Boot Menu button and select Skip the boot menu and click on Save settings.

单击高级设置按钮,然后在基本选项卡下,单击驱动器:菜单,然后选择磁盘的驱动器号.

Click on Advanced Settings button and under the Basic tab click on Drive: menu and select the Drive letter of the disk.

请注意:驱动器号应与步骤5相同

单击 BCD备份/修复按钮,然后在 BCD管理选项下,选择重新创建/修复启动文件,然后单击执行操作按钮.

Click on BCD Backup/Repair button and under the BCD management options select Re-create/repair boot files and click on Perform Action button.

通过再次打开磁盘管理"使磁盘脱机,然后右键单击该磁盘,然后选择脱机.

Make the disk offline by Opening Disk Management again and right-click the disk and select Offline.

现在最小化您的RDP窗口,并在Google Cloud Shell中键入以下命令以从恢复实例中分离磁盘

Now minimize your RDP window and in Google Cloud Shell type following command to detach the disk from Recovery instance

gcloud compute instances detach-disk [INSTANCE-NAME] --disk [DISK-NAME] --zone [ZONE]

现在,您已经修复了从快照创建的磁盘的引导配置数据.

Now you have fixed the Boot Configuration Data of the Disk created from Snapshot.

我们现在准备旋转VM实例并使用该磁盘启动它.让我们从磁盘创建实例

We are now ready to spin the VM Instance and boot it using this disk. Let's create instance from disk

从Google Cloud Console中选择 Compute Engine> VM实例,然后选择 CREATE INSTANCE

From Google Cloud Console select Compute Engine > VM Instances and select CREATE INSTANCE

为了避免在第一次运行时出现任何问题,请确保选择与创建快照之前/之前相同的计算机类型.

In order to avoid any problem at first run, make sure you select the same Machine Type as on/before the snapshot creation.

在这一点上,您应该能够使用有效的VM实例,并且应该能够进行RDP登录.

At this point you should be able to have working VM instance and you should be able to do RDP login.

如果仍然遇到任何问题,请单击Google Cloud Console中的VM实例,然后向下滚动到页面底部,以查看串行端口日志,或者您可以在Google Cloud Shell中键入以下命令.

In case you are still facing any issues, then have a look at your serial port log by clicking the VM instance in Google Cloud Console and then scroll down to bottom of the page or you can type the following command in Google Cloud Shell.

gcloud compute instances get-serial-port-output [INSTANCE-NAME] --zone [ZONE]

经验教训

  • 对于具有/不具有数据的OS磁盘,请使用映像而不是快照.
  • 请勿将数据与OS放在同一磁盘上,即使它是一台测试机,并且您正在做一些临时工作.
  • Lesson Learned

    • For OS disks with / without data, use images instead of snapshots.
    • Do not keep your data in same disk as OS even if it's a test machine and you are doing some temporary work.
    • 这篇关于从快照创建的Windows Server 2012 VM无法在GCE上启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆