tchajed / rust-nbd

Network Block Device (NBD) server and client written in Rust
MIT License
9 stars 0 forks source link

Failed attempts on macOS #1

Open Asc2011 opened 4 hours ago

Asc2011 commented 4 hours ago

Hi, i tried two read-only files from a qcow2-formatted QEMU-file.

(1) tried your server component :: ./server --size 1000 /Volumes/backup/Downloads/qemu/raspios-bookworm-armhf-lite.img Since on OSX i can't sudo modprobe nbd or i don't know what to do instead - since you mention that your server runs on macOS (true) and your client can connect to it (great, but how ? Pls provide a example).

(2) tried the qemu-nbd-server to provide the image via a file-socket (qemu-nbd -c on macOS does not support /dev/nbd), so i tried :: qemu-nbd --fork --persistent --shared=5 --socket=/Users/asc/sock --read-only --format=qcow2 /Volumes/backup/Downloads/qemu/rpi/bookworm.qcow2

Both did not work. I could try to convert the image into the vmpk-format and then mount/access it using maybe VMWare or VirtualBox. Any ideas what i'm missing here ?

regards, Andreas

tchajed commented 3 hours ago

This project is intended more as a demo of nbd than anything else, so I'm not sure it will help you.

As far as (1) goes, the README might be a bit misleading. There is no kernel support for nbd on macOS, which is what the client binary needs to work. What you should be able to do (but there are no examples or even tests in this project) is run the server and write a Rust program that interacts with it from userspace. This doesn't create a block device - it just gives you a Rust struct Client whose methods interact with the server. I can't think of a good reason to do this other than to test the client and server.

I've never used qemu-nbd but it also can't provide a block device on macOS because there's simply no kernel feature for it.