WikiStart

Version 7 (zitteret, 03/27/2006 05:41 pm)

1 5 zitteret
'''''This software is still beta - you use it at your own risk. Please create a ticket if you encounter bugs!'''''
2 4 zitteret
3 2 zitteret
= DNBD =
4 1
5 2 zitteret
== Introduction ==
6 1
7 2 zitteret
DNBD (Distributed Network Block Device) is a read-only and caching network
8 2 zitteret
block device and supports following main features:
9 2 zitteret
 * replication of servers for robustness
10 2 zitteret
 * multicast communication and caching of network traffic for scalability
11 1
12 2 zitteret
These characteristics make it suitable especially for use in wireless networks,
13 2 zitteret
e.g. for diskless clients or to share multimedia files in such an environment.
14 2 zitteret
The servers can export a file or block device equipped with a operating system,
15 2 zitteret
movies, music, etc. Several clients can import the block device and access it
16 2 zitteret
like a local hard disk. However, each block transfer over the network can be
17 2 zitteret
cached by all clients: If several users on each client start to watch a movie
18 2 zitteret
within a certain time interval, the movie data has to be transmitted only once
19 2 zitteret
(depending on the cache size). The network is not burdened with unnecessary
20 2 zitteret
traffic. 
21 1
22 2 zitteret
DNBD can be used together with [http://www.atconsultancy.nl/cowloop/ cowloop] or [http://www.fsl.cs.sunysb.edu/project-unionfs.html unionfs] in order to get local
23 2 zitteret
write semantics, e.g. for diskless clients. Especially in wireless environments
24 2 zitteret
with limited bandwidth, caching can increase boot-up time enormously.
25 1
26 7 zitteret
== Question, problems etc. ==
27 7 zitteret
28 7 zitteret
If you encounter any difficulties, please use search to find out if the problem is 
29 7 zitteret
already known. Also, the [wiki:FAQ FAQ] will contain typical problems.
30 7 zitteret
31 2 zitteret
== Download ==
32 1
33 2 zitteret
The source code can be retrieved from the subversion repository.
34 2 zitteret
{{{
35 2 zitteret
$ svn co http://lp-srv02a.ruf.uni-freiburg.de/svn/dnbd
36 2 zitteret
}}}
37 1
38 2 zitteret
== Compilation ==
39 1
40 2 zitteret
DNBD was developed for kernel 2.6.13 and later releases. Kernel 2.4 is not
41 2 zitteret
supported. The kernel sources and common tools (gcc, make, etc.) have to be
42 2 zitteret
installed.
43 1
44 2 zitteret
=== Server and Client ===
45 1
46 2 zitteret
Compiling:
47 2 zitteret
{{{
48 2 zitteret
$ cd dnbd; make
49 2 zitteret
}}}
50 1
51 2 zitteret
== USAGE ==
52 1
53 2 zitteret
=== Server ===
54 2 zitteret
55 2 zitteret
To show available command line parameters, start the server without
56 2 zitteret
arguments:
57 2 zitteret
58 2 zitteret
{{{
59 2 zitteret
$ ./server/dnbd-server
60 2 zitteret
dnbd-server, version 0.9.0
61 2 zitteret
Usage: dnbd-server -m <address> -d <device/file> -i <number> 
62 2 zitteret
                  [-t <threads>]
63 2 zitteret
64 2 zitteret
description:
65 2 zitteret
  -m|--mcast     <multicast address>
66 2 zitteret
  -d|--device    <block device or file>
67 2 zitteret
  -i|--id        <unique identification number>
68 2 zitteret
  -t|--threads   <number of threads>
69 2 zitteret
}}}
70 2 zitteret
71 2 zitteret
With the following command, the server will be started for the multicast
72 2 zitteret
network with address 239.0.0.1 and export the given file or block device.
73 2 zitteret
Its unique id is 1:
74 2 zitteret
{{{
75 2 zitteret
root@server1 $ ./server/dnbd-server -m 239.0.0.1 -d <partition/file> -i 1
76 2 zitteret
}}}
77 2 zitteret
To start a server on another computer, the used file or block device must have
78 2 zitteret
the same content and size as on the first server. However, the id has to be
79 2 zitteret
changed:
80 2 zitteret
{{{
81 2 zitteret
root@server2 $ ./server/dnbd-server -m 239.0.0.1 -d <partition/file> -i 2
82 2 zitteret
}}}
83 2 zitteret
If DNBD is used for wired networks and on multi-processor machines, the
84 2 zitteret
number of threads should be increased to the number of CPUs.
85 2 zitteret
86 2 zitteret
To access the exported file or block device, another computer is used as 
87 2 zitteret
client.
88 2 zitteret
89 2 zitteret
=== Client ===
90 2 zitteret
91 2 zitteret
The kernel module has to be loaded, before the client application can be used:
92 2 zitteret
{{{
93 2 zitteret
root@client1 $ insmod ./kernel/dnbd.ko
94 2 zitteret
}}}
95 2 zitteret
There should be an entry in syslog after successful loading. With no command
96 2 zitteret
line arguments the client gives available options:
97 2 zitteret
{{{
98 2 zitteret
root@client1 $ ./client/dnbd-client
99 2 zitteret
dnbd-client, version 0.9.0
100 2 zitteret
Usage: dnbd-client -d device -b <address> [-c <file>]
101 2 zitteret
    or dnbd-client -d device -u
102 2 zitteret
    or dnbd-client -d device -c <file>
103 2 zitteret
104 2 zitteret
description:
105 2 zitteret
  -d|--device    <device>
106 2 zitteret
  -b|--bind      <multicast-address>
107 2 zitteret
  -u|--unbind    
108 2 zitteret
  -c|--cache     <file>
109 2 zitteret
}}}
110 2 zitteret
We will now import the block device of the server, e.g.:
111 2 zitteret
{{{
112 2 zitteret
root@client1 $ ./client/dnbd-client -d /dev/dnbd0 -b 239.0.0.1
113 2 zitteret
}}}
114 2 zitteret
The client should tell you that it found a server with id "1". If you exported
115 2 zitteret
a CDROM with a movie, you can watch it on the client over the network, e.g.
116 2 zitteret
with mplayer (usually after mounting).
117 2 zitteret
118 2 zitteret
If someone else wants to watch the movie on a different client, you should
119 2 zitteret
enable caching either during operation
120 2 zitteret
{{{
121 2 zitteret
root@client1 $ ./client/dnbd-client -d /dev/dnbd0 -c <cachefile>
122 2 zitteret
}}}
123 2 zitteret
or at the beginning
124 2 zitteret
{{{
125 2 zitteret
root@client2 $ ./client/dnbd-client -d /dev/dnbd0 -b 239.0.0.1 -c <cachefile>
126 2 zitteret
}}}
127 2 zitteret
To create a cache with, e.g. 32M use
128 2 zitteret
{{{
129 2 zitteret
root@client1$ dd if=/dev/zero of=/tmp/cachefile bs=1M count=32
130 2 zitteret
}}}
131 2 zitteret
Cache statistics are shown with
132 2 zitteret
{{{
133 2 zitteret
root@client1$ cat /proc/driver/dnbd/dnbd0
134 2 zitteret
}}}
135 2 zitteret
The block device has to be unbound before the module can be unloaded:
136 2 zitteret
{{{
137 2 zitteret
root@client1 $ ./client/dnbd-client -d /dev/dnbd0 -u
138 2 zitteret
root@client1 $ rmmod dnbd
139 2 zitteret
}}}
140 2 zitteret
== Files ==
141 2 zitteret
142 2 zitteret
=== Client ===
143 2 zitteret
{{{
144 2 zitteret
./client
145 2 zitteret
   client.c		# client application
146 2 zitteret
}}}
147 2 zitteret
=== Server ===
148 2 zitteret
{{{
149 2 zitteret
./server
150 2 zitteret
   net.c		# network routines
151 2 zitteret
   query.c		# server request handling
152 2 zitteret
   filer.c		# file/device I/O
153 2 zitteret
   server.c		# server application (main file)
154 2 zitteret
}}}
155 2 zitteret
=== Kernel module ===
156 2 zitteret
{{{
157 2 zitteret
./kernel
158 2 zitteret
   net.c		# server management
159 2 zitteret
   queue.c		# queue handling for requests
160 2 zitteret
   cache.c		# cache implementation (red-black trees)
161 2 zitteret
   main.c		# module and block device (un)registration, threads
162 2 zitteret
}}}
163 6 zitteret
164 6 zitteret
== License ==
165 6 zitteret
166 6 zitteret
DNBD is available through the GNU General Public License (GPL).
167 6 zitteret
168 6 zitteret
This distribution is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
169 6 zitteret
170 6 zitteret
The programs in this distribution are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
171 6 zitteret
172 6 zitteret
See the file COPYING that is also included with this distribution for more details.