WikiStart

Version 8 (dsuchod, 05/12/2007 05:40 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 8 dsuchod
DNBD was developed for kernel 2.6.13 and later releases. For kernels later than 2.6.16 you will need to remove the "devfs" source from ''kernel/main.c'' (simply search for "devfs" and remove all calls and includes). Kernel 2.4 is not supported. The kernel sources and common tools (gcc, make, etc.) have to be installed.
41 1
42 2 zitteret
=== Server and Client ===
43 1
44 2 zitteret
Compiling:
45 2 zitteret
{{{
46 2 zitteret
$ cd dnbd; make
47 2 zitteret
}}}
48 1
49 2 zitteret
== USAGE ==
50 1
51 2 zitteret
=== Server ===
52 2 zitteret
53 2 zitteret
To show available command line parameters, start the server without
54 2 zitteret
arguments:
55 2 zitteret
56 2 zitteret
{{{
57 2 zitteret
$ ./server/dnbd-server
58 2 zitteret
dnbd-server, version 0.9.0
59 2 zitteret
Usage: dnbd-server -m <address> -d <device/file> -i <number> 
60 2 zitteret
                  [-t <threads>]
61 2 zitteret
62 2 zitteret
description:
63 2 zitteret
  -m|--mcast     <multicast address>
64 2 zitteret
  -d|--device    <block device or file>
65 2 zitteret
  -i|--id        <unique identification number>
66 2 zitteret
  -t|--threads   <number of threads>
67 2 zitteret
}}}
68 2 zitteret
69 2 zitteret
With the following command, the server will be started for the multicast
70 2 zitteret
network with address 239.0.0.1 and export the given file or block device.
71 2 zitteret
Its unique id is 1:
72 2 zitteret
{{{
73 2 zitteret
root@server1 $ ./server/dnbd-server -m 239.0.0.1 -d <partition/file> -i 1
74 2 zitteret
}}}
75 2 zitteret
To start a server on another computer, the used file or block device must have
76 2 zitteret
the same content and size as on the first server. However, the id has to be
77 2 zitteret
changed:
78 2 zitteret
{{{
79 2 zitteret
root@server2 $ ./server/dnbd-server -m 239.0.0.1 -d <partition/file> -i 2
80 2 zitteret
}}}
81 2 zitteret
If DNBD is used for wired networks and on multi-processor machines, the
82 2 zitteret
number of threads should be increased to the number of CPUs.
83 2 zitteret
84 2 zitteret
To access the exported file or block device, another computer is used as 
85 2 zitteret
client.
86 2 zitteret
87 2 zitteret
=== Client ===
88 2 zitteret
89 2 zitteret
The kernel module has to be loaded, before the client application can be used:
90 2 zitteret
{{{
91 2 zitteret
root@client1 $ insmod ./kernel/dnbd.ko
92 2 zitteret
}}}
93 2 zitteret
There should be an entry in syslog after successful loading. With no command
94 2 zitteret
line arguments the client gives available options:
95 2 zitteret
{{{
96 2 zitteret
root@client1 $ ./client/dnbd-client
97 2 zitteret
dnbd-client, version 0.9.0
98 2 zitteret
Usage: dnbd-client -d device -b <address> [-c <file>]
99 2 zitteret
    or dnbd-client -d device -u
100 2 zitteret
    or dnbd-client -d device -c <file>
101 2 zitteret
102 2 zitteret
description:
103 2 zitteret
  -d|--device    <device>
104 2 zitteret
  -b|--bind      <multicast-address>
105 2 zitteret
  -u|--unbind    
106 2 zitteret
  -c|--cache     <file>
107 2 zitteret
}}}
108 2 zitteret
We will now import the block device of the server, e.g.:
109 2 zitteret
{{{
110 2 zitteret
root@client1 $ ./client/dnbd-client -d /dev/dnbd0 -b 239.0.0.1
111 2 zitteret
}}}
112 2 zitteret
The client should tell you that it found a server with id "1". If you exported
113 2 zitteret
a CDROM with a movie, you can watch it on the client over the network, e.g.
114 2 zitteret
with mplayer (usually after mounting).
115 2 zitteret
116 2 zitteret
If someone else wants to watch the movie on a different client, you should
117 2 zitteret
enable caching either during operation
118 2 zitteret
{{{
119 2 zitteret
root@client1 $ ./client/dnbd-client -d /dev/dnbd0 -c <cachefile>
120 2 zitteret
}}}
121 2 zitteret
or at the beginning
122 2 zitteret
{{{
123 2 zitteret
root@client2 $ ./client/dnbd-client -d /dev/dnbd0 -b 239.0.0.1 -c <cachefile>
124 2 zitteret
}}}
125 2 zitteret
To create a cache with, e.g. 32M use
126 2 zitteret
{{{
127 2 zitteret
root@client1$ dd if=/dev/zero of=/tmp/cachefile bs=1M count=32
128 2 zitteret
}}}
129 2 zitteret
Cache statistics are shown with
130 2 zitteret
{{{
131 2 zitteret
root@client1$ cat /proc/driver/dnbd/dnbd0
132 2 zitteret
}}}
133 2 zitteret
The block device has to be unbound before the module can be unloaded:
134 2 zitteret
{{{
135 2 zitteret
root@client1 $ ./client/dnbd-client -d /dev/dnbd0 -u
136 2 zitteret
root@client1 $ rmmod dnbd
137 2 zitteret
}}}
138 2 zitteret
== Files ==
139 2 zitteret
140 2 zitteret
=== Client ===
141 2 zitteret
{{{
142 2 zitteret
./client
143 2 zitteret
   client.c		# client application
144 2 zitteret
}}}
145 2 zitteret
=== Server ===
146 2 zitteret
{{{
147 2 zitteret
./server
148 2 zitteret
   net.c		# network routines
149 2 zitteret
   query.c		# server request handling
150 2 zitteret
   filer.c		# file/device I/O
151 2 zitteret
   server.c		# server application (main file)
152 2 zitteret
}}}
153 2 zitteret
=== Kernel module ===
154 2 zitteret
{{{
155 2 zitteret
./kernel
156 2 zitteret
   net.c		# server management
157 2 zitteret
   queue.c		# queue handling for requests
158 2 zitteret
   cache.c		# cache implementation (red-black trees)
159 2 zitteret
   main.c		# module and block device (un)registration, threads
160 2 zitteret
}}}
161 6 zitteret
162 6 zitteret
== License ==
163 6 zitteret
164 6 zitteret
DNBD is available through the GNU General Public License (GPL).
165 6 zitteret
166 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.
167 6 zitteret
168 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.
169 6 zitteret
170 6 zitteret
See the file COPYING that is also included with this distribution for more details.