1metainit(1M) System Administration Commands metainit(1M)
2
3
4
6 metainit - configure metadevices
7
9 /sbin/metainit -h
10
11
12 /sbin/metainit [generic options] concat/stripe numstripes width
13 component... [-i interlace]
14
15
16 /sbin/metainit [width component... [-i interlace]]
17 [-h hot_spare_pool]
18
19
20 /sbin/metainit [generic options] mirror -m submirror
21 [read_options] [write_options]
22 [pass_num]
23
24
25 /sbin/metainit [generic options] RAID -r component...
26 [-i interlace]
27 [-h hot_spare_pool] [-k] [-o original_column_count]
28
29
30 /sbin/metainit [generic options] hot_spare_pool
31 [hotspare...]
32
33
34 /sbin/metainit [generic options] metadevice-name
35
36
37 /sbin/metainit [generic options] -a
38
39
40 /sbin/metainit [generic options] softpart -p [-e] component
41 [-A alignment] size
42
43
44 /sbin/metainit -r
45
46
48 The metainit command configures metadevices and hot spares according to
49 the information specified on the command line. Alternatively, you can
50 run metainit so that it uses configuration entries you specify in the
51 /etc/lvm/md.tab file (see md.tab(4)). All metadevices must be set up by
52 the metainit command before they can be used.
53
54
55 Solaris Volume Manager supports storage devices and logical volumes
56 greater than 1 terabyte (TB) when a system runs a 64-bit Solaris ker‐
57 nel. Support for large volumes is automatic. If a device greater than 1
58 TB is created, Solaris Volume Manager configures it appropriately and
59 without user intervention.
60
61
62 If a system with large volumes is rebooted under a 32-bit Solaris ker‐
63 nel, the large volumes are visible through metastat output. Large vol‐
64 umes cannot be accessed, modified or deleted, and no new large volumes
65 can be created. Any volumes or file systems on a large volume in this
66 situation are unavailable. If a system with large volumes is rebooted
67 under a version of Solaris prior to the Solaris 9 4/03 release, Solaris
68 Volume Manager does not start. You must remove all large volumes before
69 Solaris Volume Manager runs under an earlier version of the Solaris
70 Operating System.
71
72
73 If you edit the /etc/lvm/md.tab file to configure metadevices, specify
74 one complete configuration entry per line. You then run the metainit
75 command with either the -a option, to activate all metadevices you
76 entered in the /etc/lvm/md.tab file, or with the metadevice name corre‐
77 sponding to a specific configuration entry.
78
79
80 metainit does not maintain the state of the volumes that would have
81 been created when metainit is run with both the -a and -n flags. Any
82 volumes in md.tab that have dependencies on other volumes in md.tab are
83 reported as errors when metainit -a -n is run, although the operations
84 might succeed when metainit -a is run. See md.tab(4).
85
86
87 Solaris Volume Manager never updates the /etc/lvm/md.tab file. Complete
88 configuration information is stored in the metadevice state database,
89 not md.tab. The only way information appears in md.tab is through edit‐
90 ing it by hand.
91
92
93 When setting up a disk mirror, the first step is to use metainit create
94 a one-on-one concatenation for the root slice. See EXAMPLES.
95
97 The following options are supported:
98
99 Generic Options
100 Root privileges are required for all of the following options except
101 -h.
102
103
104 The following generic options are supported:
105
106 -f
107
108 Forces the metainit command to continue even if one of the slices
109 contains a mounted file system or is being used as swap, or if the
110 stripe being created is smaller in size than the underlying soft
111 partition. This option is required when configuring mirrors on root
112 (/), swap, and /usr.
113
114
115 -h
116
117 Displays usage message.
118
119
120 -n
121
122 Checks the syntax of your command line or md.tab entry without
123 actually setting up the metadevice. If used with -a, all devices
124 are checked but not initialized.
125
126
127 -r
128
129 Only used in a shell script at boot time. Sets up all metadevices
130 that were configured before the system crashed or was shut down.
131 The information about previously configured metadevices is stored
132 in the metadevice state database (see metadb(1M)).
133
134
135 -s setname
136
137 Specifies the name of the diskset on which metainit works. Without
138 the -s option, the metainit command operates on your local metade‐
139 vices and/or hotspares.
140
141
142 Concat/Stripe Options
143 The following concat/stripe options are supported:
144
145 concat/stripe
146
147 Specifies the metadevice name of the concatenation, stripe, or con‐
148 catenation of stripes being defined.
149
150
151 numstripes
152
153 Specifies the number of individual stripes in the metadevice. For a
154 simple stripe, numstripes is always 1. For a concatenation, num‐
155 stripes is equal to the number of slices. For a concatenation of
156 stripes, numstripes varies according to the number of stripes.
157
158
159 width
160
161 Specifies the number of slices that make up a stripe. When width is
162 greater than 1, the slices are striped.
163
164
165 component
166
167 The logical name for the physical slice (partition) on a disk
168 drive, such as /dev/dsk/c0t0d0s0. For RAID level 5 metadevices, a
169 minimum of three slices is necessary to enable striping of the par‐
170 ity information across slices.
171
172
173 -i interlace
174
175 Specifies the interlace size. This value tells Solaris Volume Man‐
176 ager how much data to place on a slice of a striped or RAID level 5
177 metadevice before moving on to the next slice. interlace is a spec‐
178 ified value, followed by either `k' for kilobytes, `m' for
179 megabytes, or `b' for blocks. The characters can be either upper‐
180 case or lowercase. The interlace specified cannot be less than 16
181 blocks, or greater than 100 megabytes. If interlace is not speci‐
182 fied, it defaults to 512 kilobytes.
183
184
185 -h hot_spare_pool
186
187 Specifies the hot_spare_pool to be associated with the metadevice.
188 If you use the command line, the hot spare pool must have been pre‐
189 viously created by the metainit command before it can be associated
190 with a metadevice. Use /-h hspnnn when the concat/stripe being cre‐
191 ated is to be used as a submirror.
192
193 Names for hot spare pools can be any legal file name that is com‐
194 posed of alphanumeric characters, a dash ("-"), an underscore
195 ("_"), or a period ("."). Names must begin with a letter. The words
196 "all" and "none" are reserved and cannot be used.
197
198
199 Mirror Options
200 The following mirror options are supported:
201
202 mirror -m submirror
203
204 Specifies the metadevice name of the mirror. The -m indicates that
205 the configuration is a mirror. submirror is a metadevice (stripe or
206 concatentation) that makes up the initial one-way mirror. Solaris
207 Volume Manager supports a maximum of four-way mirroring. When
208 defining mirrors, first create the mirror with the metainit command
209 as a one-way mirror. Then attach subsequent submirrors using the
210 metattach command. This method ensures that Solaris Volume Manager
211 properly syncs the mirrors. (The second and any subsequent submir‐
212 rors are first created using the metainit command.)
213
214
215 read_options
216
217 The following read options for mirrors are supported:
218
219 -g
220
221 Enables the geometric read option, which results in faster per‐
222 formance on sequential reads.
223
224
225 -r
226
227 Directs all reads to the first submirror. This should only be
228 used when the devices comprising the first submirror are sub‐
229 stantially faster than those of the second mirror. This flag
230 cannot be used with the -g flag.
231
232 If neither the -g nor -r flags are specified, reads are made in a
233 round-robin order from all submirrors in the mirror. This enables
234 load balancing across the submirrors.
235
236
237 write_options
238
239 The following write options for mirrors are supported:
240
241 -S
242
243 Performs serial writes to mirrors. The first submirror write
244 completes before the second is started. This can be useful if
245 hardware is susceptible to partial sector failures. If -S is
246 not specified, writes are replicated and dispatched to all mir‐
247 rors simultaneously.
248
249
250
251 pass_num
252
253 A number in the range 0-9 at the end of an entry defining a mirror
254 that determines the order in which that mirror is resynced during a
255 reboot. The default is 1. Smaller pass numbers are resynced first.
256 Equal pass numbers are run concurrently. If 0 is used, the resync
257 is skipped. 0 should be used only for mirrors mounted as read-only,
258 or as swap.
259
260
261 RAID Level 5 Options
262 The following RAID level 5 options are available:
263
264 RAID -r
265
266 Specifies the name of the RAID level 5 metadevice. The -r specifies
267 that the configuration is RAID level 5.
268
269
270 -k
271
272 For RAID level 5 metadevices, informs the driver that it is not to
273 initialize (zero the disk blocks) due to existing data. Only use
274 this option to recreate a previously created RAID level 5 device.
275
276 Use the -k option with extreme caution. This option sets the disk
277 blocks to the OK state. If any errors exist on disk blocks within
278 the metadevice, Solaris Volume Manager might begin fabricating
279 data. Instead of using the -k option, you might want to initialize
280 the device and restore data from tape.
281
282
283 -o original_column_count
284
285 For RAID level 5 metadevices, used with the -k option to define the
286 number of original slices in the event the originally defined
287 metadevice was grown. This is necessary since the parity segments
288 are not striped across concatenated devices.
289
290 Use the -o option with extreme caution. This option sets the disk
291 blocks to the OK state. If any errors exist on disk blocks within
292 the metadevice, Solaris Volume Manager might begin fabricating
293 data. Instead of using the -o option, you might want to initialize
294 the device and restore data from tape.
295
296
297 Soft Partition Options
298 The following soft partition options are supported:
299
300 softpart -p [-e] component [-A alignment] size
301
302 The softpart argument specifies the name of the soft partition. The
303 -p specifies that the configuration is a soft partition.
304
305 The -e specifies that the entire disk specified by component as
306 c*t*d* should be repartitioned and reserved for soft partitions.
307 The specified component is repartitioned such that slice 7 reserves
308 space for system (state database replica) usage and slice 0 con‐
309 tains all remaining space on the disk. Slice 7 is a minimum of 4MB,
310 but can be larger, depending on the disk geometry. The newly cre‐
311 ated soft partition is placed on slice 0 of the device.
312
313 The component argument specifies the disk (c*t*d*), slice
314 (c*t*d*s*), or meta device (d*) from which to create the soft par‐
315 tition. The size argument determines the space to use for the soft
316 partition and can be specified in K or k for kilobytes, M or m for
317 megabytes, G or g for gigabytes, T or t for terabyte (one terabyte
318 is the maximum size), and B or b for blocks (sectors). All values
319 represent powers of 2, and upper and lower case options are equiva‐
320 lent. Only integer values are permitted.
321
322 The -A alignment option sets the value of the soft partition extent
323 alignment. This option used when it is important specify a starting
324 offset for the soft partition. It preserves the data alignment
325 between the metadevice address space and the address space of the
326 underlying physical device. For example, a hardware device that
327 does checksumming should not have its I/O requests divided by
328 Solaris Volume Manager. In this case, use a value from the hardware
329 configuration as the value for the alignment. When you use this
330 option in conjunction with a software I/O load, the alignment value
331 corresponds to the I/O load of the application. This prevents I/O
332 from being divided unnecessarily and affecting performance.
333
334 The literal all, used instead of specifying size, specifies that
335 the soft partition should occupy all available space on the device.
336
337
338 Hot Spare Pool Options
339 The following hot spare pool options are supported:
340
341 hot_spare_pool [ hotspare... ]
342
343 When used as arguments to the metainit command, hot_spare_pool
344 defines the name for a hot spare pool, and hotspare... is the logi‐
345 cal name for the physical slice(s) for availability in that pool.
346 Names for hot spare pools can be any legal file name that is com‐
347 posed of alphanumeric characters, a dash ("-"), an underscore
348 ("_"), or a period ("."). Names must begin with a letter. The words
349 "all" and "none" are reserved and cannot be used.
350
351
352 md.tab File Options
353 The following md.tab file options are supported:
354
355 metadevice-name
356
357 When the metainit command is run with a metadevice-name as its only
358 argument, it searches the /etc/lvm/md.tab file to find that name
359 and its corresponding entry. The order in which entries appear in
360 the md.tab file is unimportant. For example, consider the following
361 md.tab entry:
362
363 d0 2 1 c1t0d0s0 1 c2t1d0s0
364
365
366 When you run the command metainit d0, it configures metadevice d0
367 based on the configuration information found in the md.tab file.
368
369
370 -a
371
372 Activates all metadevices defined in the md.tab file.
373
374 metainit does not maintain the state of the volumes that would have
375 been created when metainit is run with both the -a and -n flags. If
376 a device d0 is created in the first line of the md.tab file, and a
377 later line in md.tab assumes the existence of d0, the later line
378 fails when metainit -an runs (even if it would succeed with
379 metainit -a).
380
381
383 Example 1 Creating a One-on-One Concatenation
384
385
386 The following command creates a one-on-one concatenation for the root
387 slice. This is the first step you take when setting up a mirror for the
388 root slice (and any other slice that cannot be unmounted). The -f
389 option is required to create a volume with an existing file system,
390 such as root(/).
391
392
393 # metainit -f dl 1 1 c0t0d0s0
394
395
396
397
398 The preceding command makes d1 a one-on-one concatenation, using the
399 root slice. You can then enter:
400
401
402 # metainit d0 -m d1
403
404
405
406
407 ...to make a one-way mirror of the root slice.
408
409
410 Example 2 Concatenation
411
412
413 All drives in the following examples have the same size of 525 Mbytes.
414
415
416
417 This example shows a metadevice, /dev/md/dsk/d7, consisting of a con‐
418 catenation of four slices.
419
420
421 # metainit d7 4 1 c0t1d0s0 1 c0t2d0s0 1 c0t3d0s0 1 /dev/dsk/c0t4d0s0
422
423
424
425
426 The number 4 indicates there are four individual stripes in the con‐
427 catenation. Each stripe is made of one slice, hence the number 1
428 appears in front of each slice. The first disk sector in all of these
429 devices contains a disk label. To preserve the labels on devices
430 /dev/dsk/c0t2d0s0, /dev/dsk/c0t3d0s0, and /dev/dsk/c0t4d0s0, the
431 metadisk driver must skip at least the first sector of those disks when
432 mapping accesses across the concatenation boundaries. Because skipping
433 only the first sector would create an irregular disk geometry, the
434 entire first cylinder of these disks is skipped. This allows higher
435 level file system software to optimize block allocations correctly.
436
437
438 Example 3 Stripe
439
440
441 This example shows a metadevice, /dev/md/dsk/d15, consisting of two
442 slices.
443
444
445 # metainit d15 1 2 c0t1d0s0 c0t2d0s0 -i 32k
446
447
448
449
450 The number 1 indicates that one stripe is being created. Because the
451 stripe is made of two slices, the number 2 follows next. The optional
452 -i followed by 32k specifies the interlace size as 32 Kbytes. If the
453 interlace size were not specified, the stripe would use the default
454 value of 16 Kbytes.
455
456
457 Example 4 Concatentation of Stripes
458
459
460 This example shows a metadevice, /dev/md/dsk/d75, consisting of a con‐
461 catenation of two stripes of three disks.
462
463
464 # metainit d75 2 3 c0t1d0s0 c0t2d0s0 \
465 c0t3d0s0 -i 16k \
466 3 c1t1d0s0 c1t2d0s0 c1t3d0s0 -i 32k
467
468
469
470
471 On the first line, the -i followed by 16k specifies that the stripe
472 interlace size is 16 Kbytes. The second set specifies the stripe inter‐
473 lace size as 32 Kbytes. If the second set did not specify 32 Kbytes,
474 the set would use the default interlace value of 16 Kbytes. The blocks
475 of each set of three disks are interlaced across three disks.
476
477
478 Example 5 Mirroring
479
480
481 This example shows a two-way mirror, /dev/md/dsk/d50, consisting of two
482 submirrors. This mirror does not contain any existing data.
483
484
485 # metainit d51 1 1 c0t1d0s0
486 # metainit d52 1 1 c0t2d0s0
487 # metainit d50 -m d51
488 # metattach d50 d52
489
490
491
492
493 In this example, two submirrors, d51 and d52, are created with the
494 metainit command. These two submirrors are simple concatenations. Next,
495 a one-way mirror, d50, is created using the -m option with d51. The
496 second submirror is attached later using the metattach command. When
497 creating a mirror, any combination of stripes and concatenations can be
498 used. The default read and write options in this example are a round-
499 robin read algorithm and parallel writes to all submirrors.
500
501
502 Example 6 Creating a metadevice in a diskset
503
504
505 This example shows a metadevice, /dev/md/dsk/d75, consisting of a con‐
506 catenation of two stripes within a diskset called set1.
507
508
509 # metainit -s set1 d75 2 3 c2t1d0s0 c2t2d0s0 \
510 c2t3d0s0 -i 32k
511 # metainit -s set1 d51 1 1 c2t1d0s0
512 # metainit -s set1 d52 1 1 c3t1d0s0
513 # metainit -s set1 d50 -m d51
514 # metattach -s set1 d50 d52
515
516
517
518
519 In this example, a diskset is created using the metaset command.
520 Metadevices are then created within the diskset using the metainit com‐
521 mand. The two submirrors, d51 and d52, are simple concatenations. Next,
522 a one-way mirror, d50, is created using the -m option with d51. The
523 second submirror is attached later using the metattach command. When
524 creating a mirror, any combination of stripes and concatenations can be
525 used. The default read and write options in this example are a round-
526 robin read algorithm and parallel writes to all submirrors.
527
528
529 Example 7 RAID Level 5
530
531
532 This example shows a RAID level 5 device, d80, consisting of three
533 slices:
534
535
536 # metainit d80 -r c1t0d0s0 c1t1d0s0 c1t3d0s0 -i 20k
537
538
539
540
541 In this example, a RAID level 5 metadevice is defined using the -r
542 option with an interlace size of 20 Kbytes. The data and parity seg‐
543 ments are striped across the slices, c1t0d0s0, c1t2d0s0, and c1t3d0s0.
544
545
546 Example 8 Soft Partition
547
548
549 The following example shows a soft partition device, d1, built on
550 metadevice d100 and 100 Mbytes (indicated by 100M) in size:
551
552
553 # metainit d1 -p d100 100M
554
555
556
557
558 The preceding command creates a 100 Mbyte soft partition on the d100
559 metadevice. This metadevice could be a RAID level 5, stripe, concatena‐
560 tion, or mirror.
561
562
563 Example 9 Soft Partition on Full Disk
564
565
566 The following example shows a soft partition device, d1, built on disk
567 c3t4d0:
568
569
570 # metainit d1 -p -e c3t4d0 9G
571
572
573
574
575 In this example, the disk is repartitioned and a soft partition is
576 defined to occupy all 9 Gbytes of disk c3t4d0s0.
577
578
579 Example 10 Soft Partition Taking All Available Space
580
581
582 The following example shows a soft partition device, d1, built on disk
583 c3t4d0:
584
585
586 # metainit d1 -p -e c3t4d0 all
587
588
589
590
591 In this example, the disk is repartitioned and a soft partition is
592 defined to occupy all available disk space on slice c3t4d0s0.
593
594
595 Example 11 Hot Spare
596
597
598 This example shows a two-way mirror, /dev/md/dsk/d10, and a hot spare
599 pool with three hot spare components. The mirror does not contain any
600 existing data.
601
602
603 # metainit hsp001 c2t2d0s0 c3t2d0s0 c1t2d0s0
604 # metainit d41 1 1 c1t0d0s0 -h hsp001
605 # metainit d42 1 1 c3t0d0s0 -h hsp001
606 # metainit d40 -m d41
607 # metattach d40 d42
608
609
610
611
612 In this example, a hot spare pool, hsp001, is created with three slices
613 from three different disks used as hot spares. Next, two submirrors are
614 created, d41 and d42. These are simple concatenations. The metainit
615 command uses the -h option to associate the hot spare pool hsp001 with
616 each submirror. A one-way mirror is then defined using the -m option.
617 The second submirror is attached using the metattach command.
618
619
620 Example 12 Setting the Value of the Soft Partition Extent Alignment
621
622
623 This example shows how to set the alignment of the soft partition to 1
624 megabyte.
625
626
627 # metainit -s red d13 -p c1t3d0s4 -A 1m 4m
628
629
630
631
632 In this example the soft partition, d13, is created with an extent
633 alignment of 1 megabyte. The metainit command uses the -A option with
634 an alignment of 1m to define the soft partition extent alignment.
635
636
638 /etc/lvm/md.tab
639
640 Contains list of metadevice and hot spare configurations for batch-
641 like creation.
642
643
645 This section contains information on different types of warnings.
646
647 Devices and Volumes Greater Than 1 TB
648 Do not create large (>1 TB) volumes if you expect to run the Solaris
649 Operating Environment with a 32-bit kernel or if you expect to use a
650 version of the Solaris Operating Environment prior to Solaris 10.
651
652 Multi-Way Mirror
653 Do not use the metainit command to create a multi-way mirror. Rather,
654 create a one-way mirror with metainit then attach additional submirrors
655 with metattach. When the metattach command is not used, no resync oper‐
656 ations occur and data could become corrupted.
657
658
659 If you use metainit to create a mirror with multiple submirrors, the
660 following message is displayed:
661
662 WARNING: This form of metainit is not recommended.
663 The submirrors may not have the same data.
664 Please see ERRORS in metainit(1M) for additional information.
665
666
667
668 Truncation of Soft Partitions
669 When creating stripes on top of soft partitions it is possible for the
670 size of the new stripe to be less than the size of the underlying soft
671 partition. If this occurs, metainit fails with an error indicating the
672 actions required to overcome the failure.
673
674
675 If you use the -f option to override this behavior, the following mes‐
676 sage is displayed:
677
678 WARNING: This form of metainit is not recommended.
679 The stripe is truncating the size of the underlying device.
680 Please see ERRORS in metainit(1M) for additional information.
681
682
683
684 Write-On-Write Problem
685 When mirroring data in Solaris Volume Manager, transfers from memory to
686 the disks do not all occur at exactly the same time for all sides of
687 the mirror. If the contents of buffers are changed while the data is
688 in-flight to the disk (called write-on-write), then different data can
689 end up being stored on each side of a mirror.
690
691
692 This problem can be addressed by making a private copy of the data for
693 mirror writes, however, doing this copy is expensive. Another approach
694 is to detect when memory has been modified across a write by looking at
695 the dirty-bit associated with the memory page. Solaris Volume Manager
696 uses this dirty-bit technique when it can. Unfortunately, this tech‐
697 nique does not work for raw I/O or direct I/O. By default, Solaris Vol‐
698 ume Manager is tuned for performance with the liability that mirrored
699 data might be out of sync if an application does a "write-on-write" to
700 buffers associated with raw I/O or direct I/O. Without mirroring, you
701 were not guaranteed what data would actually end up on media, but mul‐
702 tiple reads would return the same data. With mirroring, multiple reads
703 can return different data. The following line can be added to /etc/sys‐
704 tem to cause a stable copy of the buffers to be used for all raw I/O
705 and direct I/O write operations.
706
707 set md_mirror:md_mirror_wow_flg=0x20
708
709
710
711
712 Setting this flag degrades performance.
713
715 The following exit values are returned:
716
717 0
718
719 Successful completion.
720
721
722 >0
723
724 An error occurred.
725
726
728 See attributes(5) for descriptions of the following attributes:
729
730
731
732
733 ┌─────────────────────────────┬─────────────────────────────┐
734 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
735 ├─────────────────────────────┼─────────────────────────────┤
736 │Availability │SUNWmdr │
737 ├─────────────────────────────┼─────────────────────────────┤
738 │Interface Stability │Stable │
739 └─────────────────────────────┴─────────────────────────────┘
740
742 mdmonitord(1M), metaclear(1M), metadb(1M), metadetach(1M), metahs(1M),
743 metaoffline(1M), metaonline(1M), metaparam(1M), metarecover(1M),
744 metarename(1M), metareplace(1M), metaroot(1M), metaset(1M), metas‐
745 sist(1M), metastat(1M), metasync(1M), metattach(1M), md.tab(4),
746 md.cf(4), mddb.cf(4), md.tab(4), attributes(5), md(7D)
747
748
749
750
752 Recursive mirroring is not allowed; that is, a mirror cannot appear in
753 the definition of another mirror.
754
755
756 Recursive logging is not allowed; that is, a trans metadevice cannot
757 appear in the definition of another metadevice.
758
759
760 Stripes, concatenations, and RAID level 5 metadevices must consist of
761 slices only.
762
763
764 Mirroring of RAID level 5 metadevices is not allowed.
765
766
767 Soft partitions can be built on raw devices, or on stripes, RAID level
768 5, or mirrors.
769
770
771 RAID level 5 or stripe metadevices can be built directly on soft parti‐
772 tions.
773
775 Trans metadevices have been replaced by UFS logging. Existing trans
776 devices are not logging--they pass data directly through to the under‐
777 lying device. See mount_ufs(1M) for more information about UFS logging.
778
779
780
781SunOS 5.11 27 Mar 2006 metainit(1M)