nbdkit is a liberally licensed NBD (Network Block Device) server designed to let you connect all sorts of crazy disk images sources (like Amazon, Glance, VMware VDDK) to the universal network protocol for sharing disk images: NBD.
New in nbdkit 1.1.8: cURL support. This lets you turn any HTTP, FTP, TFTP or SSH server that hosts a disk image into an NBD server.
For example:
$ nbdkit -r curl url=http://onuma/scratch/boot.iso
and then you can read the disk image using guestfish, qemu or any other nbd client:
$ guestfish --ro -a nbd://localhost -i Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell /dev/sda mounted on / ><fs> _
If you are using a normal SSH server like OpenSSH which supports the SSH File Transfer Protocol (aka SFTP), then you can use SFTP to access images:
$ nbdkit -r curl url=sftp://rjones@localhost/~/fedora-20.img
I’m hoping to enable write support in a future version.
It doesn’t work at the moment because I haven’t worked out how to switch between read (GET) and write (POST) requests in a single cURL handle. Perhaps I need to use two handles? The documentation is confusing.
hello,
Can you add a new pluggin as nbd client. With this pluggin, we can chain multiple nbdkit server as proxy. Now we must use nbdclient and loop device as intermediate.
Regards
nbdkit is just an NBD server, not a client.
Pingback: nbdkit tar filter | Richard WM Jones
Hi! thanks for the post, Richard! I got a question, I can connect to connect to the HTTP server, but when I attempt to write, it complains about it is connected as read-only, I guess some HTTP headers in the response are missing. Do you have in hand the specs for the server to return the right HTTP headers for read-write mode? Thank you in advance!
Assuming you don’t have the
-r
option which forces read-only mode, it ought to just work. However you would need to have a server which supports PUT + Range and does the right thing, which is quite unusual. Also this path is hardly tested so you might be hitting a real bug. I’d take a look at: https://gitlab.com/nbdkit/nbdkit/-/blob/master/plugins/curl/curl.c#L743 The code’s not too difficult to understand if you read the curl docs.