2017-07-18

Windows 2000 實體機轉 Hyper-V 的虛擬化作業

有一台老掉牙的 Windows 2000 Server
由於上面的系統已經沒有人會維護了, 而該系統能轉的功能也都已經轉到別的系統上
但仍有一些資料無法轉出, 需要在上面查詢, 故不能下線也不能壞掉
但是也無法移機, 因為那個系統早已沒有簽維護, 廠商也早已不支援那古代的版本
所以唯一避免他一步一步走上硬體損壞的絕路之前能做的僅有虛擬化一途

由於 Windows 2000 不支援 Volume Shadow Copy, 所以不能線上用 Disk2vhd 來轉
如果從光碟開機進一般的 WinPE 等工具系統, 也因為 RAID Card Driver 的關係沒辦法讀到磁碟
在這困難重重的情況下還好仍有一線生機

雖然自己常用的是 Hyper-V, 但對 VMWare 也是不排斥的
此時祭出 VMware vCenter Converter Standalone 來進行線上移轉是再適合不過了
畢竟在那個年代, VMWare 絕對是虛擬化技術的王者
果然一切順利地轉到 VMWare vSphere 免費板上面去一點問題也沒有

為了利用便宜的即時移轉、複寫等功能, 我們的虛擬化平台 95% 都是 Hyper-V
所以接下來的挑戰就是再從 VMWare 轉到 Hyper-V
在這裡吃足了苦頭, 以下是實戰說明:

VMWare 預設是將磁碟掛載在 SCSI 介面, Somehow 轉過去之後就是能開機運作
但是轉到 Hyper-V 就沒這麼簡單了, 因為 Hyper-V Generation 1 只支援 IDE 開機
而支援 SCSI 開機的 Generation 2 只支援 Windows 2012 以上的作業系統
而由於這台 Windows 2000 Server 是裝在 HP DL380 G5 上面
最當初就是直接裝在 RAID Card 上, 沒有 IDE 驅動程式
因此開機時只能看見致命藍幕 (BSoD: Blue Screen of Death)
INACCESSIBLE BOOT DEVICE – STOP: 0x0000007B

查找了相當多資料, 得出上面沒 IDE 驅動的結論
因此朝這方面去進一步查找, 以下為找到的解決辦法, 經過嘗試也的確解決了我的問題
如果你也有相同的麻煩, 請看完我所有步驟再決定你打算怎麼進行
因為有可能並非每個步驟都必須做到才能搞定

步驟一:
首先, 我進行了相當多教學文件中提到的辦法
在 VMWare 階段, VM 新增一個 IDE 磁碟並掛載在 Primary Channel 的 IDE 0 上
開機進系統, 讓系統自己去抓硬體, 裝上驅動, 並確認有抓到那顆磁碟
這樣就好, 不要對磁碟進行初始化等作業, 只要確認有抓到那顆 IDE 磁碟, 就關機
然後立刻進行移植作業
在新增 IDE 硬碟這個步驟的實作上完全辦不到
因為不知何故, 轉好的 VM 在新增磁碟時完全不給選 IDE 介面
變通的辦法是轉好後, 另外 New 一個 VM
先配置 IDE 硬碟, 再將轉好的 vmdk 掛在 SCSI 介面上
然後進 VM 的 BIOS 調整開機順序用 SCSI Disk 開機
接著進行上述的後續動作
然而, 在移植後開機, 仍然是相同的 BSoD 訊息
步驟二:
在這篇文章裡提到 
The differencs is not inherant in the VHD itself, the difference is inhearnt in the virtual interface that the VHD is presented to the VM on.
Due to the presentation of a boot fvolume on a SCSI interface, the installation binds to that interface (bus, posistion on bus, etc.).  How the OS of the VM deals with this changing depends on the OS.  
You have Server 2000 - it does not like hardware change, and that is what yo are attempting to do to it.
Hyper-V VMs only boot from an IDE presented virtual disk - so you are stuck there.
I happen to know of one little trick (only becuase I was involved in it) - it should work with Server 2000.IF you download Citrix Kensho OVF Tool and install it *(not in the VM, just somewhere to get to an item in the package) - under the program directory is a folder called "External Tools" - in there is an ISO called "linux -fixup-iso"
Take this ISO and attach it to the VM that you created on your HYper-V host (the copy of course, not the origional) and configure the BIOS to boot to this ISO.  Allow the ISO to run and extract and replace the critical boot device driver.Watch the console if you like, it will shutdown when finished.
then detach the ISO and try booting the VM and see what happens.
但是很可惜的已經找不到他文中說的 Citrix Kensho OVF Tool
在更下面其他人的回覆也證明了這一點, 並且提供了新版本的 Tool
Citrix integrated it into XenCenter which is included in XenServer. I registered for a mycitrix account and downloaded version XenServer-5.6.100-SP2-install-cd-cnetB.iso. Then I mounted the iso and ran XenCenter.msi. Once that's installed go to C:\Program Files (x86)\Citrix\XenCenter\Plugins\Citrix\XenAppliance\External Tools and there is the xenserver-linuxfixup-disk.iso.
I followed BrianEh's instructions (just mount it to vm and boot it. Disk needs to be attached to IDE controller. it runs and does the magic and then shuts the machine down). I booted the "fixed" disk up and it worked great!
經過 Google 後, 在這裡找到了他提到的工具
如果這個連結失效了的話, 我將實際需要用到的 xenserver-linuxfixup-disk.iso
放到我的 Google Drive 上提供給需要的人下載, 網址如下:
https://drive.google.com/file/d/0B4b-mqX7iLA6akhZcHZoeXE5ams
 
