You are not logged in.

#1 2016-01-14 22:04:44

nesk
Member
Registered: 2011-03-31
Posts: 187

Need advice on simulating virtual disk with GPT from real partition

Hello,
I'm on dual-boot Windows 7 / Arch on a UEFI computer with GPT SSD and I want Qemu to have access to a physical Windows partition.
This would be exactly what I need, but for the MBR. Couldn't find any GPT examples of this on the net. If anyone have done this or has bright ideas - please post here, I'll try it (if it looks reasonably low-risk) and post instructions on wiki.
I got as far as creating linear RAID (/dev/md0) from (1) empty 16384 bytes file mounted to /dev/loop0 and (2) unmounted partition with Windows installation. Now the following things are unclear:

  • Will 16384 bytes be enough for GPT header? If I create new GPT on /dev/md0 with gdisk - is there a chance it will take more than that, thus writing into Windows partition and breaking it? EFI spec states that 16384 bytes is a minimal size for GPT header

  • From what I gathered, mdadm doesn't care if partitions on the linear raid are MBR, GPT, or a mix - is that correct?

  • To be safe, is it possible to have either kernel or mdadm treat Windows partition readonly? Would removing write rights on /dev/sdaX do that (it's a "block special" file)? What about mdadm - --readonly seems to apply to resulting /dev/md0, not its parts. After setting up /dev/md0 I plan to use it as a backing image to a differencing qcow2 file (again, to access Windows partition only for reading, not writing).

  • I will also need to throw 100mb EFI partition in between GPT header and Windows partition. Looks like it's just a matter of creating a 101Mb file with zeroes, creating /dev/md0 from 3 parts instead of 2 and letting GPT inside /dev/md0 know about this, right? Or can EFI partition even come after Windows one?

Offline

Board footer

Powered by FluxBB