Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NBD Attached drives as macOS boot drive #790

Open
DrDonk opened this issue Apr 14, 2024 · 2 comments
Open

NBD Attached drives as macOS boot drive #790

DrDonk opened this issue Apr 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@DrDonk
Copy link

DrDonk commented Apr 14, 2024

There was a recent change to tart to allow NBD drives to be used as extra drives on the tart run command. #759

This is a great start but you can also use NBD attached drives for the actual macOS boot drive. Can this be added to tart as would be a distinguishing feature that would allow macOS images to be stored both on NAS and also in other virtual disk formats such as QCOW2 or VMDK without the issues of copying sparse files to a non-APFS volume?

I have personally tested it with the Go language bindings test app which demonstrates that you can indeed use a NBD drive instead of the sparse file used as the disk image currently supported. Both creation of the VM from the IPSW and booting the installed macOS works flawlessly with the NBD attached drive.

The sample code is in a PR on the vz GitHub repo. Code-Hex/vz#156

@fkorotkov
Copy link
Contributor

Can you elaborate how you tested it? How do you run an NBD server? Have you checked IO performance in such setup?

@fkorotkov fkorotkov added the enhancement New feature or request label Apr 15, 2024
@DrDonk
Copy link
Author

DrDonk commented Apr 15, 2024

Check the PR for vz I linked to for details (Code-Hex/vz#156), but I applied this PR to the vz code base. I then created a blank QCOW2 60G image using qemu-img:

qemu-img create -f qcow2 -p macos.qcow2 60G

and mounted it with:

qemu-nbd -k $(pwd)/source.sock -f qcow2 -x export --cache=none macos.qcow2

Then using the compiled vz code incorporating the PR, installed macOS Sonoma and then ran the installed macOS.

I can provide you with a compiled executable with the incorporated code and some more detailed instructions if you would like me to.

I haven't done any benchmarking but can do so if you are interested. For me the big benefit is it's a more traditional VM disk format, which could also mean ability to do things such as snapshots.

I need to also raise a new issue as the new tart code for NBD only has one URL scheme and there are several different ones. Specifically nbd+unix would be needed for this functionality to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants