METADISK (Nowadays called "Solaris Volume Manager") ======== The Metadsk package is SUNWmd. Memorize that. Man pages are under /usr/opt/SUNWmd/man. So add that path to your MANPATH. Binaries are in /usr/opt/SUNWmd/sbin. So add that to your PATH. The 2 runtime configuration files (read only!) are /etc/opt/SUNWmd/md.cf: Current metadevice configuration /etc/opt/SUNWmd/mddb.cf: Current metadevice state database configuration You need at least 2, preferably 3, metadisk "state databases". This is just a little slice where Metadisk stores its info. The multiple copies are just for redundancy (for this reason, they should be on different physical disks). Metadisk "devices" are in /etc/md/dsk and /etc/md/rdsk, just like slices are in /etc/dsk and /etc/rdsk. Unlike slices which are named like c0t1d0s3, metadevices are named like d33, i.e., d plus a short integer. /dev/dsk/c0t1d0s3 conventional block slice /dev/md/dsk/d33 metadevice In many cases, some metadisk devices are "part" of another metadisk device. For example, every mirror metadisk device must contain submirrors. Mirror d30 may contain submirrors d31 and d32. In this case, d30 is the "mirror", d31 and d32 the "submirrors". d30 does not store any data directly, d30 stores data by using d31 and d32. But when we want to do mirroring, we only work with d30-- mounting, umounting, df, etc. d30 keeps track of d31 and d32 by itself. You can not mount a containing device and any of its contained devices at the same time. For example, before you can mount d30, both d31 and d32 must be unmounted. Before you can mount d32, d30 must be unmounted (since you intend to use d32 as a submirror, you would normally not have a cause to mount d32). SETTING UP METADISK [POSTNOTE: For part table, I'm using usr/wu. Will see if that works.] First you create your state databases with metadb. You just tell it what slices to use. No need to format it or prepare it in any way, metadb will take care of all that. You can specify the slice by giving cXtYdZsA (no path necessary). Here is the syntax. [POSTNOTE: It used to be that > 1M would do. Now they SAY >= 4, depending on disk geometry. For 17G disks, it FAILS for < 7, but this is probably becuase I'm writing 2 meta databases to each slice. I'm using 16M for now on.] metadb -a -f SLICE1 SLICE2 SLICE3 For example metadb -a -f c0t0d0s7 c0t1d0s7 c0t2d0s7 Then create a metadevice for all metadevices other than mirrors (make the submirrors, but not the mirror). Every device we create will be a concatenation of stripes of slices. POSTNOTE: These devices are called "RAID 0 VOLUMES" in newer Sun docs. By definition, a concatenation of 1 stripe is still called a concatenation, even though no "concatenation" occurs. Similarly, a stripe of 1 slice is a stripe, even though no "striping" occurs. In the simplest case (this scenario is often used for submirrors), a device is defined which contains a single unadulterated slice; this metadevice consists of 1 stripe of 1 slice. You can use this metadevice exactly as you would the underlying slice. IMPORTANT: Other than the case described immediately above (metadisk contains 1 stripe of 1 slice), member slices will NOT be preserved by metainit. If you need to preserve some slices, create the metadevice without those slices then use "growfs" to add them. Here's the syntax to create metadevices (other than mirrors) metainit NEW_DEV_NAME NUMBER_OF_STRIPES STRIPE_1_DEF STRIPE_2_DEF... (You will need the -f switch is a member slice is currently mounted). If our new metadevice contains 3 stripes, then NUMBER_OF_STRIPES is 3, and we must define all three stripes. Each stripe definition looks like NUMBER_OF_SLICES cXtYdZsA cXtYdZsA cXtYdZsA... If the slice contains 4 slices, then we must list 4 slices after the 4. Here's an example. metainit d10 4 2 c0t0d0s3 c0t0d0s4 1 c0t1d0s0 \ 4 c0t1d0s3 c0t1d0s4 c0t1d0s5 c0t1d0s6 1 c0t0d0s5 We are creating a new metadevice "d10" which is a concatenation of "4" stripes. Here are the 4 stripe definitions separated out. 2 c0t0d0s3 c0t0d0s4 1 c0t1d0s0 4 c0t1d0s3 c0t1d0s4 c0t1d0s5 c0t1d0s6 1 c0t0d0s5 Even though no actual striping occurs for the 2nd and 4th stripes, they are still called "stripes" by Metadisk. If you screw something up, you can undefine the metadevice with metaclear (e.g. "metaclear d10"). If you want to get fancy and specify a non-default stripe interlace size (default is 16k), you give a switch for that stripe right after the stripe slices on the metainit line. Example. metainit d10 4 2 c0t0d0s3 c0t0d0s4 -i 32k 1 c0t1d0s0 \ 4 c0t1d0s3 c0t1d0s4 c0t1d0s5 c0t1d0s6 1 c0t0d0s5 Note that I didn't specify an interleave size for the stripes containing only 1 slice because no striping occurs in that case. FORMATTING If you are creating a metadevice for a single slice (i.e. no concatenation or striping), any formatting and data will be preserved. If the partition is currently unused, you can format (with newfs) the slice before running metainit, or format the metadevice after. If you are creating a metadevice of concatenated or striped slices (i.e., if X or Y are > 1), it is not as easy to preserve the data. So, with these concatenated or striped metadevices, you create the metadevice, then format the metadevice (e.g. "newfs d10"). MIRRORING Every elemental metadevice created as above can be a "submirror" (a metadevice used as one "face" of a metadevice mirror). The first submirror should be prepared and formatted (newfs) as you wish before you set up the mirroring. Don' t waste time formatting or working with data on the second submirror, because the second submirror will be overwritten with whatever is on the first submirror. The procedure is very simple. metainit NEW_MIRROR_DEV -m FIRST_SUBMIRROR_DEV For example metainit d1 -m d10 You can not have any underlying slice mounted for the next step. If you can't umount the slice, then edit the vfstab to mount the elemental submirror device instead of the slice, and reboot. The new mirror device may be mounted (d1 in our example), but the underlying devices/partitions may not (d10 or c0t0d0s3 or c0t0d0s4 or c0t1d0s0, etc.) metattach NEW_MIRROR_DEV SECOND_SUBMIRROR_DEV For example metattach d1 d20 and so forth for all additional mirrors. It takes a long time to copy the data from the first submirror to the additional mirrors. Run 'metastat | grep %' to see how far along your metasync's are. CHECKING ON THINGS You can cat the config files listed at the top of this document. You can run metastat to check on metadevices. You can run metadb (with no arguments) to check on metadisk state databases. DISK RECOVER If only protected partitions failed, then change boot disk using OpenBoot, like "setenv boot disk1". Boot on CD single-user or something to disable use of non-protected partitions from failed disk (like swap, /tmp, etc.). Allocate a temp swap file if necessary. Remove metadatabases on the failed disk. ---- Replace disk. Replace partition table. [You should have a prtvtoc file to use with fmthard]. Add non-MD partitions back manually. For swap, "swap -d /tmp/file" and edit recovered setup in /etc/vfstab and run "swapadd". newfs non- protected file systems and mount as usual. Add metadbs back. Tell MD about the replaced disk with "metadevadm -u c0t1d0". Recover the top-level devices, specifying the new slices, like metareplace -e d30 c0t0d0s3 Verify that everthing looks good in metadb. It will take some time for the slices to resync.