取得的檔案檔名為: xenserver-linuxfixup-disk.iso
完成步驟一後, 掛載到 Hyper-V 上並用這個 iso 檔開機
讓他全自動跑, 過程中可能會有長時間沒有進度顯示, 是正常的, 要有耐心
大約跑 20 分鐘之後就會自動關機
然而, 在移植後開機, 仍然是相同的 BSoD 訊息
步驟三:
這篇文章提到要修改註冊機碼, 並且有提供要修改的步驟及 reg 內容供下載
由於 reg 檔案內容不少, 就不節錄了, 如果未來有一天這個網址失效了
可以試試看用這段關鍵字去 Google看看還有沒有得找:
HowTo patch a windows 2000 or XP registry of a random Harddisk to be able to start on a different Computer
我將內文全文節錄在文末
然而, 在移植後開機, 仍然是相同的 BSoD 訊息
步驟四:
覺得很有可能步驟一後直接步驟四就可以成功開機了
但因為在進行步驟二、步驟三之後接連進行步驟四就成功開機
也就不想再還原回去步驟一的狀態重來一次實驗了
這個步驟是 在這篇文章 中提到,由於 Windows 2000 支援 LBA 但是預設沒開
所以磁碟只能認得 128GB (既然支援為什麼預設不開? 那先前為什麼可以讀到? 謎...)
必須修改註冊機碼使其認得大於 128GB 的磁碟才能開機
操作辦法要參考步驟三, 先將轉好的 VHD 檔掛載起來接著開啟 Registry Editor, 點選 [HKEY_LOCAL_MACHINE]
點選左上角的 File -> [Load hive]
接著瀏覽到 VHD 掛載起來的磁碟機代號:\winnt\system32\config
將 system 這個檔案讀進來, 給他一個隨便的名字比如 "aaaa"
如此就會將那台 Windows 2000 的 HKEY_LOCAL_MACHINE 註冊機碼掛起來可以修改了
找到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\atapi\Parameters
新增一個 DWORD, 名稱為 [EnableBigLba] , 值為 1
接著再點選左上角的 File -> [Unload hive]
然後把 VHD 卸載, 接著開機
就能進入系統了!!

步驟三參考文獻:

HowTo patch a windows 2000 or XP registry of a random Harddisk to be able to start on a different Computer, even if you dont have the original
machine at hand:



It is a well known problem, that XP and Windows 2000 will refuse to start if you move a harddisk containing a system to a different motherboard.
Since the harddisk controller is different, a message like:


STOP: 0x0000007B (0xF741B84C,0xC0000034,0x00000000,0x00000000)
INACCESSIBLE_BOOT_DEVICE



will appear on the screen and the start is aborted.
Microsoft knowledgebase article 314082 explains how to fix this problem.

However what they dont tell, is what to do If you dont have the original computer or motherboard any more.

This happens rather often, so I decided to publish a step by step HowTo for fixing this problem.



The following procedure is tested on a windows 2000 and a windows XP system using an IDE drive. However, I give no warranty what it will do
to your computer or if it simply does not work in your case.
SCSI drives should work similar, but you have to create the registry patch file
yourself. The one from here only supports IDE drives:



    Prerequisites:
  • A running system with Windows 2000 or XP
  • a file availible from here.

  • What you have to do:
  • Attach the disk from the unknown system to your computer as the second disk:
  • Attach the unknown disk as a slave HD
  • Startup your computer using your operating system

  • Read the Microsoft knowledgebase article ( see link above ):
  • if neccessary copy the needed drivers to the proper location of the target disk

  • Make a backup of the %SystemRoot%\System32\config folder:
  • in case you do something wrong, it is better to backup this directory, then you will be able to try again or restore the system to the previous state

  • Use the registry editor:
  • Open the registry editor (regedt32 on windows 2000, regedit on windows XP)
  • With the mouse, mark the "HKEY_LOCAL_MACHINE"
  • goto the "Registry"-menu, choose "load hive"
  • navigate to the "%SystemRoot%\System32\config" folder on the secondary drive (\winnt\system32\config on w2k, \windows\system32\config on windows XP )
  • open the "system" file
  • When asked for a name, give it the name "aaaa" (this is important, since it must match the file you downloaded from here !)
  • Close the registry editor
  • double click the expanded file you got from this page. Note, you have two choices: mergeide.reg or mergeide1.reg. The difference is
    that the mergide1.reg does not contain the entries for the drivers. Most of the time, they are present anyway. It is probably safer first to try this
    version. If mergeide1.reg does not work, do the procedure again and use the mergide.reg file. Confirm the question to add the file to the Windows
    registry.
  • now, open the registry editor again and look for the "aaaa" tree in the HKEY_LOCAL_MACHINE directory
  • mark it and from the "Registry"-menu, choose "unload hive" ( this is important, do not forget it ! )
  • close the registry editor

  • You are done. Shutdown the computer and try to startup from the disk which did refuse to load the system.

沒有留言: