รู้จักกับ File ต่างๆ ของ Hyper-V

เรามาทำความรู้จัดกับ File ต่างๆ ของ Hyper-V เพื่อใช้วางแผนการเตรียม Hard Disk / Storage ได้ถูกต้องกับงาน Hyper-V จะ สร้างไฟล์ของแต่ละ virtual machine เพื่อเป็นส่วนประกอบในการใช้งาน VM ดูสรุปจากตารางนี้

File Extension

คำอธิบาย

.vhd Virtual Hard Disk
.avhd File นี้เกิดขึ้นหลังจากทำ snapshot การใช้งานระบบจะใช้คู่กับ .vhd
<GUID>.xml เป็น file ประจำตัวของ virtual machine แต่ละตัว ใช้เก็บคุณสมบัติทั้งหมดของเครื่อง VM เช่น CPU, RAM, ชื่อ file virtual hard disk เป็นต้น
<Snapshot GUID>.xml เมื่อสร้าง snapshot ระบบก็จะสร้าง file ขึ้นมาใหม่ทุกครั้ง เพราะ snapshot เป็นการ save version ของข้อมูลและรวมถึง VM configuration ด้วย
.bin File นี้จะถูกสร้างเมื่อสั่ง save state ระบบจะนำข้อมูลใน RAM มาบันทึกลง .bin
.vsv ใข้เก็บสถานะของเครื่องก่อนทำการ save state เพื่อรอการ resume
InitialStore.xml The initial store contains the security permissions for Hyper-V’s
Authorization Manager (azman). This is an xml file located in
%systemdrive%\ProgramData\Microsoft\Windows\Hyper-V\.You would only need to perform a restore if this xml file becomes corrupt or is deleted somehow.Backing up virtual machines and the initial store are independent of each other. You only need to back up the initial store if you are using the Authorization Manager in Hyper-V and don’t want to lose your settings.

Folder ที่เก็บ file ของ VM

หลักของการเก็บ File ใน Hyper-V มีการแบ่งดังนี้

  • Virtual machine data root เป็นที่เก็บ configuration file ของ virtual machine และ saved state (.BIN และ .VSV)
  • Virtual machine snapshot root เป็นที่เก็บ snapshot file

Snapshot

Snapshots คือ การบันทึกสถานะของ VM ในเวลาที่เราต้องการเพื่อเก็บไว้ใช้ในโอกาสที่ต้องถอยกลับมา การสร้าง snapshot ทำได้ทั้งตอนที่กำลังใช้งานอยู่ (Power-ON/Running) หรือตอนที่เครื่อง VM ปิดอยู่ (Power-Off) การสร้าง snapshot ระบบจะสร้าง file 3 ส่วนดังนี้
1. Memory save state file (.vsv และ .bin)
2. Difference disk (.avhd) –
3. Copy of configuration file (.xml)

การจัดการ Snapshot

ปกติเราควรมี snapshot น้อยๆ version

1. สร้าง snapshot

2. การนำ snapshot กลับมาใช้งาน

3. การลบ snapshot

Saved State vs. Pause

  • การทำ save state เป็นการหยุดการทำงานของ VM โดยจดจำสถานะก่อนที่จะหยุดไว้ด้วยการบันทึกสถานะต่างๆ ทั้งใน CPU และ RAM ลงใน file (.bin และ .vsv) แล้วคืน CPU กับ RAM ให้ Host
  • การ Pause ก็เป็นการ Freeze หรือจำสถานะของ VM ณ.ขณะนั้นไว้ก่อน ไม่ได้มีการคืน Memory ของ VM แต่มีการคืนเฉพาะ CPU
  • มีคนเปรียบเทียบว่า save state คือ hibernate ส่วน pause คือ sleep บน Windows ในแบบที่เราคุ้นเคยมาแล้ว

File and Folder Permission

