nrelease - fix/improve livecd
[dragonfly.git] / share / man / man4 / vinum.4
1 .\"  Hey, Emacs, edit this file in -*- nroff-fill -*- mode
2 .\"-
3 .\" Copyright (c) 1997, 1998
4 .\"     Nan Yang Computer Services Limited.  All rights reserved.
5 .\"
6 .\"  This software is distributed under the so-called ``Berkeley
7 .\"  License'':
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\"    must display the following acknowledgement:
19 .\"     This product includes software developed by Nan Yang Computer
20 .\"      Services Limited.
21 .\" 4. Neither the name of the Company nor the names of its contributors
22 .\"    may be used to endorse or promote products derived from this software
23 .\"    without specific prior written permission.
24 .\"
25 .\" This software is provided ``as is'', and any express or implied
26 .\" warranties, including, but not limited to, the implied warranties of
27 .\" merchantability and fitness for a particular purpose are disclaimed.
28 .\" In no event shall the company or contributors be liable for any
29 .\" direct, indirect, incidental, special, exemplary, or consequential
30 .\" damages (including, but not limited to, procurement of substitute
31 .\" goods or services; loss of use, data, or profits; or business
32 .\" interruption) however caused and on any theory of liability, whether
33 .\" in contract, strict liability, or tort (including negligence or
34 .\" otherwise) arising in any way out of the use of this software, even if
35 .\" advised of the possibility of such damage.
36 .\"
37 .\" $FreeBSD: src/share/man/man4/vinum.4,v 1.22.2.9 2002/04/22 08:19:35 kuriyama Exp $
38 .\"
39 .Dd December 12, 2014
40 .Dt VINUM 4
41 .Os
42 .Sh NAME
43 .Nm vinum
44 .Nd Logical Volume Manager
45 .Sh SYNOPSIS
46 .Cd "pseudo-device vinum"
47 .Sh DESCRIPTION
48 .Nm
49 is a logical volume manager inspired by, but not derived from, the Veritas
50 Volume Manager.
51 It provides the following features:
52 .Bl -bullet
53 .It
54 It provides device-independent logical disks, called
55 .Em volumes .
56 Volumes are
57 not restricted to the size of any disk on the system.
58 .It
59 The volumes consist of one or more
60 .Em plexes ,
61 each of which contain the
62 entire address space of a volume.
63 This represents an implementation of RAID-1
64 (mirroring).
65 Multiple plexes can also be used for
66 .\" XXX What about sparse plexes?  Do we want them?
67 .Bl -bullet
68 .It
69 Increased read throughput.
70 .Nm
71 will read data from the least active disk, so if a volume has plexes on multiple
72 disks, more data can be read in parallel.
73 .Nm
74 reads data from only one plex, but it writes data to all plexes.
75 .It
76 Increased reliability.
77 By storing plexes on different disks, data will remain
78 available even if one of the plexes becomes unavailable.
79 In comparison with a
80 RAID-5 plex (see below), using multiple plexes requires more storage space, but
81 gives better performance, particularly in the case of a drive failure.
82 .It
83 Additional plexes can be used for on-line data reorganization.
84 By attaching an
85 additional plex and subsequently detaching one of the older plexes, data can be
86 moved on-line without compromising access.
87 .It
88 An additional plex can be used to obtain a consistent dump of a file system.
89 By
90 attaching an additional plex and detaching at a specific time, the detached plex
91 becomes an accurate snapshot of the file system at the time of detachment.
92 .\" Make sure to flush!
93 .El
94 .It
95 Each plex consists of one or more logical disk slices, called
96 .Em subdisks .
97 Subdisks are defined as a contiguous block of physical disk storage.
98 A plex may
99 consist of any reasonable number of subdisks (in other words, the real limit is
100 not the number, but other factors, such as memory and performance, associated
101 with maintaining a large number of subdisks).
102 .It
103 A number of mappings between subdisks and plexes are available:
104 .Bl -bullet
105 .It
106 .Em "Concatenated plexes"
107 consist of one or more subdisks, each of which
108 is mapped to a contiguous part of the plex address space.
109 .It
110 .Em "Striped plexes"
111 consist of two or more subdisks of equal size.
112 The file
113 address space is mapped in
114 .Em stripes ,
115 integral fractions of the subdisk
116 size.
117 Consecutive plex address space is mapped to stripes in each subdisk in
118 turn.
119 .if t \{\
120 .ig
121 .\" FIXME
122 .br
123 .ne 1.5i
124 .PS
125 move right 2i
126 down
127 SD0: box
128 SD1: box
129 SD2: box
130
131 "plex 0" at SD0.n+(0,.2)
132 "subdisk 0" rjust at SD0.w-(.2,0)
133 "subdisk 1" rjust at SD1.w-(.2,0)
134 "subdisk 2" rjust at SD2.w-(.2,0)
135 .PE
136 ..
137 .\}
138 The subdisks of a striped plex must all be the same size.
139 .It
140 .Em "RAID-5 plexes"
141 require at least three equal-sized subdisks.
142 They
143 resemble striped plexes, except that in each stripe, one subdisk stores parity
144 information.
145 This subdisk changes in each stripe: in the first stripe, it is the
146 first subdisk, in the second it is the second subdisk, etc.
147 In the event of a
148 single disk failure,
149 .Nm
150 will recover the data based on the information stored on the remaining subdisks.
151 This mapping is particularly suited to read-intensive access.
152 The subdisks of a
153 RAID-5 plex must all be the same size.
154 .\" Make sure to flush!
155 .El
156 .It
157 .Em Drives
158 are the lowest level of the storage hierarchy.
159 They represent disk special
160 devices.
161 .It
162 .Nm
163 offers automatic startup.
164 Unlike
165 .Ux
166 file systems,
167 .Nm
168 volumes contain all the configuration information needed to ensure that they are
169 started correctly when the subsystem is enabled.
170 This is also a significant
171 advantage over the Veritas\(tm File System.
172 This feature regards the presence
173 of the volumes.
174 It does not mean that the volumes will be mounted
175 automatically, since the standard startup procedures with
176 .Pa /etc/fstab
177 perform this function.
178 .El
179 .Sh KERNEL CONFIGURATION
180 .Nm
181 is currently supplied as a KLD module, and does not require
182 configuration.
183 As with other klds, it is absolutely necessary to match the kld
184 to the version of the operating system.
185 Failure to do so will cause
186 .Nm
187 to issue an error message and terminate.
188 .Pp
189 It is possible to configure
190 .Nm
191 in the kernel, but this is not recommended.
192 To do so, add this line to the
193 kernel configuration file:
194 .Pp
195 .D1 Cd "pseudo-device vinum"
196 .Ss Debug Options
197 The current version of
198 .Nm ,
199 both the kernel module and the user program
200 .Xr vinum 8 ,
201 include significant debugging support.
202 It is not recommended to remove
203 this support at the moment, but if you do you must remove it from both the
204 kernel and the user components.
205 To do this, edit the files
206 .Pa /usr/src/sbin/vinum/Makefile
207 and
208 .Pa /sys/dev/raid/vinum/Makefile
209 and edit the
210 .Va CFLAGS
211 variable to remove the
212 .Li -DVINUMDEBUG
213 option.
214 If you have
215 configured
216 .Nm
217 into the kernel, either specify the line
218 .Pp
219 .D1 Cd "options VINUMDEBUG"
220 .Pp
221 in the kernel configuration file or remove the
222 .Li -DVINUMDEBUG
223 option from
224 .Pa /usr/src/sbin/vinum/Makefile
225 as described above.
226 .Pp
227 If the
228 .Va VINUMDEBUG
229 variables do not match,
230 .Xr vinum 8
231 will fail with a message
232 explaining the problem and what to do to correct it.
233 .Pp
234 .Nm
235 was previously available in two versions: a freely available version which did
236 not contain RAID-5 functionality, and a full version including RAID-5
237 functionality, which was available only from Cybernet Systems Inc.
238 The present
239 version of
240 .Nm
241 includes the RAID-5 functionality.
242 .Sh RUNNING VINUM
243 .Nm
244 is part of the base
245 .Dx
246 system.
247 It does not require installation.
248 To start it, start the
249 .Xr vinum 8
250 program, which will load the kld if it is not already present.
251 Before using
252 .Nm ,
253 it must be configured.
254 See
255 .Xr vinum 8
256 for information on how to create a
257 .Nm
258 configuration.
259 .Pp
260 Normally, you start a configured version of
261 .Nm
262 at boot time.
263 Set the variable
264 .Va start_vinum
265 in
266 .Pa /etc/rc.conf
267 to
268 .Dq Li YES
269 to start
270 .Nm
271 at boot time.
272 (See
273 .Xr rc.conf 5
274 for more details.)
275 .Pp
276 If
277 .Nm
278 is loaded as a kld (the recommended way), the
279 .Nm Cm stop
280 command will unload it
281 (see
282 .Xr vinum 8 ) .
283 You can also do this with the
284 .Xr kldunload 8
285 command.
286 .Pp
287 The kld can only be unloaded when idle, in other words when no volumes are
288 mounted and no other instances of the
289 .Xr vinum 8
290 program are active.
291 Unloading the kld does not harm the data in the volumes.
292 .Ss Configuring and Starting Objects
293 Use the
294 .Xr vinum 8
295 utility to configure and start
296 .Nm
297 objects.
298 .Sh IOCTL CALLS
299 .Xr ioctl 2
300 calls are intended for the use of the
301 .Xr vinum 8
302 configuration program only.
303 They are described in the header file
304 .Pa /sys/dev/raid/vinum/vinumio.h .
305 .Ss Disk Labels
306 Conventional disk special devices have a
307 .Em "disk label"
308 in the second sector of the device.
309 See
310 .Xr disklabel 5
311 for more details.
312 This disk label describes the layout of the partitions within
313 the device.
314 .Nm
315 does not subdivide volumes, so volumes do not contain a physical disk label.
316 For convenience,
317 .Nm
318 implements the ioctl calls
319 .Dv DIOCGDINFO
320 (get disk label),
321 .Dv DIOCGPART
322 (get partition information),
323 .Dv DIOCWDINFO
324 (write partition information) and
325 .Dv DIOCSDINFO
326 (set partition information).
327 .Dv DIOCGDINFO
328 and
329 .Dv DIOCGPART
330 refer to an internal
331 representation of the disk label which is not present on the volume.
332 As a
333 result, the
334 .Fl r
335 option of
336 .Xr disklabel 8 ,
337 which reads the
338 .Dq "raw disk" ,
339 will fail.
340 .Pp
341 In general,
342 .Xr disklabel 8
343 serves no useful purpose on a
344 .Nm
345 volume.
346 .Pp
347 .Nm
348 ignores the
349 .Dv DIOCWDINFO
350 and
351 .Dv DIOCSDINFO
352 ioctls, since there is nothing to change.
353 As a result, any attempt to modify the disk label will be silently ignored.
354 .Sh MAKING FILE SYSTEMS
355 Since
356 .Nm
357 volumes do not contain partitions, the names do not need to conform to the
358 standard rules for naming disk partitions.
359 For a physical disk partition, the
360 last letter of the device name specifies the partition identifier (a to p).
361 .Nm
362 volumes need not conform to this convention, but if they do not,
363 .Xr newfs 8
364 will complain that it cannot determine the partition.
365 To solve this problem,
366 use the
367 .Fl v
368 flag to
369 .Xr newfs 8 .
370 For example, if you have a volume
371 .Pa concat ,
372 use the following command to create a
373 .Xr UFS 5
374 file system on it:
375 .Pp
376 .Dl "newfs -v /dev/vinum/concat"
377 .Sh OBJECT NAMING
378 .Nm
379 assigns default names to plexes and subdisks, although they may be overridden.
380 We do not recommend overriding the default names.
381 Experience with the
382 Veritas\(tm
383 volume manager, which allows arbitrary naming of objects, has shown that this
384 flexibility does not bring a significant advantage, and it can cause confusion.
385 .Pp
386 Names may contain any non-blank character, but it is recommended to restrict
387 them to letters, digits and the underscore characters.
388 The names of volumes,
389 plexes and subdisks may be up to 64 characters long, and the names of drives may
390 up to 32 characters long.
391 When choosing volume and plex names, bear in mind
392 that automatically generated plex and subdisk names are longer than the name
393 from which they are derived.
394 .Bl -bullet
395 .It
396 When
397 .Nm
398 creates or deletes objects, it creates a directory
399 .Pa /dev/vinum ,
400 in which it makes device entries for each volume.
401 It also creates the
402 subdirectories,
403 .Pa /dev/vinum/plex
404 and
405 .Pa /dev/vinum/sd ,
406 in which it stores device entries for the plexes and subdisks.  In addition, it
407 creates two more directories,
408 .Pa /dev/vinum/vol
409 and
410 .Pa /dev/vinum/drive ,
411 in which it stores hierarchical information for volumes and drives.
412 .It
413 In addition,
414 .Nm
415 creates three super-devices,
416 .Pa /dev/vinum/control ,
417 .Pa /dev/vinum/Control
418 and
419 .Pa /dev/vinum/controld .
420 .Pa /dev/vinum/control
421 is used by
422 .Xr vinum 8
423 when it has been compiled without the
424 .Dv VINUMDEBUG
425 option,
426 .Pa /dev/vinum/Control
427 is used by
428 .Xr vinum 8
429 when it has been compiled with the
430 .Dv VINUMDEBUG
431 option, and
432 .Pa /dev/vinum/controld
433 is used by the
434 .Nm
435 daemon.
436 The two control devices for
437 .Xr vinum 8
438 are used to synchronize the debug status of kernel and user modules.
439 .It
440 Unlike
441 .Ux
442 drives,
443 .Nm
444 volumes are not subdivided into partitions, and thus do not contain a disk
445 label.
446 Unfortunately, this confuses a number of utilities, notably
447 .Xr newfs 8 ,
448 which normally tries to interpret the last letter of a
449 .Nm
450 volume name as a partition identifier.
451 If you use a volume name which does not
452 end in the letters
453 .Ql a
454 to
455 .Ql c ,
456 you must use the
457 .Fl v
458 flag to
459 .Xr newfs 8
460 in order to tell it to ignore this convention.
461 .\"
462 .It
463 Plexes do not need to be assigned explicit names.
464 By default, a plex name is
465 the name of the volume followed by the letters
466 .Pa .p
467 and the number of the
468 plex.
469 For example, the plexes of volume
470 .Pa vol3
471 are called
472 .Pa vol3.p0 , vol3.p1
473 and so on.
474 These names can be overridden, but it is not recommended.
475 .It
476 Like plexes, subdisks are assigned names automatically, and explicit naming is
477 discouraged.
478 A subdisk name is the name of the plex followed by the letters
479 .Pa .s
480 and a number identifying the subdisk.
481 For example, the subdisks of
482 plex
483 .Pa vol3.p0
484 are called
485 .Pa vol3.p0.s0 , vol3.p0.s1
486 and so on.
487 .It
488 By contrast,
489 .Em drives
490 must be named.
491 This makes it possible to move a drive to a different location
492 and still recognize it automatically.
493 Drive names may be up to 32 characters
494 long.
495 .El
496 .Ss Example
497 Assume the
498 .Nm
499 objects described in the section
500 .Sx "CONFIGURATION FILE"
501 in
502 .Xr vinum 8 .
503 The directory
504 .Pa /dev/vinum
505 looks like:
506 .Bd -literal -offset indent
507 # ls -lR /dev/vinum
508 total 5
509 crwxr-xr--  1 root  wheel   91,   2 Mar 30 16:08 concat
510 crwx------  1 root  wheel   91, 0x40000000 Mar 30 16:08 control
511 crwx------  1 root  wheel   91, 0x40000001 Mar 30 16:08 controld
512 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 drive
513 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 plex
514 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 rvol
515 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 sd
516 crwxr-xr--  1 root  wheel   91,   3 Mar 30 16:08 strcon
517 crwxr-xr--  1 root  wheel   91,   1 Mar 30 16:08 stripe
518 crwxr-xr--  1 root  wheel   91,   0 Mar 30 16:08 tinyvol
519 drwxrwxrwx  7 root  wheel       512 Mar 30 16:08 vol
520 crwxr-xr--  1 root  wheel   91,   4 Mar 30 16:08 vol5
521
522 /dev/vinum/drive:
523 total 0
524 crw-r-----  1 root  operator    4,  15 Oct 21 16:51 drive2
525 crw-r-----  1 root  operator    4,  31 Oct 21 16:51 drive4
526
527 /dev/vinum/plex:
528 total 0
529 crwxr-xr--  1 root  wheel   91, 0x10000002 Mar 30 16:08 concat.p0
530 crwxr-xr--  1 root  wheel   91, 0x10010002 Mar 30 16:08 concat.p1
531 crwxr-xr--  1 root  wheel   91, 0x10000003 Mar 30 16:08 strcon.p0
532 crwxr-xr--  1 root  wheel   91, 0x10010003 Mar 30 16:08 strcon.p1
533 crwxr-xr--  1 root  wheel   91, 0x10000001 Mar 30 16:08 stripe.p0
534 crwxr-xr--  1 root  wheel   91, 0x10000000 Mar 30 16:08 tinyvol.p0
535 crwxr-xr--  1 root  wheel   91, 0x10000004 Mar 30 16:08 vol5.p0
536 crwxr-xr--  1 root  wheel   91, 0x10010004 Mar 30 16:08 vol5.p1
537
538 /dev/vinum/sd:
539 total 0
540 crwxr-xr--  1 root  wheel   91, 0x20000002 Mar 30 16:08 concat.p0.s0
541 crwxr-xr--  1 root  wheel   91, 0x20100002 Mar 30 16:08 concat.p0.s1
542 crwxr-xr--  1 root  wheel   91, 0x20010002 Mar 30 16:08 concat.p1.s0
543 crwxr-xr--  1 root  wheel   91, 0x20000003 Mar 30 16:08 strcon.p0.s0
544 crwxr-xr--  1 root  wheel   91, 0x20100003 Mar 30 16:08 strcon.p0.s1
545 crwxr-xr--  1 root  wheel   91, 0x20010003 Mar 30 16:08 strcon.p1.s0
546 crwxr-xr--  1 root  wheel   91, 0x20110003 Mar 30 16:08 strcon.p1.s1
547 crwxr-xr--  1 root  wheel   91, 0x20000001 Mar 30 16:08 stripe.p0.s0
548 crwxr-xr--  1 root  wheel   91, 0x20100001 Mar 30 16:08 stripe.p0.s1
549 crwxr-xr--  1 root  wheel   91, 0x20000000 Mar 30 16:08 tinyvol.p0.s0
550 crwxr-xr--  1 root  wheel   91, 0x20100000 Mar 30 16:08 tinyvol.p0.s1
551 crwxr-xr--  1 root  wheel   91, 0x20000004 Mar 30 16:08 vol5.p0.s0
552 crwxr-xr--  1 root  wheel   91, 0x20100004 Mar 30 16:08 vol5.p0.s1
553 crwxr-xr--  1 root  wheel   91, 0x20010004 Mar 30 16:08 vol5.p1.s0
554 crwxr-xr--  1 root  wheel   91, 0x20110004 Mar 30 16:08 vol5.p1.s1
555
556 /dev/vinum/vol:
557 total 5
558 crwxr-xr--  1 root  wheel   91,   2 Mar 30 16:08 concat
559 drwxr-xr-x  4 root  wheel       512 Mar 30 16:08 concat.plex
560 crwxr-xr--  1 root  wheel   91,   3 Mar 30 16:08 strcon
561 drwxr-xr-x  4 root  wheel       512 Mar 30 16:08 strcon.plex
562 crwxr-xr--  1 root  wheel   91,   1 Mar 30 16:08 stripe
563 drwxr-xr-x  3 root  wheel       512 Mar 30 16:08 stripe.plex
564 crwxr-xr--  1 root  wheel   91,   0 Mar 30 16:08 tinyvol
565 drwxr-xr-x  3 root  wheel       512 Mar 30 16:08 tinyvol.plex
566 crwxr-xr--  1 root  wheel   91,   4 Mar 30 16:08 vol5
567 drwxr-xr-x  4 root  wheel       512 Mar 30 16:08 vol5.plex
568
569 /dev/vinum/vol/concat.plex:
570 total 2
571 crwxr-xr--  1 root  wheel   91, 0x10000002 Mar 30 16:08 concat.p0
572 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 concat.p0.sd
573 crwxr-xr--  1 root  wheel   91, 0x10010002 Mar 30 16:08 concat.p1
574 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 concat.p1.sd
575
576 /dev/vinum/vol/concat.plex/concat.p0.sd:
577 total 0
578 crwxr-xr--  1 root  wheel   91, 0x20000002 Mar 30 16:08 concat.p0.s0
579 crwxr-xr--  1 root  wheel   91, 0x20100002 Mar 30 16:08 concat.p0.s1
580
581 /dev/vinum/vol/concat.plex/concat.p1.sd:
582 total 0
583 crwxr-xr--  1 root  wheel   91, 0x20010002 Mar 30 16:08 concat.p1.s0
584
585 /dev/vinum/vol/strcon.plex:
586 total 2
587 crwxr-xr--  1 root  wheel   91, 0x10000003 Mar 30 16:08 strcon.p0
588 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 strcon.p0.sd
589 crwxr-xr--  1 root  wheel   91, 0x10010003 Mar 30 16:08 strcon.p1
590 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 strcon.p1.sd
591
592 /dev/vinum/vol/strcon.plex/strcon.p0.sd:
593 total 0
594 crwxr-xr--  1 root  wheel   91, 0x20000003 Mar 30 16:08 strcon.p0.s0
595 crwxr-xr--  1 root  wheel   91, 0x20100003 Mar 30 16:08 strcon.p0.s1
596
597 /dev/vinum/vol/strcon.plex/strcon.p1.sd:
598 total 0
599 crwxr-xr--  1 root  wheel   91, 0x20010003 Mar 30 16:08 strcon.p1.s0
600 crwxr-xr--  1 root  wheel   91, 0x20110003 Mar 30 16:08 strcon.p1.s1
601
602 /dev/vinum/vol/stripe.plex:
603 total 1
604 crwxr-xr--  1 root  wheel   91, 0x10000001 Mar 30 16:08 stripe.p0
605 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 stripe.p0.sd
606
607 /dev/vinum/vol/stripe.plex/stripe.p0.sd:
608 total 0
609 crwxr-xr--  1 root  wheel   91, 0x20000001 Mar 30 16:08 stripe.p0.s0
610 crwxr-xr--  1 root  wheel   91, 0x20100001 Mar 30 16:08 stripe.p0.s1
611
612 /dev/vinum/vol/tinyvol.plex:
613 total 1
614 crwxr-xr--  1 root  wheel   91, 0x10000000 Mar 30 16:08 tinyvol.p0
615 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 tinyvol.p0.sd
616
617 /dev/vinum/vol/tinyvol.plex/tinyvol.p0.sd:
618 total 0
619 crwxr-xr--  1 root  wheel   91, 0x20000000 Mar 30 16:08 tinyvol.p0.s0
620 crwxr-xr--  1 root  wheel   91, 0x20100000 Mar 30 16:08 tinyvol.p0.s1
621
622 /dev/vinum/vol/vol5.plex:
623 total 2
624 crwxr-xr--  1 root  wheel   91, 0x10000004 Mar 30 16:08 vol5.p0
625 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 vol5.p0.sd
626 crwxr-xr--  1 root  wheel   91, 0x10010004 Mar 30 16:08 vol5.p1
627 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 vol5.p1.sd
628
629 /dev/vinum/vol/vol5.plex/vol5.p0.sd:
630 total 0
631 crwxr-xr--  1 root  wheel   91, 0x20000004 Mar 30 16:08 vol5.p0.s0
632 crwxr-xr--  1 root  wheel   91, 0x20100004 Mar 30 16:08 vol5.p0.s1
633
634 /dev/vinum/vol/vol5.plex/vol5.p1.sd:
635 total 0
636 crwxr-xr--  1 root  wheel   91, 0x20010004 Mar 30 16:08 vol5.p1.s0
637 crwxr-xr--  1 root  wheel   91, 0x20110004 Mar 30 16:08 vol5.p1.s1
638 .Ed
639 .Pp
640 In the case of unattached plexes and subdisks, the naming is reversed.
641 Subdisks
642 are named after the disk on which they are located, and plexes are named after
643 the subdisk.
644 .\" XXX
645 .Bf -symbolic
646 This mapping is still to be determined.
647 .Ef
648 .Ss Object States
649 Each
650 .Nm
651 object has a
652 .Em state
653 associated with it.
654 .Nm
655 uses this state to determine the handling of the object.
656 .Ss Volume States
657 Volumes may have the following states:
658 .Bl -hang -width 14n
659 .It Em down
660 The volume is completely inaccessible.
661 .It Em up
662 The volume is up and at least partially functional.
663 Not all plexes may be
664 available.
665 .El
666 .Ss "Plex States"
667 Plexes may have the following states:
668 .Bl -hang -width 14n
669 .It Em referenced
670 A plex entry which has been referenced as part of a volume, but which is
671 currently not known.
672 .It Em faulty
673 A plex which has gone completely down because of I/O errors.
674 .It Em down
675 A plex which has been taken down by the administrator.
676 .It Em initializing
677 A plex which is being initialized.
678 .El
679 .Pp
680 The remaining states represent plexes which are at least partially up.
681 .Bl -hang -width 14n
682 .It Em corrupt
683 A plex entry which is at least partially up.
684 Not all subdisks are available,
685 and an inconsistency has occurred.
686 If no other plex is uncorrupted, the volume
687 is no longer consistent.
688 .It Em degraded
689 A RAID-5 plex entry which is accessible, but one subdisk is down, requiring
690 recovery for many I/O requests.
691 .It Em flaky
692 A plex which is really up, but which has a reborn subdisk which we do not
693 completely trust, and which we do not want to read if we can avoid it.
694 .It Em up
695 A plex entry which is completely up.
696 All subdisks are up.
697 .El
698 .Ss "Subdisk States"
699 Subdisks can have the following states:
700 .Bl -hang -width 14n
701 .It Em empty
702 A subdisk entry which has been created completely.
703 All fields are correct, and
704 the disk has been updated, but the on the disk is not valid.
705 .It Em referenced
706 A subdisk entry which has been referenced as part of a plex, but which is
707 currently not known.
708 .It Em initializing
709 A subdisk entry which has been created completely and which is currently being
710 initialized.
711 .El
712 .Pp
713 The following states represent invalid data.
714 .Bl -hang -width 14n
715 .It Em obsolete
716 A subdisk entry which has been created completely.
717 All fields are correct, the
718 config on disk has been updated, and the data was valid, but since then the
719 drive has been taken down, and as a result updates have been missed.
720 .It Em stale
721 A subdisk entry which has been created completely.
722 All fields are correct, the
723 disk has been updated, and the data was valid, but since then the drive has been
724 crashed and updates have been lost.
725 .El
726 .Pp
727 The following states represent valid, inaccessible data.
728 .Bl -hang -width 14n
729 .It Em crashed
730 A subdisk entry which has been created completely.
731 All fields are correct, the
732 disk has been updated, and the data was valid, but since then the drive has gone
733 down.
734 No attempt has been made to write to the subdisk since the crash, so the
735 data is valid.
736 .It Em down
737 A subdisk entry which was up, which contained valid data, and which was taken
738 down by the administrator.
739 The data is valid.
740 .It Em reviving
741 The subdisk is currently in the process of being revived.
742 We can write but not
743 read.
744 .El
745 .Pp
746 The following states represent accessible subdisks with valid data.
747 .Bl -hang -width 14n
748 .It Em reborn
749 A subdisk entry which has been created completely.
750 All fields are correct, the
751 disk has been updated, and the data was valid, but since then the drive has gone
752 down and up again.
753 No updates were lost, but it is possible that the subdisk
754 has been damaged.
755 We won't read from this subdisk if we have a choice.
756 If this
757 is the only subdisk which covers this address space in the plex, we set its
758 state to up under these circumstances, so this status implies that there is
759 another subdisk to fulfil the request.
760 .It Em up
761 A subdisk entry which has been created completely.
762 All fields are correct, the
763 disk has been updated, and the data is valid.
764 .El
765 .Ss "Drive States"
766 Drives can have the following states:
767 .Bl -hang -width 14n
768 .It Em referenced
769 At least one subdisk refers to the drive, but it is not currently accessible to
770 the system.
771 No device name is known.
772 .It Em down
773 The drive is not accessible.
774 .It Em up
775 The drive is up and running.
776 .El
777 .Sh DEBUGGING PROBLEMS WITH VINUM
778 Solving problems with
779 .Nm
780 can be a difficult affair.
781 This section suggests some approaches.
782 .Ss Configuration problems
783 It is relatively easy (too easy) to run into problems with the
784 .Nm
785 configuration.
786 If you do, the first thing you should do is stop configuration
787 updates:
788 .Pp
789 .Dl "vinum setdaemon 4"
790 .Pp
791 This will stop updates and any further corruption of the on-disk configuration.
792 .Pp
793 Next, look at the on-disk configuration with the
794 .Nm Cm dumpconfig
795 command, for example:
796 .if t .ps -3
797 .if t .vs -3
798 .Bd -literal
799 # \fBvinum dumpconfig\fP
800 Drive 4:        Device /dev/da3s0h
801                 Created on crash.lemis.com at Sat May 20 16:32:44 2000
802                 Config last updated Sat May 20 16:32:56 2000
803                 Size:        601052160 bytes (573 MB)
804 volume obj state up
805 volume src state up
806 volume raid state down
807 volume r state down
808 volume foo state up
809 plex name obj.p0 state corrupt org concat vol obj
810 plex name obj.p1 state corrupt org striped 128b vol obj
811 plex name src.p0 state corrupt org striped 128b vol src
812 plex name src.p1 state up org concat vol src
813 plex name raid.p0 state faulty org disorg vol raid
814 plex name r.p0 state faulty org disorg vol r
815 plex name foo.p0 state up org concat vol foo
816 plex name foo.p1 state faulty org concat vol foo
817 sd name obj.p0.s0 drive drive2 plex obj.p0 state reborn len 409600b driveoffset 265b plexoffset 0b
818 sd name obj.p0.s1 drive drive4 plex obj.p0 state up len 409600b driveoffset 265b plexoffset 409600b
819 sd name obj.p1.s0 drive drive1 plex obj.p1 state up len 204800b driveoffset 265b plexoffset 0b
820 sd name obj.p1.s1 drive drive2 plex obj.p1 state reborn len 204800b driveoffset 409865b plexoffset 128b
821 sd name obj.p1.s2 drive drive3 plex obj.p1 state up len 204800b driveoffset 265b plexoffset 256b
822 sd name obj.p1.s3 drive drive4 plex obj.p1 state up len 204800b driveoffset 409865b plexoffset 384b
823 .Ed
824 .if t .vs +3
825 .if t .ps +3
826 .Pp
827 The configuration on all disks should be the same.
828 If this is not the case,
829 please save the output to a file and report the problem.
830 There is probably
831 little that can be done to recover the on-disk configuration, but if you keep a
832 copy of the files used to create the objects, you should be able to re-create
833 them.
834 The
835 .Cm create
836 command does not change the subdisk data, so this will not cause data
837 corruption.
838 You may need to use the
839 .Cm resetconfig
840 command if you have this kind of trouble.
841 .Ss Kernel Panics
842 In order to analyse a panic which you suspect comes from
843 .Nm
844 you will need to build a debug kernel.
845 See the online handbook at
846 .Pa http://www.dragonflybsd.org/docs/user/list/DebugKernelCrashDumps/
847 for more details of how to do this.
848 .Pp
849 Perform the following steps to analyse a
850 .Nm
851 problem:
852 .Bl -enum
853 .It
854 Copy the following files to the directory in which you will be
855 performing the analysis, typically
856 .Pa /var/crash :
857 .Pp
858 .Bl -bullet -compact
859 .It
860 .Pa /sys/dev/raid/vinum/.gdbinit.crash ,
861 .It
862 .Pa /sys/dev/raid/vinum/.gdbinit.kernel ,
863 .It
864 .Pa /sys/dev/raid/vinum/.gdbinit.serial ,
865 .It
866 .Pa /sys/dev/raid/vinum/.gdbinit.vinum
867 and
868 .It
869 .Pa /sys/dev/raid/vinum/.gdbinit.vinum.paths
870 .El
871 .It
872 Make sure that you build the
873 .Nm
874 module with debugging information.
875 The standard
876 .Pa Makefile
877 builds a module with debugging symbols by default.
878 If the version of
879 .Nm
880 in
881 .Pa /boot/kernel
882 does not contain symbols, you will not get an error message, but the stack trace
883 will not show the symbols.
884 Check the module before starting
885 .Xr kgdb 1 :
886 .Bd -literal
887 $ file /boot/kernel/vinum.ko
888 /boot/kernel/vinum.ko: ELF 32-bit LSB shared object, Intel 80386,
889   version 1 (SYSV), dynamically linked, not stripped
890 .Ed
891 .Pp
892 If the output shows that
893 .Pa /boot/kernel/vinum.ko
894 is stripped, you will have to find a version which is not.
895 Usually this will be
896 either in
897 .Pa /usr/obj/usr/src/sys/SYSTEM_NAME/usr/src/sys/dev/raid/vinum/vinum.ko
898 (if you have built
899 .Nm
900 with a
901 .Dq Li "make world" )
902 or
903 .Pa /sys/dev/raid/vinum/vinum.ko
904 (if you have built
905 .Nm
906 in this directory).
907 Modify the file
908 .Pa .gdbinit.vinum.paths
909 accordingly.
910 .It
911 Either take a dump or use remote serial
912 .Xr gdb 1
913 to analyse the problem.
914 To analyse a dump, say
915 .Pa /var/crash/vmcore.5 ,
916 link
917 .Pa /var/crash/.gdbinit.crash
918 to
919 .Pa /var/crash/.gdbinit
920 and enter:
921 .Bd -literal -offset indent
922 cd /var/crash
923 kgdb kernel.debug vmcore.5
924 .Ed
925 .Pp
926 This example assumes that you have installed the correct debug kernel at
927 .Pa /var/crash/kernel.debug .
928 If not, substitute the correct name of the debug kernel.
929 .Pp
930 To perform remote serial debugging,
931 link
932 .Pa /var/crash/.gdbinit.serial
933 to
934 .Pa /var/crash/.gdbinit
935 and enter
936 .Bd -literal -offset indent
937 cd /var/crash
938 kgdb kernel.debug
939 .Ed
940 .Pp
941 In this case, the
942 .Pa .gdbinit
943 file performs the functions necessary to establish connection.
944 The remote
945 machine must already be in debug mode: enter the kernel debugger and select
946 .Ic gdb
947 (see
948 .Xr ddb 4
949 for more details.)
950 The serial
951 .Pa .gdbinit
952 file expects the serial connection to run at 38400 bits per second; if you run
953 at a different speed, edit the file accordingly (look for the
954 .Va remotebaud
955 specification).
956 .Pp
957 The following example shows a remote debugging session using the
958 .Ic debug
959 command of
960 .Xr vinum 8 :
961 .Bd -literal
962 .if t .ps -3
963 .if t .vs -3
964 GDB 4.16 (i386-unknown-dragonfly), Copyright 1996 Free Software Foundation, Inc.
965 Debugger (msg=0xf1093174 "vinum debug") at ../../i386/i386/db_interface.c:318
966 318                 in_Debugger = 0;
967 #1  0xf108d9bc in vinumioctl (dev=0x40001900, cmd=0xc008464b, data=0xf6dedee0 "",
968     flag=0x3, p=0xf68b7940) at
969     /usr/src/sys/dev/raid/vinum/vinumioctl.c:102
970 102             Debugger ("vinum debug");
971 (kgdb) bt
972 #0  Debugger (msg=0xf0f661ac "vinum debug") at ../../i386/i386/db_interface.c:318
973 #1  0xf0f60a7c in vinumioctl (dev=0x40001900, cmd=0xc008464b, data=0xf6923ed0 "",
974       flag=0x3, p=0xf688e6c0) at
975       /usr/src/sys/dev/raid/vinum/vinumioctl.c:109
976 #2  0xf01833b7 in spec_ioctl (ap=0xf6923e0c) at ../../miscfs/specfs/spec_vnops.c:424
977 #3  0xf0182cc9 in spec_vnoperate (ap=0xf6923e0c) at ../../miscfs/specfs/spec_vnops.c:129
978 #4  0xf01eb3c1 in ufs_vnoperatespec (ap=0xf6923e0c) at ../../ufs/ufs/ufs_vnops.c:2312
979 #5  0xf017dbb1 in vn_ioctl (fp=0xf1007ec0, com=0xc008464b, data=0xf6923ed0 "",
980       p=0xf688e6c0) at vnode_if.h:395
981 #6  0xf015dce0 in ioctl (p=0xf688e6c0, uap=0xf6923f84) at ../../kern/sys_generic.c:473
982 #7  0xf0214c0b in syscall (frame={tf_es = 0x27, tf_ds = 0x27, tf_edi = 0xefbfcff8,
983       tf_esi = 0x1, tf_ebp = 0xefbfcf90, tf_isp = 0xf6923fd4, tf_ebx = 0x2,
984       tf_edx = 0x804b614, tf_ecx = 0x8085d10, tf_eax = 0x36, tf_trapno = 0x7,
985       tf_err = 0x2, tf_eip = 0x8060a34, tf_cs = 0x1f, tf_eflags = 0x286,
986       tf_esp = 0xefbfcf78, tf_ss = 0x27}) at ../../i386/i386/trap.c:1100
987 #8  0xf020a1fc in Xint0x80_syscall ()
988 #9  0x804832d in ?? ()
989 #10 0x80482ad in ?? ()
990 #11 0x80480e9 in ?? ()
991 .if t .vs
992 .if t .ps
993 .Ed
994 .Pp
995 When entering from the debugger, it is important that the source of frame 1
996 (listed by the
997 .Pa .gdbinit
998 file at the top of the example) contains the text
999 .Dq Li "Debugger (\*[q]vinum debug\*[q]);" .
1000 .Pp
1001 This is an indication that the address specifications are correct.
1002 If you get
1003 some other output, your symbols and the kernel module are out of sync, and the
1004 trace will be meaningless.
1005 .El
1006 .Pp
1007 For an initial investigation, the most important information is the output of
1008 the
1009 .Ic bt
1010 (backtrace) command above.
1011 .Ss Reporting Problems with Vinum
1012 If you find any bugs in
1013 .Nm ,
1014 please report them to
1015 .An Greg Lehey Aq Mt grog@lemis.com .
1016 Supply the following
1017 information:
1018 .Bl -bullet
1019 .It
1020 The output of the
1021 .Nm Cm list
1022 command
1023 (see
1024 .Xr vinum 8 ) .
1025 .It
1026 Any messages printed in
1027 .Pa /var/log/messages .
1028 All such messages will be identified by the text
1029 .Dq Li vinum
1030 at the beginning.
1031 .It
1032 If you have a panic, a stack trace as described above.
1033 .El
1034 .Sh SEE ALSO
1035 .Xr disklabel 5 ,
1036 .Xr disklabel 8 ,
1037 .Xr newfs 8 ,
1038 .Xr vinum 8
1039 .Sh HISTORY
1040 .Nm
1041 first appeared in
1042 .Fx 3.0 .
1043 The RAID-5 component of
1044 .Nm
1045 was developed by Cybernet Inc.\&
1046 .Pq Pa http://www.cybernet.com/ ,
1047 for its NetMAX product.
1048 .Sh AUTHORS
1049 .An Greg Lehey Aq Mt grog@lemis.com .
1050 .Sh BUGS
1051 .Nm
1052 is a new product.
1053 Bugs can be expected.
1054 The configuration mechanism is not yet
1055 fully functional.
1056 If you have difficulties, please look at the section
1057 .Sx "DEBUGGING PROBLEMS WITH VINUM"
1058 before reporting problems.
1059 .Pp
1060 Kernels with the
1061 .Nm
1062 pseudo-device appear to work, but are not supported.
1063 If you have trouble with
1064 this configuration, please first replace the kernel with a
1065 .No non- Ns Nm
1066 kernel and test with the kld module.
1067 .Pp
1068 Detection of differences between the version of the kernel and the kld is not
1069 yet implemented.
1070 .Pp
1071 The RAID-5 functionality is new in
1072 .Fx 3.3 .
1073 Some problems have been
1074 reported with
1075 .Nm
1076 in combination with soft updates, but these are not reproducible on all
1077 systems.
1078 If you are planning to use
1079 .Nm
1080 in a production environment, please test carefully.