Closed sonoseco closed 4 years ago
qemu-img create -f qcow2 foobar.qcow2 100M
# modprobe nbd
qemu-nbd --connect=/dev/nbd0 foobar.qcow2
# TODO: format your disk in GUID.
mount /dev/nbd0p1 /mnt/efi
# then put the files from the EFI folder into /mnt/efi
Thanks! I will try this later, so far I've been using a regular USB drive connected directly to Unraid, that way I can also mount the EFI partition and upload/edit files and fire up the VM. All is working great except for the following:
Thank you for putting this together!
@sonoseco
But both features (Sidecar and Apple Watch Unlock) are available on the Mac Pro 2019, I am using that as my model (MacPro7,1). I was able to use the patch to skip the topology check, I was using and old version with different data values.
This is out of topic.I will close this issues now.
I'm adding the whole process to create and format the EFI partition:
Create a qcow2 image of 256 MB (from the linux host):
qemu-img create -f qcow2 /path/to/the/image/test.qcow2 256M
This will create a qcow2 image of 256 MB.
Enable NBD on the host and connect the qcow2 image as a network block device (from the linux host):
modprobe nbd max_part=8
qemu-nbd --connect=/dev/nbd0 /path/to/the/image/test.qcow2
Create EFI partition and format:
Create GPT (from the linux host):
gdisk
/dev/nbd0
w
y
Create EFI partition (from the linux host):
gdisk
/dev/nbd0
n
1
<press Enter to accept default value>
<press Enter to accept default value>
EF00
w
y
Format the EFI partition as FAT32 (from the linux host):
mkfs.fat -F 32 /dev/nbd0p1
Create a folder for the mount point (from the linux host):
mkdir /path/to/the/mount/point/
Mount the EFI partition (from the linux host):
mount /dev/nbd0p1 /path/to/the/mount/point/
Create the EFI folder on the mounted partition (from the linux host):
mkdir /path/to/the/mount/point/EFI/
Copy your EFI files in /path/to/the/mount/point/EFI/ (from the linux host):
cp -r /path/to/EFI/to/be/copied/EFI/* /path/to/the/mount/point/EFI/
Unmount the EFI partition (from the linux host):
umount /path/to/the/mount/point/
Disconnect nbd0 (from the linux host):
qemu-nbd --disconnect /dev/nbd0
rmmod nbd
(Optional) Rename the EFI partition from "NO NAME" to "EFI"
From the mac os virtual machine you can mount the new EFI partition and rename it with the command:
sudo diskutil rename /dev/disk0s1 "EFI"
where disk0s1 is the EFI partition.
@82ghost82 Can you please elaborate more on how to connect/mount an APFS partition with a macOS installed already (on the same SSD drive) from the host to KVM? I found it's kinda weird to create a huge .qcow2
and clone everything (~400GB). If I had two drives, I imagine that I could simply pass through the whole disk to the KVM but, in fact, I am not. Thanks in advance.
@sarkrui Passing through a disk to a vm has nothing to do with this topic: remind also that this is not a support forum, so please write your questions in the appropriate forums.
Not really an issue, I just can't find a way to convert the EFI folder to a qcow2 image. I am using macOS and so far I can only convert and use DMG and IMG files.