การทำงานของ Hyper-V ใช้สิทธิของ System User เราไม่ต้องสร้าง Service Account ตรงนี้เป็น Feature ที่เริ่มใน Windows Server 2008 เรียกวา Service SIDs

ใน Hyper-V เจ้าตัว SID เป็นการรวมกันระหว่าง Service SID คือ “NT VIRTUAL MACHINE” กับ VM GUID ต่อไปลองดูจะเห็นสิทธินี้ได้อย่างไร

1. หา GUID ของ VM ด้วย PowerShell ( Logon เข้า Hyper-V host เข้าไป command line เป็น admin แล้วพิมพ์ powershell กด enter แล้วพิมพ์สีน้ำเงินนี้ลงไป)

PS C:\Windows\system32> Get-WmiObject “MSVM_ComputerSystem” -namespace “root\virtualization” -computername “.”|Select-Object  ElementName,name |Sort-object ElementNameElementName                             name
———–                             —-
ROSE                          ROSE
BackupDC                      CA09A4A1-3F6F-4CAF-8924-93E14C41606D
SCCM2012                      8A62F92B-E0C8-4339-AF08-992FAE40C4E7
SCOM2012                      31A18A22-2FBC-47E0-9426-6F6046FAC1EE
SQL2012                       203C3003-3A17-4397-8186-37F5624761DE

2. ไปหาว่าเครื่องเราเก็บ Machine Config ไว้ที่ไหน แบบง่ายก็ดูจาก Property ของ Hyper-V Setting จากหน้าจอ Hyper-V Manager ก็ได้ เราจะเป็นสิทธิตามภาพด้านล่าง

image

References

1.Understanding where your virtual machine files are [Hyper-V] (http://blogs.msdn.com/b/virtual_pc_guy/archive/2010/03/10/understanding-where-your-virtual-machine-files-are-hyper-v.aspx)
2. Getting Started with Microsoft Hyper-V(http://blogs.msdn.com/b/wslogo/archive/2008/06/18/getting-started-with-microsoft-hyper-v.aspx)
3.Understanding Hyper-v Files (.xml, .bin, .vsv, .vhd, .avhd)(http://www.navran.co.uk/blog/category/hyper-v/)
4. Understanding where your virtual machine files are [Hyper-V](http://blogs.msdn.com/b/virtual_pc_guy/archive/2010/03/10/understanding-where-your-virtual-machine-files-are-hyper-v.aspx)
5. Hyper-V File Storage and Permissions (http://www.virtualizationadmin.com/articles-tutorials/microsoft-hyper-v-articles/storage-management/hyper-v-file-storage-permissions.html)

6. Test Snapshots, Pausing, and Saving (http://technet.microsoft.com/en-us/library/ee247418(WS.10).aspx)

7.What is the difference between Hyper-V Manager Save and Pause? (http://weblogs.asp.net/jeffwids/archive/2010/01/08/what-is-the-difference-between-hyper-v-manager-save-and-pause.aspx)

8. Hyper-V Virtual Machine Snapshots: FAQ (http://technet.microsoft.com/en-us/library/dd560637(WS.10).aspx)

9. Manually Merging Hyper-V Snapshots (http://www.virtualizationadmin.com/kbase/VirtualizationTips/ServerVirtualization/MicrosoftHyper-VR2Tips/General/ManuallyMergingHyper-VSnapshots.html)

10. Hyper-V pass-through disk performance vs. fixed size VHD files and dynamic VHD files in Windows Server 2008 R2

11.

Virtual Machine Configuration (http://www.virtualizationadmin.com/articles-tutorials/microsoft-hyper-v-articles/general/windows-server-2008-hyper-v-virtual-machine-configuration.html)

12. What is Initial Store? (http://scdpm2010.wordpress.com/2011/01/06/what-is-initial-store/)

13. Howto manually add a VM Configuration to Hyper-V (http://blogs.msdn.com/b/robertvi/archive/2008/12/19/howto-manually-add-a-vm-configuration-to-hyper-v.aspx)

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s