Create a template VM and Create a new VM from template VM


Create a template VM and Create a new VM from template VM

建立範本虛擬機器,透過範本虛擬機器來建立新的虛擬機器


1.Create a template VM (建立一個範本VM)
Install guest OS, enable roles and features and then apply the needed Windows patches and hotfix.

2.Run SYSPREP (執行Sysprep工具)
Login VM, then run SYSPREP
%windir%\system32\sysprep\sysprep.exe
(Enter system out-of-box experience, enable generalize, shutdown option: shutdown)

Sysprep (System Preparation) Overview
https://technet.microsoft.com/en-us/library/hh825209.aspx

3.export the template VM(匯出將範本VM)

匯出範本VM到指定的目錄。

PS.匯出後此範本VM可以刪除。

4.Create a new VM from template VM. (從範本VM來建立一個新的VM)
(1)copy the VHD(virtual hard drive) file from exported VM folder to new VM Folder.

到匯出的VM目錄下將VHD檔案複製出來。
(2)Create a new VM per the usual steps and attach the copied VHD(x) to it.
select [Use an exist virtual disk] or [Attach a virtual virtual disk]

建立新的VM時,選擇使用已經存在的虛擬磁碟,也就是剛剛複製出來的VHD檔

 

差異虛擬磁碟: Differencing Disks

如果想節省磁碟空間,可以使用差異虛擬磁碟

透過一個父系磁碟來建置許多個不同的差異磁碟

(注意:父系磁碟在建立後就不能作變更及開啟使用,否則連結在父系磁碟的差異磁碟運作會異常)

此功能如同VMware workstation的 link to Clone VM

設定方法,參考下面這篇

Use Hyper-V differencing disks

Reference:
How to create a Hyper-V VM template
https://hyperv.veeam.com/blog/how-to-create-hyper-v-vm-template/

How to create a Hyper-V VM template without VMM
http://www.oxfordsbsguy.com/2014/06/02/how-to-create-a-hyper-v-vm-template-without-vmm/

Hyper-V Virtual Machine (VM) Parent-Child Configuration Using Differencing Disks
https://social.technet.microsoft.com/wiki/contents/articles/1393.hyper-v-virtual-machine-vm-parent-child-configuration-using-differencing-disks.aspx

Comments (0)

Skip to main content