简体   繁体   中英

how to differentiate between GPT dynamic and GPT basic disk in a virtual machine programatically

Recently I had to find out a way to differentiate what partition type the virtual machine used,Reading the raw data from the virtual disk I was able to find it by checking with offset 1C2 (EE in case of GPT), in case of MBR disk if the disk is dynamic the offset at 1C2 had 42 and in case of basic disk the same 1C2 offset had 07 which means basic disk , now If it is a GPT disk how do I differentiate between basic and dynamic disks.

Thanks in Advance.

While iterating the GPT partition table entries for a GPT disk, search for an entry with "Partition type GUID" set to 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3 and the corresponding hidden "attribute" (bit 62) for this entry should be set. This PTE would be for the LDM database. Besides this, there should be one more partition table entry for LDM itself. So in all, there'd be 2 partition table entries for this scenario, one for LDM database (hidden partition) and the other of LDM.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM