Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
f4c39f4b
Commit
f4c39f4b
authored
Jul 10, 2003
by
Andrew Morton
Committed by
Linus Torvalds
Jul 10, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] NBD documentation update
From: Paul Clements <Paul.Clements@SteelEye.com> Modernise nbd.txt a bit.
parent
d7b92e1d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
53 deletions
+43
-53
Documentation/nbd.txt
Documentation/nbd.txt
+43
-53
No files found.
Documentation/nbd.txt
View file @
f4c39f4b
Network Block Device (TCP version)
Network Block Device (TCP version)
Note: Network Block Device is now experimental, which approximately
What is it: With this compiled in the kernel (or as a module), Linux
means, that it works on my computer, and it worked on one of school
can use a remote server as one of its block devices. So every time
computers.
the client computer wants to read, e.g., /dev/nb0, it sends a
request over TCP to the server, which will reply with the data read.
What is it: With this compiled in the kernel, Linux can use a remote
This can be used for stations with low disk space (or even diskless -
server as one of its block devices. So every time the client computer
if you boot from floppy) to borrow disk space from another computer.
wants to read /dev/nd0, it sends a request over TCP to the server, which
Unlike NFS, it is possible to put any filesystem on it, etc. It should
will reply with the data read. This can be used for stations with
even be possible to use NBD as a root filesystem (I've never tried),
low disk space (or even diskless - if you boot from floppy) to
but it requires a user-level program to be in the initrd to start.
borrow disk space from another computer. Unlike NFS, it is possible to
It also allows you to run block-device in user land (making server
put any filesystem on it etc. It is impossible to use NBD as a root
and client physically the same computer, communicating using loopback).
filesystem, since it requires a user-level program to start. It also
allows you to run block-device in user land (making server and client
Current state: It currently works. Network block device is stable.
physically the same computer, communicating using loopback).
I originally thought that it was impossible to swap over TCP. It
turned out not to be true - swapping over TCP now works and seems
Current state: It currently works. Network block device looks like
to be deadlock-free, but it requires heavy patches into Linux's
being pretty stable. I originally thought that it is impossible to swap
network layer.
over TCP. It turned out not to be true - swapping over TCP now works
and seems to be deadlock-free, but it requires heavy patches into
For more information, or to download the nbd-client and nbd-server
Linux's network layer.
tools, go to http://nbd.sf.net/.
Devices: Network block device uses major 43, minors 0..n (where n is
Howto: To setup nbd, you can simply do the following:
configurable in nbd.h). Create these files by mknod when needed. After
that, your ls -l /dev/ should look like:
First, serve a device or file from a remote server:
brw-rw-rw- 1 root root 43, 0 Apr 11 00:28 nd0
nbd-server <port-number> <device-or-file-to-serve-to-client>
brw-rw-rw- 1 root root 43, 1 Apr 11 00:28 nd1
...
e.g.,
root@server1 # nbd-server 1234 /dev/sdb1
Protocol: Userland program passes file handle with connected TCP
socket to actual kernel driver. This way, the kernel does not have to
(serves sdb1 partition on TCP port 1234)
care about connecting etc. Protocol is rather simple: If the driver is
asked to read from block device, it sends packet of following form
Then, on the local (client) system:
"request" (all data are in network byte order):
nbd-client <server-name-or-IP> <server-port-number> /dev/nb[0-n]
__u32 magic; must be equal to 0x12560953
__u32 from; position in bytes to read from / write at
e.g.,
__u32 len; number of bytes to be read / written
root@client1 # nbd-client server1 1234 /dev/nb0
__u64 handle; handle of operation
__u32 type; 0 = read
(creates the nb0 device on client1)
1 = write
... in case of write operation, this is
The nbd kernel module need only be installed on the client
immediately followed len bytes of data
system, as the nbd-server is completely in userspace. In fact,
the nbd-server has been successfully ported to other operating
When operation is completed, server responds with packet of following
systems, including Windows.
structure "reply":
__u32 magic; must be equal to
__u64 handle; handle copied from request
__u32 error; 0 = operation completed successfully,
else error code
... in case of read operation with no error,
this is immediately followed len bytes of data
For more information, look at http://nbd.sf.net/.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment