]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - share/man/man4/vinum.4
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / share / man / man4 / vinum.4
1 .\"  Hey, Emacs, edit this file in -*- nroff-fill -*- mode
2 .\"-
3 .\" Copyright (c) 1997, 1998, 2003
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$
38 .\"
39 .Dd May 16, 2002
40 .Dt VINUM 4
41 .Os
42 .Sh NAME
43 .Nm vinum
44 .Nd Logical Volume Manager
45 .Sh SYNOPSIS
46 .Cd "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 "device vinum"
196 .Ss Debug Options
197 The current version of
198 .Nm ,
199 both the kernel module and the user program
200 .Xr gvinum 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 /usr/src/sys/modules/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 gvinum 8
231 will fail with a message
232 explaining the problem and what to do to correct it.
233 .Ss Other Options
234 .Cd "options VINUM_AUTOSTART"
235 .Pp
236 Make
237 .Nm
238 automatically scan all available disks at attach time.
239 This is a deprecated way that is primarily intended for environments
240 that do not want to rely on kernel environment variables set by
241 .Xr loader 8 .
242 .Pp
243 .Nm
244 was previously available in two versions: a freely available version which did
245 not contain RAID-5 functionality, and a full version including RAID-5
246 functionality, which was available only from Cybernet Systems Inc.
247 The present
248 version of
249 .Nm
250 includes the RAID-5 functionality.
251 .Sh RUNNING VINUM
252 .Nm
253 is part of the base
254 .Fx
255 system.
256 It does not require installation.
257 To start it, start the
258 .Xr gvinum 8
259 program, which will load the KLD if it is not already present.
260 Before using
261 .Nm ,
262 it must be configured.
263 See
264 .Xr gvinum 8
265 for information on how to create a
266 .Nm
267 configuration.
268 .Pp
269 Normally, you start a configured version of
270 .Nm
271 at boot time.
272 Set the variable
273 .Va start_vinum
274 in
275 .Pa /etc/rc.conf
276 to
277 .Dq Li YES
278 to start
279 .Nm
280 at boot time.
281 (See
282 .Xr rc.conf 5
283 for more details.)
284 .Pp
285 If
286 .Nm
287 is loaded as a KLD (the recommended way), the
288 .Nm vinum Cm stop
289 command will unload it
290 (see
291 .Xr gvinum 8 ) .
292 You can also do this with the
293 .Xr kldunload 8
294 command.
295 .Pp
296 The KLD can only be unloaded when idle, in other words when no volumes are
297 mounted and no other instances of the
298 .Xr gvinum 8
299 program are active.
300 Unloading the KLD does not harm the data in the volumes.
301 .Ss Configuring and Starting Objects
302 Use the
303 .Xr gvinum 8
304 utility to configure and start
305 .Nm
306 objects.
307 .Sh AUTOMATIC STARTUP
308 The
309 .Nm
310 subsystem can be automatically started at attach time.
311 There are two kernel environment variables that can be set in
312 .Xr loader.conf 5
313 to accomplish this.
314 .Bl -tag -width ".Va vinum.autostart" -offset indent
315 .It Va vinum.autostart
316 If this variable is set (to any value), the attach function will attempt
317 to scan all available disks for valid
318 .Nm
319 configuration records.
320 This is the preferred way if automatic startup is desired.
321 .Pp
322 Example:
323 .Dl vinum.autostart="YES"
324 .It Va vinum.drives
325 Alternatively, this variable can enumerate a list of disk devices
326 to scan for configuration records.
327 Note that only the
328 .Dq bare
329 device names need to be given, since
330 .Nm
331 will automatically scan all possible slices and partitions.
332 .Pp
333 Example:
334 .Dl vinum.drives="da0 da1"
335 .El
336 .Pp
337 If automatic startup is used, it is not necessary to set the
338 .Va start_vinum
339 variable of
340 .Xr rc.conf 5 .
341 Note that if
342 .Nm
343 is to supply to the volume for the root file system, it is necessary
344 to start the subsystem early.
345 This can be achieved by specifying
346 .Pp
347 .Dl vinum_load="YES"
348 .Pp
349 in
350 .Xr loader.conf 5 .
351 .Sh IOCTL CALLS
352 .Xr ioctl 2
353 calls are intended for the use of the
354 .Xr gvinum 8
355 configuration program only.
356 They are described in the header file
357 .Pa /sys/dev/vinum/vinumio.h .
358 .Ss Disk Labels
359 Conventional disk special devices have a
360 .Em "disk label"
361 in the second sector of the device.
362 See
363 .Xr disklabel 5
364 for more details.
365 This disk label describes the layout of the partitions within
366 the device.
367 .Nm
368 does not subdivide volumes, so volumes do not contain a physical disk label.
369 For convenience,
370 .Nm
371 implements the ioctl calls
372 .Dv DIOCGDINFO
373 (get disk label),
374 .Dv DIOCGPART
375 (get partition information),
376 .Dv DIOCWDINFO
377 (write partition information) and
378 .Dv DIOCSDINFO
379 (set partition information).
380 .Dv DIOCGDINFO
381 and
382 .Dv DIOCGPART
383 refer to an internal
384 representation of the disk label which is not present on the volume.
385 As a
386 result, the
387 .Fl r
388 option of
389 .Xr disklabel 8 ,
390 which reads the
391 .Dq "raw disk" ,
392 will fail.
393 .Pp
394 In general,
395 .Xr disklabel 8
396 serves no useful purpose on a
397 .Nm
398 volume.
399 If you run it, it will show you
400 three partitions,
401 .Ql a ,
402 .Ql b
403 and
404 .Ql c ,
405 all the same except for the
406 .Va fstype ,
407 for example:
408 .Bd -literal
409 3 partitions:
410 #        size   offset    fstype   [fsize bsize bps/cpg]
411   a:     2048        0    4.2BSD     1024  8192     0   # (Cyl.    0 - 0)
412   b:     2048        0      swap                        # (Cyl.    0 - 0)
413   c:     2048        0    unused        0     0         # (Cyl.    0 - 0)
414 .Ed
415 .Pp
416 .Nm
417 ignores the
418 .Dv DIOCWDINFO
419 and
420 .Dv DIOCSDINFO
421 ioctls, since there is nothing to change.
422 As a result, any attempt to modify the disk label will be silently ignored.
423 .Sh MAKING FILE SYSTEMS
424 Since
425 .Nm
426 volumes do not contain partitions, the names do not need to conform to the
427 standard rules for naming disk partitions.
428 For a physical disk partition, the
429 last letter of the device name specifies the partition identifier (a to h).
430 .Nm
431 volumes need not conform to this convention, but if they do not,
432 .Xr newfs 8
433 will complain that it cannot determine the partition.
434 To solve this problem,
435 use the
436 .Fl v
437 flag to
438 .Xr newfs 8 .
439 For example, if you have a volume
440 .Pa concat ,
441 use the following command to create a UFS file system on it:
442 .Pp
443 .Dl "newfs -v /dev/vinum/concat"
444 .Sh OBJECT NAMING
445 .Nm
446 assigns default names to plexes and subdisks, although they may be overridden.
447 We do not recommend overriding the default names.
448 Experience with the
449 Veritas\(tm
450 volume manager, which allows arbitrary naming of objects, has shown that this
451 flexibility does not bring a significant advantage, and it can cause confusion.
452 .Pp
453 Names may contain any non-blank character, but it is recommended to restrict
454 them to letters, digits and the underscore characters.
455 The names of volumes,
456 plexes and subdisks may be up to 64 characters long, and the names of drives may
457 up to 32 characters long.
458 When choosing volume and plex names, bear in mind
459 that automatically generated plex and subdisk names are longer than the name
460 from which they are derived.
461 .Bl -bullet
462 .It
463 When
464 .Nm
465 creates or deletes objects, it creates a directory
466 .Pa /dev/vinum ,
467 in which it makes device entries for each volume it finds.
468 It also creates
469 subdirectories,
470 .Pa /dev/vinum/plex
471 and
472 .Pa /dev/vinum/sd ,
473 in which it stores device entries for plexes and subdisks.
474 In addition, it creates two more directories,
475 .Pa /dev/vinum/vol
476 and
477 .Pa /dev/vinum/drive ,
478 in which it stores hierarchical information for volumes and drives.
479 .It
480 In addition,
481 .Nm
482 creates three super-devices,
483 .Pa /dev/vinum/control ,
484 .Pa /dev/vinum/Control
485 and
486 .Pa /dev/vinum/controld .
487 .Pa /dev/vinum/control
488 is used by
489 .Xr gvinum 8
490 when it has been compiled without the
491 .Dv VINUMDEBUG
492 option,
493 .Pa /dev/vinum/Control
494 is used by
495 .Xr gvinum 8
496 when it has been compiled with the
497 .Dv VINUMDEBUG
498 option, and
499 .Pa /dev/vinum/controld
500 is used by the
501 .Nm
502 daemon.
503 The two control devices for
504 .Xr gvinum 8
505 are used to synchronize the debug status of kernel and user modules.
506 .It
507 Unlike
508 .Ux
509 drives,
510 .Nm
511 volumes are not subdivided into partitions, and thus do not contain a disk
512 label.
513 Unfortunately, this confuses a number of utilities, notably
514 .Xr newfs 8 ,
515 which normally tries to interpret the last letter of a
516 .Nm
517 volume name as a partition identifier.
518 If you use a volume name which does not
519 end in the letters
520 .Ql a
521 to
522 .Ql c ,
523 you must use the
524 .Fl v
525 flag to
526 .Xr newfs 8
527 in order to tell it to ignore this convention.
528 .\"
529 .It
530 Plexes do not need to be assigned explicit names.
531 By default, a plex name is
532 the name of the volume followed by the letters
533 .Pa .p
534 and the number of the
535 plex.
536 For example, the plexes of volume
537 .Pa vol3
538 are called
539 .Pa vol3.p0 , vol3.p1
540 and so on.
541 These names can be overridden, but it is not recommended.
542 .It
543 Like plexes, subdisks are assigned names automatically, and explicit naming is
544 discouraged.
545 A subdisk name is the name of the plex followed by the letters
546 .Pa .s
547 and a number identifying the subdisk.
548 For example, the subdisks of
549 plex
550 .Pa vol3.p0
551 are called
552 .Pa vol3.p0.s0 , vol3.p0.s1
553 and so on.
554 .It
555 By contrast,
556 .Em drives
557 must be named.
558 This makes it possible to move a drive to a different location
559 and still recognize it automatically.
560 Drive names may be up to 32 characters
561 long.
562 .El
563 .Ss Example
564 Assume the
565 .Nm
566 objects described in the section
567 .Sx "CONFIGURATION FILE"
568 in
569 .Xr gvinum 8 .
570 The directory
571 .Pa /dev/vinum
572 looks like:
573 .Bd -literal -offset indent
574 # ls -lR /dev/vinum
575 total 5
576 brwxr-xr--  1 root  wheel   25,   2 Mar 30 16:08 concat
577 brwx------  1 root  wheel   25, 0x40000000 Mar 30 16:08 control
578 brwx------  1 root  wheel   25, 0x40000001 Mar 30 16:08 controld
579 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 drive
580 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 plex
581 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 rvol
582 drwxrwxrwx  2 root  wheel       512 Mar 30 16:08 sd
583 brwxr-xr--  1 root  wheel   25,   3 Mar 30 16:08 strcon
584 brwxr-xr--  1 root  wheel   25,   1 Mar 30 16:08 stripe
585 brwxr-xr--  1 root  wheel   25,   0 Mar 30 16:08 tinyvol
586 drwxrwxrwx  7 root  wheel       512 Mar 30 16:08 vol
587 brwxr-xr--  1 root  wheel   25,   4 Mar 30 16:08 vol5
588
589 /dev/vinum/drive:
590 total 0
591 brw-r-----  1 root  operator    4,  15 Oct 21 16:51 drive2
592 brw-r-----  1 root  operator    4,  31 Oct 21 16:51 drive4
593
594 /dev/vinum/plex:
595 total 0
596 brwxr-xr--  1 root  wheel   25, 0x10000002 Mar 30 16:08 concat.p0
597 brwxr-xr--  1 root  wheel   25, 0x10010002 Mar 30 16:08 concat.p1
598 brwxr-xr--  1 root  wheel   25, 0x10000003 Mar 30 16:08 strcon.p0
599 brwxr-xr--  1 root  wheel   25, 0x10010003 Mar 30 16:08 strcon.p1
600 brwxr-xr--  1 root  wheel   25, 0x10000001 Mar 30 16:08 stripe.p0
601 brwxr-xr--  1 root  wheel   25, 0x10000000 Mar 30 16:08 tinyvol.p0
602 brwxr-xr--  1 root  wheel   25, 0x10000004 Mar 30 16:08 vol5.p0
603 brwxr-xr--  1 root  wheel   25, 0x10010004 Mar 30 16:08 vol5.p1
604
605 /dev/vinum/sd:
606 total 0
607 brwxr-xr--  1 root  wheel   25, 0x20000002 Mar 30 16:08 concat.p0.s0
608 brwxr-xr--  1 root  wheel   25, 0x20100002 Mar 30 16:08 concat.p0.s1
609 brwxr-xr--  1 root  wheel   25, 0x20010002 Mar 30 16:08 concat.p1.s0
610 brwxr-xr--  1 root  wheel   25, 0x20000003 Mar 30 16:08 strcon.p0.s0
611 brwxr-xr--  1 root  wheel   25, 0x20100003 Mar 30 16:08 strcon.p0.s1
612 brwxr-xr--  1 root  wheel   25, 0x20010003 Mar 30 16:08 strcon.p1.s0
613 brwxr-xr--  1 root  wheel   25, 0x20110003 Mar 30 16:08 strcon.p1.s1
614 brwxr-xr--  1 root  wheel   25, 0x20000001 Mar 30 16:08 stripe.p0.s0
615 brwxr-xr--  1 root  wheel   25, 0x20100001 Mar 30 16:08 stripe.p0.s1
616 brwxr-xr--  1 root  wheel   25, 0x20000000 Mar 30 16:08 tinyvol.p0.s0
617 brwxr-xr--  1 root  wheel   25, 0x20100000 Mar 30 16:08 tinyvol.p0.s1
618 brwxr-xr--  1 root  wheel   25, 0x20000004 Mar 30 16:08 vol5.p0.s0
619 brwxr-xr--  1 root  wheel   25, 0x20100004 Mar 30 16:08 vol5.p0.s1
620 brwxr-xr--  1 root  wheel   25, 0x20010004 Mar 30 16:08 vol5.p1.s0
621 brwxr-xr--  1 root  wheel   25, 0x20110004 Mar 30 16:08 vol5.p1.s1
622
623 /dev/vinum/vol:
624 total 5
625 brwxr-xr--  1 root  wheel   25,   2 Mar 30 16:08 concat
626 drwxr-xr-x  4 root  wheel       512 Mar 30 16:08 concat.plex
627 brwxr-xr--  1 root  wheel   25,   3 Mar 30 16:08 strcon
628 drwxr-xr-x  4 root  wheel       512 Mar 30 16:08 strcon.plex
629 brwxr-xr--  1 root  wheel   25,   1 Mar 30 16:08 stripe
630 drwxr-xr-x  3 root  wheel       512 Mar 30 16:08 stripe.plex
631 brwxr-xr--  1 root  wheel   25,   0 Mar 30 16:08 tinyvol
632 drwxr-xr-x  3 root  wheel       512 Mar 30 16:08 tinyvol.plex
633 brwxr-xr--  1 root  wheel   25,   4 Mar 30 16:08 vol5
634 drwxr-xr-x  4 root  wheel       512 Mar 30 16:08 vol5.plex
635
636 /dev/vinum/vol/concat.plex:
637 total 2
638 brwxr-xr--  1 root  wheel   25, 0x10000002 Mar 30 16:08 concat.p0
639 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 concat.p0.sd
640 brwxr-xr--  1 root  wheel   25, 0x10010002 Mar 30 16:08 concat.p1
641 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 concat.p1.sd
642
643 /dev/vinum/vol/concat.plex/concat.p0.sd:
644 total 0
645 brwxr-xr--  1 root  wheel   25, 0x20000002 Mar 30 16:08 concat.p0.s0
646 brwxr-xr--  1 root  wheel   25, 0x20100002 Mar 30 16:08 concat.p0.s1
647
648 /dev/vinum/vol/concat.plex/concat.p1.sd:
649 total 0
650 brwxr-xr--  1 root  wheel   25, 0x20010002 Mar 30 16:08 concat.p1.s0
651
652 /dev/vinum/vol/strcon.plex:
653 total 2
654 brwxr-xr--  1 root  wheel   25, 0x10000003 Mar 30 16:08 strcon.p0
655 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 strcon.p0.sd
656 brwxr-xr--  1 root  wheel   25, 0x10010003 Mar 30 16:08 strcon.p1
657 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 strcon.p1.sd
658
659 /dev/vinum/vol/strcon.plex/strcon.p0.sd:
660 total 0
661 brwxr-xr--  1 root  wheel   25, 0x20000003 Mar 30 16:08 strcon.p0.s0
662 brwxr-xr--  1 root  wheel   25, 0x20100003 Mar 30 16:08 strcon.p0.s1
663
664 /dev/vinum/vol/strcon.plex/strcon.p1.sd:
665 total 0
666 brwxr-xr--  1 root  wheel   25, 0x20010003 Mar 30 16:08 strcon.p1.s0
667 brwxr-xr--  1 root  wheel   25, 0x20110003 Mar 30 16:08 strcon.p1.s1
668
669 /dev/vinum/vol/stripe.plex:
670 total 1
671 brwxr-xr--  1 root  wheel   25, 0x10000001 Mar 30 16:08 stripe.p0
672 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 stripe.p0.sd
673
674 /dev/vinum/vol/stripe.plex/stripe.p0.sd:
675 total 0
676 brwxr-xr--  1 root  wheel   25, 0x20000001 Mar 30 16:08 stripe.p0.s0
677 brwxr-xr--  1 root  wheel   25, 0x20100001 Mar 30 16:08 stripe.p0.s1
678
679 /dev/vinum/vol/tinyvol.plex:
680 total 1
681 brwxr-xr--  1 root  wheel   25, 0x10000000 Mar 30 16:08 tinyvol.p0
682 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 tinyvol.p0.sd
683
684 /dev/vinum/vol/tinyvol.plex/tinyvol.p0.sd:
685 total 0
686 brwxr-xr--  1 root  wheel   25, 0x20000000 Mar 30 16:08 tinyvol.p0.s0
687 brwxr-xr--  1 root  wheel   25, 0x20100000 Mar 30 16:08 tinyvol.p0.s1
688
689 /dev/vinum/vol/vol5.plex:
690 total 2
691 brwxr-xr--  1 root  wheel   25, 0x10000004 Mar 30 16:08 vol5.p0
692 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 vol5.p0.sd
693 brwxr-xr--  1 root  wheel   25, 0x10010004 Mar 30 16:08 vol5.p1
694 drwxr-xr-x  2 root  wheel       512 Mar 30 16:08 vol5.p1.sd
695
696 /dev/vinum/vol/vol5.plex/vol5.p0.sd:
697 total 0
698 brwxr-xr--  1 root  wheel   25, 0x20000004 Mar 30 16:08 vol5.p0.s0
699 brwxr-xr--  1 root  wheel   25, 0x20100004 Mar 30 16:08 vol5.p0.s1
700
701 /dev/vinum/vol/vol5.plex/vol5.p1.sd:
702 total 0
703 brwxr-xr--  1 root  wheel   25, 0x20010004 Mar 30 16:08 vol5.p1.s0
704 brwxr-xr--  1 root  wheel   25, 0x20110004 Mar 30 16:08 vol5.p1.s1
705 .Ed
706 .Pp
707 In the case of unattached plexes and subdisks, the naming is reversed.
708 Subdisks
709 are named after the disk on which they are located, and plexes are named after
710 the subdisk.
711 .\" XXX
712 .Bf -symbolic
713 This mapping is still to be determined.
714 .Ef
715 .Ss Object States
716 Each
717 .Nm
718 object has a
719 .Em state
720 associated with it.
721 .Nm
722 uses this state to determine the handling of the object.
723 .Ss Volume States
724 Volumes may have the following states:
725 .Bl -hang -width 14n
726 .It Em down
727 The volume is completely inaccessible.
728 .It Em up
729 The volume is up and at least partially functional.
730 Not all plexes may be
731 available.
732 .El
733 .Ss "Plex States"
734 Plexes may have the following states:
735 .Bl -hang -width 14n
736 .It Em referenced
737 A plex entry which has been referenced as part of a volume, but which is
738 currently not known.
739 .It Em faulty
740 A plex which has gone completely down because of I/O errors.
741 .It Em down
742 A plex which has been taken down by the administrator.
743 .It Em initializing
744 A plex which is being initialized.
745 .El
746 .Pp
747 The remaining states represent plexes which are at least partially up.
748 .Bl -hang -width 14n
749 .It Em corrupt
750 A plex entry which is at least partially up.
751 Not all subdisks are available,
752 and an inconsistency has occurred.
753 If no other plex is uncorrupted, the volume
754 is no longer consistent.
755 .It Em degraded
756 A RAID-5 plex entry which is accessible, but one subdisk is down, requiring
757 recovery for many I/O requests.
758 .It Em flaky
759 A plex which is really up, but which has a reborn subdisk which we do not
760 completely trust, and which we do not want to read if we can avoid it.
761 .It Em up
762 A plex entry which is completely up.
763 All subdisks are up.
764 .El
765 .Ss "Subdisk States"
766 Subdisks can have the following states:
767 .Bl -hang -width 14n
768 .It Em empty
769 A subdisk entry which has been created completely.
770 All fields are correct, and
771 the disk has been updated, but the on the disk is not valid.
772 .It Em referenced
773 A subdisk entry which has been referenced as part of a plex, but which is
774 currently not known.
775 .It Em initializing
776 A subdisk entry which has been created completely and which is currently being
777 initialized.
778 .El
779 .Pp
780 The following states represent invalid data.
781 .Bl -hang -width 14n
782 .It Em obsolete
783 A subdisk entry which has been created completely.
784 All fields are correct, the
785 config on disk has been updated, and the data was valid, but since then the
786 drive has been taken down, and as a result updates have been missed.
787 .It Em stale
788 A subdisk entry which has been created completely.
789 All fields are correct, the
790 disk has been updated, and the data was valid, but since then the drive has been
791 crashed and updates have been lost.
792 .El
793 .Pp
794 The following states represent valid, inaccessible data.
795 .Bl -hang -width 14n
796 .It Em crashed
797 A subdisk entry which has been created completely.
798 All fields are correct, the
799 disk has been updated, and the data was valid, but since then the drive has gone
800 down.
801 No attempt has been made to write to the subdisk since the crash, so the
802 data is valid.
803 .It Em down
804 A subdisk entry which was up, which contained valid data, and which was taken
805 down by the administrator.
806 The data is valid.
807 .It Em reviving
808 The subdisk is currently in the process of being revived.
809 We can write but not
810 read.
811 .El
812 .Pp
813 The following states represent accessible subdisks with valid data.
814 .Bl -hang -width 14n
815 .It Em reborn
816 A subdisk entry which has been created completely.
817 All fields are correct, the
818 disk has been updated, and the data was valid, but since then the drive has gone
819 down and up again.
820 No updates were lost, but it is possible that the subdisk
821 has been damaged.
822 We will not read from this subdisk if we have a choice.
823 If this
824 is the only subdisk which covers this address space in the plex, we set its
825 state to up under these circumstances, so this status implies that there is
826 another subdisk to fulfill the request.
827 .It Em up
828 A subdisk entry which has been created completely.
829 All fields are correct, the
830 disk has been updated, and the data is valid.
831 .El
832 .Ss "Drive States"
833 Drives can have the following states:
834 .Bl -hang -width 14n
835 .It Em referenced
836 At least one subdisk refers to the drive, but it is not currently accessible to
837 the system.
838 No device name is known.
839 .It Em down
840 The drive is not accessible.
841 .It Em up
842 The drive is up and running.
843 .El
844 .Sh SEE ALSO
845 .Xr disklabel 5 ,
846 .Xr loader.conf 5 ,
847 .Xr disklabel 8 ,
848 .Xr gvinum 8 ,
849 .Xr loader 8 ,
850 .Xr newfs 8
851 .Sh HISTORY
852 .Nm
853 first appeared in
854 .Fx 3.0 .
855 The RAID-5 component of
856 .Nm
857 was developed by Cybernet Inc.\&
858 .Pq Pa http://www.cybernet.com/ ,
859 for its NetMAX product.
860 .Sh AUTHORS
861 .An Greg Lehey Aq grog@lemis.com .
862 .Sh BUGS
863 .Nm
864 is a new product.
865 Bugs can be expected.
866 The configuration mechanism is not yet
867 fully functional.
868 If you have difficulties, please look at the section
869 .Sx "DEBUGGING PROBLEMS WITH VINUM"
870 before reporting problems.
871 .Pp
872 Kernels with the
873 .Nm
874 device appear to work, but are not supported.
875 If you have trouble with
876 this configuration, please first replace the kernel with a
877 .No non- Ns Nm
878 kernel and test with the KLD module.
879 .Pp
880 Detection of differences between the version of the kernel and the KLD is not
881 yet implemented.
882 .Pp
883 The RAID-5 functionality is new in
884 .Fx 3.3 .
885 Some problems have been
886 reported with
887 .Nm
888 in combination with soft updates, but these are not reproducible on all
889 systems.
890 If you are planning to use
891 .Nm
892 in a production environment, please test carefully.
893 .Sh DEBUGGING PROBLEMS WITH VINUM
894 Solving problems with
895 .Nm
896 can be a difficult affair.
897 This section suggests some approaches.
898 .Ss Configuration problems
899 It is relatively easy (too easy) to run into problems with the
900 .Nm
901 configuration.
902 If you do, the first thing you should do is stop configuration
903 updates:
904 .Pp
905 .Dl "vinum setdaemon 4"
906 .Pp
907 This will stop updates and any further corruption of the on-disk configuration.
908 .Pp
909 Next, look at the on-disk configuration, using a Bourne-style shell:
910 .Bd -literal
911 rm -f log
912 for i in /dev/da0s1h /dev/da1s1h /dev/da2s1h /dev/da3s1h; do
913   (dd if=$i skip=8 count=6|tr -d '\e000-\e011\e200-\e377'; echo) >> log
914 done
915 .Ed
916 .Pp
917 The names of the devices are the names of all
918 .Nm
919 slices.
920 The file
921 .Pa log
922 should then contain something like this:
923 .Bd -literal
924 .if t .ps -3
925 .if t .vs -3
926 IN VINOpanic.lemis.comdrive1}6E7~^K6T^Yfoovolume obj state up
927 volume src state up
928 volume raid state down
929 volume r state down
930 volume foo state up
931 plex name obj.p0 state corrupt org concat vol obj
932 plex name obj.p1 state corrupt org striped 128b vol obj
933 plex name src.p0 state corrupt org striped 128b vol src
934 plex name src.p1 state up org concat vol src
935 plex name raid.p0 state faulty org disorg vol raid
936 plex name r.p0 state faulty org disorg vol r
937 plex name foo.p0 state up org concat vol foo
938 plex name foo.p1 state faulty org concat vol foo
939 sd name obj.p0.s0 drive drive2 plex obj.p0 state reborn len 409600b driveoffset 265b plexoffset 0b
940 sd name obj.p0.s1 drive drive4 plex obj.p0 state up len 409600b driveoffset 265b plexoffset 409600b
941 sd name obj.p1.s0 drive drive1 plex obj.p1 state up len 204800b driveoffset 265b plexoffset 0b
942 sd name obj.p1.s1 drive drive2 plex obj.p1 state reborn len 204800b driveoffset 409865b plexoffset 128b
943 sd name obj.p1.s2 drive drive3 plex obj.p1 state up len 204800b driveoffset 265b plexoffset 256b
944 sd name obj.p1.s3 drive drive4 plex obj.p1 state up len 204800b driveoffset 409865b plexoffset 384b
945 .if t .vs
946 .if t .ps
947 .Ed
948 .Pp
949 The first line contains the
950 .Nm
951 label and must start with the text
952 .Dq Li "IN VINO" .
953 It also contains the name of the system.
954 The exact definition is contained in
955 .Pa /usr/src/sys/dev/vinum/vinumvar.h .
956 The saved configuration starts in the middle of the line with the text
957 .Dq Li "volume obj state up"
958 and starts in sector 9 of the disk.
959 The rest of the output shows the remainder of the on-disk configuration.
960 It
961 may be necessary to increase the
962 .Cm count
963 argument of
964 .Xr dd 1
965 in order to see the complete configuration.
966 .Pp
967 The configuration on all disks should be the same.
968 If this is not the case,
969 please report the problem with the exact contents of the file
970 .Pa log .
971 There is probably little that can be done to recover the on-disk configuration,
972 but if you keep a copy of the files used to create the objects, you should be
973 able to re-create them.
974 The
975 .Ic create
976 command does not change the subdisk data, so this will not cause data
977 corruption.
978 You may need to use the
979 .Ic resetconfig
980 command if you have this kind of trouble.
981 .Ss Kernel Panics
982 In order to analyse a panic which you suspect comes from
983 .Nm
984 you will need to build a debug kernel.
985 See the online handbook at
986 .Pa /usr/share/doc/en/books/developers-handbook/kerneldebug.html
987 (if installed) or
988 .Pa http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-\%handbook/kerneldebug.html
989 for more details of how to do this.
990 .Pp
991 Perform the following steps to analyse a
992 .Nm
993 problem:
994 .Bl -enum
995 .It
996 Copy the following files to the directory in which you will be
997 performing the analysis, typically
998 .Pa /var/crash :
999 .Pp
1000 .Bl -bullet -compact
1001 .It
1002 .Pa /usr/src/sys/modules/vinum/.gdbinit.crash ,
1003 .It
1004 .Pa /usr/src/sys/modules/vinum/.gdbinit.kernel ,
1005 .It
1006 .Pa /usr/src/sys/modules/vinum/.gdbinit.serial ,
1007 .It
1008 .Pa /usr/src/sys/modules/vinum/.gdbinit.vinum
1009 and
1010 .It
1011 .Pa /usr/src/sys/modules/vinum/.gdbinit.vinum.paths
1012 .El
1013 .It
1014 Make sure that you build the
1015 .Nm
1016 module with debugging information.
1017 The standard
1018 .Pa Makefile
1019 builds a module with debugging symbols by default.
1020 If the version of
1021 .Nm
1022 in
1023 .Pa /boot/kernel
1024 does not contain symbols, you will not get an error message, but the stack trace
1025 will not show the symbols.
1026 Check the module before starting
1027 .Xr gdb 1 :
1028 .Bd -literal
1029 $ file /boot/kernel/vinum.ko
1030 /boot/kernel/vinum.ko: ELF 32-bit LSB shared object, Intel 80386,
1031   version 1 (FreeBSD), not stripped
1032 .Ed
1033 .Pp
1034 If the output shows that
1035 .Pa /boot/kernel/vinum.ko
1036 is stripped, you will have to find a version which is not.
1037 Usually this will be
1038 either in
1039 .Pa /usr/obj/sys/modules/vinum/vinum.ko
1040 (if you have built
1041 .Nm
1042 with a
1043 .Dq Li "make world" )
1044 or
1045 .Pa /usr/src/sys/modules/vinum/vinum.ko
1046 (if you have built
1047 .Nm
1048 in this directory).
1049 Modify the file
1050 .Pa .gdbinit.vinum.paths
1051 accordingly.
1052 .It
1053 Either take a dump or use remote serial
1054 .Xr gdb 1
1055 to analyse the problem.
1056 To analyse a dump, say
1057 .Pa /var/crash/vmcore.5 ,
1058 link
1059 .Pa /var/crash/.gdbinit.crash
1060 to
1061 .Pa /var/crash/.gdbinit
1062 and enter:
1063 .Bd -literal -offset indent
1064 cd /var/crash
1065 gdb -k kernel.debug vmcore.5
1066 .Ed
1067 .Pp
1068 This example assumes that you have installed the correct debug kernel at
1069 .Pa /var/crash/kernel.debug .
1070 If not, substitute the correct name of the debug kernel.
1071 .Pp
1072 To perform remote serial debugging,
1073 link
1074 .Pa /var/crash/.gdbinit.serial
1075 to
1076 .Pa /var/crash/.gdbinit
1077 and enter
1078 .Bd -literal -offset indent
1079 cd /var/crash
1080 gdb -k kernel.debug
1081 .Ed
1082 .Pp
1083 In this case, the
1084 .Pa .gdbinit
1085 file performs the functions necessary to establish connection.
1086 The remote
1087 machine must already be in debug mode: enter the kernel debugger and select
1088 .Ic gdb
1089 (see
1090 .Xr ddb 4
1091 for more details).
1092 The serial
1093 .Pa .gdbinit
1094 file expects the serial connection to run at 38400 bits per second; if you run
1095 at a different speed, edit the file accordingly (look for the
1096 .Va remotebaud
1097 specification).
1098 .Pp
1099 The following example shows a remote debugging session using the
1100 .Ic debug
1101 command of
1102 .Xr gvinum 8 :
1103 .Bd -literal
1104 .if t .ps -3
1105 .if t .vs -3
1106 GDB 4.16 (i386-unknown-freebsd), Copyright 1996 Free Software Foundation, Inc.
1107 Debugger (msg=0xf1093174 "vinum debug") at ../../i386/i386/db_interface.c:318
1108 318                 in_Debugger = 0;
1109 #1  0xf108d9bc in vinumioctl (dev=0x40001900, cmd=0xc008464b, data=0xf6dedee0 "",
1110     flag=0x3, p=0xf68b7940) at
1111     /usr/src/sys/modules/Vinum/../../dev/Vinum/vinumioctl.c:102
1112 102             Debugger ("vinum debug");
1113 (kgdb) bt
1114 #0  Debugger (msg=0xf0f661ac "vinum debug") at ../../i386/i386/db_interface.c:318
1115 #1  0xf0f60a7c in vinumioctl (dev=0x40001900, cmd=0xc008464b, data=0xf6923ed0 "",
1116       flag=0x3, p=0xf688e6c0) at
1117       /usr/src/sys/modules/vinum/../../dev/vinum/vinumioctl.c:109
1118 #2  0xf01833b7 in spec_ioctl (ap=0xf6923e0c) at ../../miscfs/specfs/spec_vnops.c:424
1119 #3  0xf0182cc9 in spec_vnoperate (ap=0xf6923e0c) at ../../miscfs/specfs/spec_vnops.c:129
1120 #4  0xf01eb3c1 in ufs_vnoperatespec (ap=0xf6923e0c) at ../../ufs/ufs/ufs_vnops.c:2312
1121 #5  0xf017dbb1 in vn_ioctl (fp=0xf1007ec0, com=0xc008464b, data=0xf6923ed0 "",
1122       p=0xf688e6c0) at vnode_if.h:395
1123 #6  0xf015dce0 in ioctl (p=0xf688e6c0, uap=0xf6923f84) at ../../kern/sys_generic.c:473
1124 #7  0xf0214c0b in syscall (frame={tf_es = 0x27, tf_ds = 0x27, tf_edi = 0xefbfcff8,
1125       tf_esi = 0x1, tf_ebp = 0xefbfcf90, tf_isp = 0xf6923fd4, tf_ebx = 0x2,
1126       tf_edx = 0x804b614, tf_ecx = 0x8085d10, tf_eax = 0x36, tf_trapno = 0x7,
1127       tf_err = 0x2, tf_eip = 0x8060a34, tf_cs = 0x1f, tf_eflags = 0x286,
1128       tf_esp = 0xefbfcf78, tf_ss = 0x27}) at ../../i386/i386/trap.c:1100
1129 #8  0xf020a1fc in Xint0x80_syscall ()
1130 #9  0x804832d in ?? ()
1131 #10 0x80482ad in ?? ()
1132 #11 0x80480e9 in ?? ()
1133 .if t .vs
1134 .if t .ps
1135 .Ed
1136 .Pp
1137 When entering from the debugger, it is important that the source of frame 1
1138 (listed by the
1139 .Pa .gdbinit
1140 file at the top of the example) contains the text
1141 .Dq Li "Debugger (\*[q]vinum debug\*[q]);" .
1142 .Pp
1143 This is an indication that the address specifications are correct.
1144 If you get
1145 some other output, your symbols and the kernel module are out of sync, and the
1146 trace will be meaningless.
1147 .El
1148 .Pp
1149 For an initial investigation, the most important information is the output of
1150 the
1151 .Ic bt
1152 (backtrace) command above.
1153 .Ss Reporting Problems with Vinum
1154 If you find any bugs in
1155 .Nm ,
1156 please report them to
1157 .An Greg Lehey Aq grog@lemis.com .
1158 Supply the following
1159 information:
1160 .Bl -bullet
1161 .It
1162 The output of the
1163 .Nm vinum Cm list
1164 command
1165 (see
1166 .Xr gvinum 8 ) .
1167 .It
1168 Any messages printed in
1169 .Pa /var/log/messages .
1170 All such messages will be identified by the text
1171 .Dq Li vinum
1172 at the beginning.
1173 .It
1174 If you have a panic, a stack trace as described above.
1175 .El