Network block device
Encyclopedia
In Linux
, a network block device is a device node whose content is provided by a remote machine. Typically, network block devices are used to access a storage device that does not physically reside in the local machine but on a remote one. As an example, the local machine can access a fixed disk that is attached to another computer.
On the server machine, requests from the client are handled by a userspace program called
On ComputerA:
nbd-server 2000 /tmp/xxx
On ComputerB:
modprobe nbd
nbd-client ComputerA 2000 /dev/nbd0
The file is now accessible on ComputerB as device
, it could be mounted for example via
The command
In this example, 2000 is the number of the server port through the file is made accessible. Any available port could be used.
and GNU Hurd
.
Since the server is a userspace program, it can potentially run on every Unix-like
platform. It is known to have been ported to Solaris http://www.fi.muni.cz/~kripac/orac-nbd/.
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
, a network block device is a device node whose content is provided by a remote machine. Typically, network block devices are used to access a storage device that does not physically reside in the local machine but on a remote one. As an example, the local machine can access a fixed disk that is attached to another computer.
Kernel client/userspace server
Technically, a network block device is realized by two components. In the client machine, where the device node is to work, a kernel module namednbd
controls the device. Whenever a program tries to access the device, this kernel module forwards the request to the server machine, where the data physically resides.On the server machine, requests from the client are handled by a userspace program called
nbd-server
. This program is not implemented as a kernel module because all it has to do is to serve network requests, which in turn just requires regular access to the server filesystem.Example
If the file/tmp/xxx
on ComputerA has to be made accessible on ComputerB, one performs the following steps:On ComputerA:
nbd-server 2000 /tmp/xxx
On ComputerB:
modprobe nbd
nbd-client ComputerA 2000 /dev/nbd0
The file is now accessible on ComputerB as device
/dev/nbd0
. If the original file was for example a disk imageDisk image
A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive, floppy disk, CD/DVD/BD, or USB flash drive, although an image of an optical disc may be referred to as an optical disc image...
, it could be mounted for example via
mount /dev/nbd0 /mnt/whatever
.The command
modprobe nbd
is not necessary if module loading is done automatically. Once the module is in the kernel, nbd-client
is used to send commands to it, such as associating a given remote file to a given local nb device. To finish using /dev/nbd0
, that is, to destroy its association with the file on other computer, one can run nbd-client -d /dev/nbd0
on ComputerB.In this example, 2000 is the number of the server port through the file is made accessible. Any available port could be used.
Availability
The network block device client module is available on LinuxLinux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
and GNU Hurd
GNU Hurd
GNU Hurd is a free software Unix-like replacement for the Unix kernel, released under the GNU General Public License. It has been under development since 1990 by the GNU Project of the Free Software Foundation...
.
Since the server is a userspace program, it can potentially run on every Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
platform. It is known to have been ported to Solaris http://www.fi.muni.cz/~kripac/orac-nbd/.
See also
- Loop deviceLoop deviceIn Unix-like operating systems, a loop device, vnd , or lofi is a pseudo-device that makes a file accessible as a block device....
: a similar mechanism, but uses a local file instead of a remote one - DRBDDRBDDRBD is a distributed storage system for the GNU/Linux platform. It consists of a kernel module, several userspace management applications and some shell scripts and is normally used on high availability clusters...
: Distributed Replicated Block Device is a distributed storage system for the Linux platform
External links
- Network Block Device on SourceforgeSourceForgeSourceForge Enterprise Edition is a collaborative revision control and software development management system. It provides a front-end to a range of software development lifecycle services and integrates with a number of free software / open source software applications .While originally itself...
- The Network Block Device, the Linux Journal
- ggate in FreeBSD handbook, FreeBSD GEOM Gate presentation
- Enhanced Network Block Device