View on GitHub

Nbd

Network Block Device

Download this project as a .zip file Download this project as a tar.gz file

Network Block Device (TCP version)

What is it: With this compiled into your kernel, Linux can use a remote server as one of its block devices. Every time the client computer wants to read /dev/nbd0, it will send a request to the server via TCP, which will reply with the data requested. This can be used for stations with low disk space (or even diskless - if you use an initrd) to borrow disk space from other computers. Unlike NFS, it is possible to put any file system on it. But (also unlike NFS), if someone has mounted NBD read/write, you must assure that no one else will have it mounted.

Current state: It currently works. Network block device is pretty stable. It was originally thought that it is impossible to swap over TCP; this turned out not to be true. However, to avoid deadlocks, you will need at least Linux 3.6.

It is possible to use NBD as the block device counterpart of FUSE, to implement the block device's reads and writes in user space. To make this easer, recent versions of NBD (3.10 and above) implement NBD over a Unix Domain Socket, too.

If you're interested in the technical side of how NBD works, please see the protocol documentation.

Comments and help about the tools is always appreciated; if you're willing to help out, please subscribe to the mailing-list, and share your thoughts.

Links

NBD on other platforms

Besides Linux, the authors have knowledge of NBD client support on the following platforms:

The server should theoretically work on every POSIX-compliant platform out there (provided glib is supported on that platform). If it doesn't, that's a bug and I want to know about it; if you encounter such problems, please send a mail to the mailinglist.