blob: 916b9a15c061c49d9ce9bb05b306c258e735cb4f (
plain)
1 (Partially taken from the nbd-source)
2
3 You have to have support for CONFIG_BLK_DEV_NBD in your kernel.
4
5 Since there's a problem with nbd and the cfq I/O scheduler,
6 you may want to set it to deadline:
7
8 echo 'deadline' > /sys/block/nbd0/queue/scheduler
9
10 (repeat the above for nbd1, nbd2, etc, if you need more than one device)
11
12 Next, start the server. You can use a file or a block device for that, e.g.
13
14 nbd-server 1234 /home/wouter/nbd-export
15
16 Note that the filename must be an absolute path; i.e., something like
17 /path/to/file, not ../file. See the nbd-server manpage for details on
18 any available options.
19
20 Finally, you'll be able to start the client, e.g.
21
22 nbd-client 10.0.0.1 1234 /dev/nb0
23
24 nbd-client must be ran as root; the same is not true for nbd-server (but
25 do make sure that /var/run is writeable by the server that nbd-server
26 runs as; otherwise, you won't get a PID file, though the server will
27 keep running).
28
29 nbd-server can be configured by modifying
30 /etc/nbd-server/config, and should look something like this:
31
32 # This is a comment
33 [generic]
34 # The [generic] section is required, even if nothing is specified
35 # there.
36 # When either of these options are specified, nbd-server drops
37 # privileges to the given user and group after opening ports, but
38 # _before_ opening files.
39 user = nbd
40 group = nbd
41 [export1]
42 exportname = /export/nbd/export1-file
43 port = 12345
44 authfile = /export/nbd/export1-authfile
45 timeout = 30
46 filesize = 10000000
47 readonly = false
48 multifile = false
49 copyonwrite = false
50 prerun = dd if=/dev/zero of=%s bs=1k count=500
51 postrun = rm -f %s
52 [otherexport]
53 exportname = /export/nbd/experiment
54 port = 12346
55 # The other options are all optional.
56
57 extended documentation can be found in nbd-server(5)
|