This chapter explains how to perform Solaris Volume Manager tasks that are related to RAID-1 volumes. For information about related concepts, see Chapter 10, RAID-1 (Mirror) Volumes (Overview).
The following task map identifies the procedures that are needed to manage Solaris Volume Manager RAID-1 volumes.
Task |
Description |
For Instructions |
---|---|---|
Create a mirror from unused slices |
Use the Solaris Volume Manager GUI or the metainit command to create a mirror from unused slices. | |
Create a mirror from an existing file system |
Use the Solaris Volume Manager GUI or the metainit command to create a mirror from an existing file system. | |
Create a mirror from the root (/) file system |
Use the Solaris Volume Manager GUI or the metainit command to create a mirror from the root (/) file system. |
SPARC: How to Create a RAID-1 Volume From the root (/) File System x86: How to Create a RAID-1 Volume From the root (/) File System |
Attach a submirror |
Use the Solaris Volume Manager GUI or the metattach command to attach a submirror. | |
Detach a submirror |
Use the Solaris Volume Manager GUI or the metadetach command to detach the submirror. | |
Place a submirror online or take a submirror offline |
Use the Solaris Volume Manager GUI or the metaonline command to put a submirror online. Use the Solaris Volume Manager GUI or the metaoffline command to take a submirror offline. | |
Enable a slice within a submirror |
Use the Solaris Volume Manager GUI or the metareplace command to enable a slice in a submirror. | |
Check mirror status |
Use the Solaris Volume Manager GUI or the metastat command to check the status of RAID-1 volumes. | |
Change mirror options |
Use the Solaris Volume Manager GUI or the metaparam command to change the options for a specific RAID-1 volume. | |
Expand a mirror |
Use the Solaris Volume Manager GUI or the metattach command to expand the capacity of a mirror. | |
Replace a slice within a submirror |
Use the Solaris Volume Manager GUI or the metareplace command to replace a slice in a submirror. | |
Replace a submirror |
Use the Solaris Volume Manager GUI or the metattach command to replace a submirror. | |
Remove a mirror (unmirror) |
Use the Solaris Volume Manager GUI, the metadetach command, or the metaclear command to unmirror a file system. | |
Remove a mirror (unmirror) of a file system that cannot be unmounted |
Use the Solaris Volume Manager GUI, the metadetach command, or the metaclear command to unmirror a file system that cannot be unmounted. | |
Use a mirror to perform backups |
Use the Solaris Volume Manager GUI, the metaonline command, or the metaoffline commands to perform backups with mirrors. | |
Cancel or resume the resynchronization process on a mirror |
Use the metasync command to cancel and resume the resynchronization process on a mirror |
This procedure shows you how to create a two-way mirror. If you want to create a three-way mirror or a four-way mirror, use the same procedure.
Check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.
Create two stripes or concatenations. These components become the submirrors.
See How to Create a RAID-0 (Stripe) Volume or How to Create a RAID-0 (Concatenation) Volume.
To create the mirror, use one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume and follow the onscreen instructions. For more information, see the online help.
Use the following form of the metainit command to create a one-way mirror:
# metainit volume-name -m submirror-name |
Specifies the name of the volume to create
Specifies to create a mirror
Specifies the name of the component that will be the first submirror in the mirror
See the following examples and the metainit(1M) man page for more information.
To add the second submirror, use one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the mirror you want to modify. Choose Action⇒Properties, then the Submirrors. Follow the onscreen instructions to attach the submirror. For more information, see the online help.
Use the following form of the metattach command:
# metattach volume-name submirror-name |
Specifies the name of the RAID-1 volume on which to add the submirror
Specifies the name of the component that will be the second submirror attached to the mirror
See the following examples and the metattach(1M) man page for more information.
# metainit d51 1 1 c0t0d0s2 d51: Concat/Stripe is setup # metainit d52 1 1 c1t0d0s2 d52: Concat/Stripe is setup # metainit d50 -m d51 d50: Mirror is setup # metattach d50 d52 d50: Submirror d52 is attached |
This example shows you how to create the two-way mirror, d50. The metainit command creates two submirrors (d51 and d52), which are RAID-0 volumes. The metainit -m command creates the one-way mirror from the d51 RAID-0 volume. The metattach command attaches d52, creating a two-way mirror and causing a resynchronization. Any data on the attached submirror is overwritten by the other submirror during the resynchronization.
# metainit d51 1 1 c0t0d0s2 d51: Concat/Stripe is setup # metainit d52 1 1 c1t0d0s2 d52: Concat/Stripe is setup # metainit d50 -m d51 d52 metainit: d50: WARNING: This form of metainit is not recommended. The submirrors may not have the same data. Please see ERRORS in metainit(1M) for additional information. d50: Mirror is setup |
This example shows the creation a two-way mirror, d50. The metainit command creates two submirrors (d51 and d52), which are RAID-0 volumes. The metainit -m command is then run with both submirrors to create the mirror. When you create a mirror using the metainit command rather than the metattach command , no resynchronization operations occur. As a result, data could become corrupted when Solaris Volume Manager assumes that both sides of the mirror are identical and can be used interchangeably.
To prepare a newly created mirror for a file system, see Chapter 18, Creating UFS, TMPFS, and LOFS File Systems (Tasks), in System Administration Guide: Devices and File Systems. Some applications, such as a database, do not use a file system. These applications instead use the raw device. The application must have its own way of accessing the raw device.
Use this procedure to mirror an existing file system. If the file system can be unmounted, the entire procedure can be completed without a reboot. For file systems that cannot be unmounted, such as /usr and /swap, the system must be rebooted to complete the procedure.
When creating a RAID-1 volume from an existing file system built on a slice, only the single slice may be included in the primary RAID-0 volume (submirror). If you are mirroring system-critical file systems, all submirrors must consist of only a single slice.
For the procedures associated with mirroring the root (/) file system, see SPARC: How to Create a RAID-1 Volume From the root (/) File System and x86: How to Create a RAID-1 Volume From the root (/) File System.
In the example used in this procedure, the existing slice is c1t0d0s0. The second slice, c1t1d0s0, is available for the second half of the mirror. The submirrors are d1 and d2, respectively, and the mirror is d0.
Be sure to create a one-way mirror with the metainit command then attach the additional submirrors with the metattach command. When the metattach command is not used, no resynchronization operations occur. As a result, data could become corrupted when Solaris Volume Manager assumes that both sides of the mirror are identical and can be used interchangeably.
Check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.
Identify the slice that contains the existing file system to be mirrored This example uses the slice c1t0d0s0.
Create a new RAID-0 volume on the slice from the previous step by using one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.
Use the following form of the metainit command:
# metainit -f volume-name number-of-stripes components-per-stripe component-name |
Forces the command to continue. You must use this option when the slice contains a mounted file system.
Specifies the name of the volume to create. For information on naming volumes, see Volume Names.
Specifies the number of stripes to create.
Specifies the number of components each stripe should have.
Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.
Create a second RAID-0 volume (concatenation) on an unused slice (c1t1d0s0 in this example) to act as the second submirror. The second submirror must be the same size as the original submirror or larger. Use one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action->Create Volume and follow the instructions on screen. For more information, see the online help.
Use the following form of the metainit command.
# metainit volume-name number-of-stripes components-per-stripe component-name |
See Step 2 for an explanation of the options.
Create a one-way mirror by using one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.
Use the following form of the metainit command.
# metainit volume-name -m submirror-name |
Specifies the name of the volume to create.
Specifies to create a mirror.
Specifies the name of the component that will be the first submirror in the mirror. In this example, it is the RAID-0 volume that contains the root slice.
See the metainit(1M) man page for more information.
When you create a mirror from an existing file system, you must follow the next two steps precisely to avoid data corruption.
Edit the /etc/vfstab file so that the file system mount instructions refer to the mirror, not to the block device. For more information about the/etc/vfstab file, see Mounting File Systems in System Administration Guide: Devices and File Systems.
For example, if the /etc/vfstab file contains the following entry for the file system:
/dev/dsk/slice /dev/rdsk/slice /var ufs 2 yes - |
Change the entry to read as follows:
/dev/md/dsk/mirror-name /dev/md/rdsk/mirror-name /var ufs 2 yes - |
Remount your newly mirrored file system according to one of the following procedures:
If you are mirroring a file system that can be unmounted, then unmount and remount the file system.
# umount /filesystem # mount /filesystem |
If you are mirroring a file system that cannot be unmounted, then reboot your system.
# reboot |
Use the following form of the metattach command to attach the second submirror.
# metattach volume-name submirror-name |
Specifies the name of the RAID-1 volume on which to add the submirror
Specifies the name of the component that will be the second submirror attached to the mirror
See the metattach(1M) man page for more information.
# metainit -f d1 1 1 c1t0d0s0 d1: Concat/Stripe is setup # metainit d2 1 1 c1t1d0s0 d2: Concat/Stripe is setup # metainit d0 -m d1 d0: Mirror is setup # umount /master (Edit the /etc/vfstab file so that the file system references the mirror) # mount /master # metattach d0 d2 d0: Submirror d2 is attached |
In this example, the -f option forces the creation of the first concatenation, d1, which contains the mounted file system /master on /dev/dsk/c1t0d0s0. The second concatenation, d2, is created from /dev/dsk/c1t1d0s0. This slice must be the same size as , or larger than the size of d1.) The metainit command with the -m option creates the one-way mirror, d0, from d1.
Next, the entry for the file system should be changed in the /etc/vfstab file to reference the mirror. The following line in the /etc/vfstab file initially appears as follows:
/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 /var ufs 2 yes - |
The entry is changed to the following:
/dev/md/dsk/d0 /dev/md/rdsk/d0 /var ufs 2 yes - |
Finally, the file system is remounted and submirror d2 is attached to the mirror, causing a mirror resynchronization. The system confirms that the RAID-0 and RAID-1 volumes are set up, and that submirror d2 is attached.
# metainit -f d12 1 1 c0t3d0s6 d12: Concat/Stripe is setup # metainit d22 1 1 c1t0d0s6 d22: Concat/Stripe is setup # metainit d2 -m d12 d2: Mirror is setup (Edit the /etc/vfstab file so that /usr references the mirror) # reboot ... # metattach d2 d22 d2: Submirror d22 is attached |
This example creates a two-way mirror using a slice containing the /usr file system. The -f option forces the creation of the first concatenation, d12, which contains the mounted file system /usr on /dev/dsk/c0t3d0s6. The second concatenation, d22, is created from /dev/dsk/c1t0d0s6. This slice must be the same size as, or larger than the size of d12. The metainit command with the -m option creates the one-way mirror d2 using the concatenation that contains the /usr file system. Next, the /etc/vfstab file must be edited to change the entry for /usr to reference the mirror.
The /etc/vfstab file contains the following entry for the /usr file system:
/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 yes - |
Change the entry to read as follows:
/dev/md/dsk/d2 /dev/md/rdsk/d2 /usr ufs 1 yes - |
After a reboot, the second submirror d22 is attached to the mirror, causing a mirror resynchronization.
# metainit -f d11 1 1 c0t0d0s1 d11: Concat/Stripe is setup # metainit d21 1 1 c1t0d0s1 d21: Concat/Stripe is setup # metainit d1 -m d11 d1: Mirror is setup (Edit the /etc/vfstab file so that swap references the mirror) # reboot ... # metattach d1 d21 d1: Submirror d21 is attached |
In this example, the -f option forces the creation of the first concatenation, d11, which contains the mounted file system swap on /dev/dsk/c0t0d0s1. The second concatenation, d21, is created from /dev/dsk/c1t0d0s1. This slice must be the same size as, or larger than the size of d11. The metainit command with the -m option creates the one-way mirror d1 using the concatenation that contains swap. Next, if there is an entry for swap in the /etc/vfstab file, it must be edited to reference the mirror.
The /etc/vfstab file contains the following entry for the swap space:
/dev/dsk/c0t0d0s1 - - swap - no - |
Change the entry to read as follows:
/dev/md/dsk/d1 - - swap - no - |
After a reboot, the second submirror d21 is attached to the mirror, causing a mirror resynchronization.
To save the crash dump when you have mirrored the swap space, use the dumpadm command to configure the dump device as a volume. For instance, if the swap device is named /dev/md/dsk/d2, use the dumpadm command to set this device as the dump device.
The process for mirroring the root (/) file system on a SPARC platform is similar to mirroring any other file system that you cannot unmount. The procedure differs in that the metaroot command is run instead of manually editing the /etc/vfstab file. Mirroring the root (/) file system also requires recording the path to the alternate boot device. This device reboots the system if the submirror fails.
In the example used in this procedure, the existing slice is c1t0d0s0. The second slice, c1t1d0s0, is available for the second half of the mirror. The submirrors are d1 and d2, respectively, and the mirror is d0.
Be sure to create a one-way mirror with the metainit command then attach the additional submirrors with the metattach command. When the metattach command is not used, no resynchronization operations occur. As a result, data could become corrupted when Solaris Volume Manager assumes that both sides of the mirror are identical and can be used interchangeably.
Check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.
Identify the slice that contains the existing root (/) file system to be mirrored. This example uses the slice c1t0d0s0.
Create a new RAID-0 volume on the slice from the previous step by using one of the following methods. Only the single slice can be included in the RAID-0 volume.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.
Use the following form of the metainit command:
# metainit -f volume-name number-of-stripes components-per-stripe component-name |
Forces the command to continue. You must use this option when the slice contains a mounted file system.
Specifies the name of the volume to create. For information on naming volumes, see Volume Names.
Specifies the number of stripes to create.
Specifies the number of components each stripe should have.
Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.
Create a second RAID-0 volume on an unused slice (c1t1d0s0 in this example) to act as the second submirror. The secondary submirror must be the same size as the original submirror, or larger. Use one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action->Create Volume and follow the instructions on screen. For more information, see the online help.
Use the following form of the metainit command.
# metainit volume-name number-of-stripes components-per-stripe component-name |
See Step 2 for and explanation of the options.
Create a one-way mirror by using one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions . For more information, see the online help.
Use the following form of the metainit command.
# metainit volume-name -m submirror-name |
Specifies the name of the volume to create.
Specifies to create a mirror.
Specifies the name of the component that will be the first submirror in the mirror. In this example, it is the RAID-0 volume that contains the root slice.
Remount your newly mirrored file system. Run the metaroot volume-name command, replacing volume-name with the name of the mirror you have created. Then, reboot your system.
# metaroot volume-name # reboot |
For more information, see the metaroot(1M) man page.
Use the following form of the metattach command to attach the second submirror.
# metattach volume-name submirror-name |
Specifies the name of the RAID-1 volume on which to add the submirror
Specifies the name of the component that will be the second submirror attached to the mirror
See the metattach(1M) man page for more information.
Record the alternate boot path.
Determine the path to the alternate root device. Use the ls -l command on the slice that is being attached as the second submirror to the root (/) file system mirror.
# ls -l /dev/dsk/c1t1d0s0 lrwxrwxrwx 1 root root 55 Mar 5 12:54 /dev/rdsk/c1t1d0s0 -> \ ../../devices/sbus@1,f8000000/esp@1,200000/sd@3,0:a |
Record the string that follows the /devices directory: /sbus@1,f8000000/esp@1,200000/sd@3,0:a.
Because the system might not be available, this information should also be written down somewhere other than on the system. See Recovering From Boot Problems for details on booting from the alternate boot device.
Edit the string to change the major name (sd, in this case) to disk, resulting in /sbus@1,f8000000/esp@1,200000/disk@3,0:a. If the system uses an IDE bus, the original full path might look like
$ ls -l /dev/dsk/c1t1d0s0 lrwxrwxrwx 1 root root 38 Mar 13 15:03 /dev/dsk/c0t0d0s0 -> \ ../../devices/pci@1f,0/ide@d/dad@0,0:a |
After changing the major name dad to disk, you would have /pci@1f,0/ide@d/disk@0,0:a
Use the OpenBootTM PROM nvalias command to define a “backup root” device alias for the secondary root (/) file system mirror. For example:
ok nvalias backup_root /sbus@1,f8000000/esp@1,200000/disk@3,0:a |
Redefine the boot-device alias to reference both the primary and secondary submirrors, in the order in which you want them to be used, and store the configuration.
ok printenv boot-device boot-device = disk net ok setenv boot-device disk backup_root net boot-device = disk backup_root net ok nvstore |
In the event that the primary submirror fails, the system would automatically boot to the second submirror. Or, if you boot manually, rather than using autoboot, you would enter:
ok boot backup_root |
# metainit -f d1 1 1 c0t0d0s0 d1: Concat/Stripe is setup # metainit d2 1 1 c0t1d0s0 d2: Concat/Stripe is setup # metainit d0 -m d1 d0: Mirror is setup # metaroot d0 # lockfs -fa # reboot ... # metattach d0 d2 d0: Submirror d2 is attached # ls -l /dev/dsk/c0t1d0s0 lrwxrwxrwx 1 root root 88 Feb 8 15:51 /dev/rdsk/c1t3d0s0 -> ../../devices/pci@1f,0/pci@1,1/ide@3/dad@0,0:a # init 0 . . . ok nvalias backup_root /pci@1f,0/pci@1,1/ide@3/disk@0,0:a ok setenv boot-device disk backup_root net ok nvstore |
In this example, the -f option forces the creation of the first RAID-0 volume, d1, which contains the mounted root (/) file system on /dev/dsk/c0t0d0s0. The second concatenation, d2, is created from /dev/dsk/c0t1d0s0. This slice must be the same size as, or larger than the size of d1. The metainit command with the -m option creates the one-way mirror d0 using the concatenation that contains root (/).
Next, the metaroot command edits the /etc/vfstab and /etc/system files so that the system can be booted with the root (/) file system on a volume. It is a good idea to run the lockfs -fa command before rebooting. For more information, see the lockfs(1M) man page.
Do not attach the second submirror before the system is rebooted. You must reboot after running the metaroot command and before attaching the second submirror.
After a reboot, the submirror d2 is attached to the mirror, causing a mirror resynchronization. The system confirms that the concatenations and the mirror are set up, and that submirror d2 is attached.
The ls -l command is run on the root raw device to determine the path to the alternate root device in case the system might later need to be booted from it.
The process for mirroring the root (/) file system on an x86 based system is similar to mirroring root on a SPARC system. However, on x86 based systems, the BIOS and fdisk partitioning add an additional layer of complexity.
In the example used in the procedures, the existing slice is c1t0d0s0. The second slice, c1t1d0s0, is available for the second half of the mirror. The submirrors are d1 and d2, respectively, and the mirror is d0.
Before implementing any of the procedures, check Prerequisites for Creating Solaris Volume Manager Components and Creating and Maintaining RAID-1 Volumes.
Verify that the ordering for the BIOS boot device can be configured to allow the system to boot off of the second disk in the mirror.
Before the kernel is started, the system is controlled by the read-only-memory (ROM) Basic Input/Output System (BIOS), which is the firmware interface on an x86 based system. The BIOS is analogous to the boot PROM on a SPARC based system. Some of the BIOS's tasks are as follows:
Perform startup functions.
Detect the correct device from which to boot the system.
Load the master boot record from that device to allow the system to self-boot.
You can usually configure the BIOS to select the order of devices to probe for the boot record. Additionally, most modern BIOS implementations allow you to configure your devices so that the failover to the secondary submirror is automatic. If your system's BIOS does not have this feature and the primary submirror fails, you need to access the BIOS during system boot to reconfigure the system to boot from the secondary root slice. Consult the user's guide for your BIOS for instructions on how to configure settings in your BIOS
Before setting up a root mirror, check the BIOS on your system to verify that you can boot off of more than one disk. Some device drivers are configured to only see one disk on the system.
Verify that the fdisk partitions are configured to support root mirroring.
The existence of a separate x86 boot partition presents a problem when mirroring the root (/) file system. Because it exists outside of the Solaris fdisk partition, the x86 boot partition cannot be mirrored by Solaris Volume Manager. Additionally, because only one copy of the x86 boot partition exists, it represents a single point of failure.
The GRUB-based installation program of the Solaris 10 1/06 software and subsequent releases no longer automatically creates an x86 boot partition. However, if the x86 already exists in the system, the installation program preserves that partition by default.
To determine if your system has a separate x86 boot partition, check the /etc/vfstab file. The x86 boot partition exists if the file contains an entry similar to the following:
/dev/dsk/c2t1d0p0:boot - /boot pcfs - no - |
To use the Solaris Volume Manager to mirror the root (/) file system, the file system must use the single Solaris fdisk partition. Therefore, if the x86 boot partition already exists in the system, delete this partition with the fdisk command and then reinstall the Solaris software. When you reinstall, the boot partition is no longer recreated.
Solaris Volume Manager can only mirror slices within the Solaris fdisk partition If you have multiple fdisk partitions, you need to use another approach to protect the data outside of the Solaris fdisk partition.
Make the secondary submirror bootable with a master boot program.
Specify the master boot program.
# fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c1t1d0p0 |
The following screen appears:
Total disk size is 31035 cylinders Cylinder size is 1146 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 Active Solaris 1 31034 31034 100 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: |
Choose number 5 from the menu, and press return.
Make the secondary disk bootable.
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0 |
For more information about installgrub, refer to the installgrub(1M) man page.
Identify the slice that contains the existing root (/) file system to be mirrored.
This example uses the slice c1t0d0s0.
Create a new RAID-0 volume on the slice from the previous step.
Only the single slice can be included in the RAID-0 volume. Use one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions. For more information, see the online help.
Use the following form of the metainit command:
# metainit -f volume-name number-of-stripes components-per-stripe component-name |
Forces the command to continue. You must use this option when the slice contains a mounted file system.
Specifies the name of the volume to create. For information on naming volumes, see Volume Names.
Specifies the number of stripes to create.
Specifies the number of components each stripe should have.
Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.
Create a second RAID-0 volume (c1t1d0s0 in this example) on an unused slice to act as the second submirror.
The secondary submirror must be the same size as the original submirror, or larger. Also, the slice you use as the second submirror must have a slice tag of “root” and the root slice must be slice 0.
For information on configuring the slice tag field, see the format(1M) man page.
Use either of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action->Create Volume and follow the instructions on screen. For more information, see the online help.
Use the following form of the metainit command.
# metainit volume-name number-of-stripes components-per-stripes component-names |
See Step 6 for an explanation of the options.
Create a one-way mirror by using one of the following methods:
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose Action⇒Create Volume. Follow the onscreen instructions. For more information, see the online help.
Use the following form of the metainit command.
# metainit volume-name -m submirror-name |
Specifies the name of the volume to create.
Specifies to create a mirror.
Specifies the name of the component that will be the first submirror in the mirror. In this example, it is the RAID-0 volume that contains the root slice.
Remount your newly mirrored file system, then reboot the system.
# metaroot volume-name # reboot |
For more information, see the metaroot(1M) man page.
# metattach volume-name submirror-name |
Specifies the name of the RAID-1 volume on which to add the submirror.
Specifies the name of the component that will be the second submirror attached to the mirror.
See the metattach(1M) man page for more information.
Define the alternative boot path in the menu.lst file.
To enable the system to boot off of the disk that holds the secondary submirror, configure the system to see the disk as the alternate boot device. In the current example, c1t1d0s0, the alternative path is on the first slice of the first fdisk partition on the second disk. Thus, you would edit the menu.lst with the following entry:
title alternate boot root (hd1,0,a) kernel /boot/multiboot module /boot/x86.miniroot-safe |
To properly edit entries in menu.lst, you must be familiar with disk-naming conventions in GRUB. For details, see Chapter 11, GRUB Based Booting (Tasks), in System Administration Guide: Basic Administration
After you have completed editing the menu.lst file, the system is set to failover to the second disk. If the primary disk fails, disk numbering changes so that the system boots from the secondary disk.
On certain cases, the automatic disk-renumbering feature of the BIOS might affect recovery from an unavailable primary disk. When disk renumbering forces the system to boot from the secondary disk, the primary disk's boot archive becomes stale. If the same primary disk becomes available later and you boot the system, the disk numbering switches again to use the default primary disk for the system boot. However, at this stage, the primary disk's boot archive remains stale. Consequently, the system might not boot at all. Therefore make sure that in such cases, you select the correct entry from the GRUB menu to boot the system from the valid boot archive. After the system completes the boot up process, perform the normal metadevice maintenance which synchronizes both primary and secondary disks and restores the valid boot archive to the primary disk.
After you mirror your root (/) file system, error messages will be displayed in the console and logged in the system log that is defined in the /etc/syslog.conf file. These error messages do not indicate a problem. These messages are displayed for each device type that you are not currently using, because an unused module cannot be force loaded. The error messages are similar to the following:
Jul 13 10:17:42 ifr genunix: [ID 370176 kern.warning] WARNING: forceload of misc/md_trans failed Jul 13 10:17:42 ifr genunix: [ID 370176 kern.warning] WARNING: forceload of misc/md_raid failed Jul 13 10:17:42 ifr genunix: [ID 370176 kern.warning] WARNING: forceload of misc/md_hotspares failed |
You can safely disregard these error messages.
An error message stating “can't attach labeled submirror to an unlabeled mirror” indicates that you unsuccessfully attempted to attach a RAID-0 volume to a mirror. A labeled volume (submirror) is a volume whose first component starts at cylinder 0, while an unlabeled volume's first component starts at cylinder 1. To prevent the labeled submirror's label from being corrupted, Solaris Volume Manager does not allow labeled submirrors to be attached to unlabeled mirrors.
Read Creating and Maintaining RAID-1 Volumes.
Identify the component (concatenation or stripe) to be used as a submirror.
The component must be the same size as, or larger than the existing submirror in the mirror. If you have not yet created a volume to be a submirror, see Creating RAID-0 (Stripe) Volumes or Creating RAID-0 (Concatenation) Volumes.
Make sure that you have root privilege and that you have a current backup of all data.
Verify that the status of the mirror you want to work with is in an “Okay” state using the metastat command.
# metastat mirror |
Use one of the following methods to attach a submirror.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties and click the Submirror tab. Follow the onscreen instructions. For more information, see the online help.
Use the metattach mirror submirror command.
# metattach mirror submirror |
See the metattach(1M) man page for more information.
View the status of the mirror using the metastat command.
# metastat mirror |
# metastat d30 d30: mirror Submirror 0: d60 State: Okay ... # metattach d30 d70 d30: submirror d70 is attached # metastat d30 d30: mirror Submirror 0: d60 State: Okay Submirror 1: d70 State: Resyncing Resync in progress: 41 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 2006130 blocks ... |
This example shows the attaching of a submirror, d70, to a one-way mirror, d30. You create a two-way mirror when your attach the submirror to the mirror. The mirror d30 initially consists of submirror d60. The submirror d70 is a RAID-0 volume. You verify that the status of the mirror is “Okay” with the metastat command, then attach the submirror. When the metattach command is run, the new submirror is resynchronized with the existing mirror. When you attach an additional submirror to the mirror, the system displays a message. To verify that the mirror is resynchronizing, use the metastat command.
Read Creating and Maintaining RAID-1 Volumes.
Make sure that you have root privilege. Make sure that you have a current backup of all data.
Verify that the status of the mirror you want to work with is in an “Okay” state using the metastat command.
Use one of the following methods to detach a submirror.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties and click the Submirror tab. Follow the onscreen instructions. For more information, see the online help.
Use the metadetach command to detach a submirror from a mirror.
# metadetach mirror submirror |
See the metadetach(1M) man page for more information.
# metastat d5: mirror Submirror 0: d50 ... # metadetach d5 d50 d5: submirror d50 is detached |
In this example, mirror d5 has a submirror, d50. You detach the submirror with the metadetach command. The underlying slices from d50 can be reused elsewhere. After the submirror is detached from the mirror, the system displays a confirmation message.
The metaonline command can only be used when a submirror was taken offline by the metaoffline command. After the metaonline command runs, Solaris Volume Manager automatically begins resynchronizing the submirror with the mirror.
The metaoffline command's capabilities are similar to the capabilities offered by the metadetach command. However, the metaoffline command does not sever the logical association between the submirror and the mirror.
Read Creating and Maintaining RAID-1 Volumes.
Make sure that you have root privilege and that you have a current backup of all data.
Use one of the following methods to place a submirror online or offline.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties and click the Submirror tab. Follow the onscreen instructions . For more information, see the online help.
Use the metaoffline command to a submirror offline.
# metaoffline mirror submirror |
See the metaoffline(1M) man page for more information.
Use the metaonline command to place a submirror online.
# metaonline mirror submirror |
See the metaonline(1M) man page for more information.
# metaoffline d10 d11 d10: submirror d11 is offlined |
In this example, submirror d11 is taken offline from mirror d10. Reads continue to be made from the other submirror. The mirror is out of sync as soon as the first write is made. This inconsistency is corrected when the offlined submirror is brought back online.
# metaonline d10 d11d10: submirror d11 is onlined |
In this example, submirror d11 is brought back online in mirror d10.
Read Overview of Replacing and Enabling Components in RAID-1 and RAID-5 Volumes and Creating and Maintaining RAID-1 Volumes.
Make sure that you have root privilege and that you have a current backup of all data.
Use one of the following methods to enable a slice in a submirror.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties and click the Submirror tab. Follow the onscreen instructions. For more information, see the online help.
Use the metareplace command to enable a failed slice in a submirror.
# metareplace -e mirror failed-slice |
The metareplace command automatically starts a resynchronization to synchronize the repaired or replaced slice with the rest of the mirror.
See the metareplace(1M) man page for more information.
# metareplace -e d11 c1t4d0s7 d11: device c1t4d0s7 is enabled |
In this example, the mirror d11 has a submirror that contains slice, c1t4d0s7, which had a soft error. The metareplace command with the -e option enables the failed slice.
If a physical disk is defective, you can replace it with another available disk (and its slices) on the system as documented in How to Replace a Slice in a Submirror. Alternatively, you can repair or replace the disk, format it, and then run the metareplace command with the -e option as shown in this example.
For an overview of the status information associated with RAID-1 volumes and submirrors, see Understanding Submirror Status to Determine Maintenance Actions.
Use one of the following methods to the check mirror or submirror status.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties. Follow the onscreen instructions. For more information, see the online help.
Run the metastat command on the mirror to view the status of each submirror.
# metastat mirror |
See How to Change RAID-1 Volume Options to change a mirror's pass number, read option, or write option.
See metastat(1M) for more information about checking device status.
Here is sample output from the metastat command. Use metastat command without a mirror name to display all the status of all mirrors.
# metastatd70: Mirror Submirror 0: d71 State: Okay Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 12593637 blocks d71: Submirror of d70 State: Okay Size: 12593637 blocks Stripe 0: Device Start Block Dbase State Reloc Hot Spare c1t3d0s3 0 No Okay Yes Stripe 1: Device Start Block Dbase State Reloc Hot Spare c1t3d0s4 0 No Okay Yes Stripe 2: Device Start Block Dbase State Reloc Hot Spare c1t3d0s5 0 No Okay Yes d0: Mirror Submirror 0: d1 State: Okay Submirror 1: d2 State: Okay Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 5600 blocks d1: Submirror of d0 State: Okay Size: 5600 blocks Stripe 0: Device Start Block Dbase State Hot Spare c0t2d0s7 0 No Okay ... |
Use the metastat command with a mirror name argument to display output for a specific mirror.
metastat d70 d70: Mirror Submirror 0: d71 State: Okay Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 12593637 blocks d71: Submirror of d70 State: Okay Size: 12593637 blocks Stripe 0: Device Start Block Dbase State Reloc Hot Spare c1t3d0s3 0 No Okay Yes Stripe 1: Device Start Block Dbase State Reloc Hot Spare c1t3d0s4 0 No Okay Yes Stripe 2: Device Start Block Dbase State Reloc Hot Spare c1t3d0s5 0 No Okay Yes |
For each submirror in the mirror, the metastat command shows the status, an “invoke” line if there is an error, the assigned hot spare pool (if any), the size in blocks, and information about each slice in the submirror.
Check About RAID-1 Volume Options.
Make sure that you have root privilege and that you have a current backup of all data.
Use one of the following methods to change the RAID-1 options.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties. Follow the onscreen instructions. For more information, see the online help.
Use the metaparam command to display and change a mirror's options.
# metaparam [mirror options] mirror |
See About RAID-1 Volume Options for a description of mirror options. Also, see the metaparam(1M) man page.
# metaparam -r geometric d30 # metaparam d30 d30: mirror current parameters are: Pass: 1 Read option: geometric (-g) Write option: parallel (default) |
In this example, the -r option changes a mirror's read policy to geometric.
# metaparam -w serial d40 # metaparam d40 d40: mirror current parameters are: Pass: 1 Read option: roundrobin (default) Write option: serial (-S) |
In this example, the -w option changes a mirror's write policy to serial.
# metaparam -p 5 d50 # metaparam d50 d50: mirror current parameters are: Pass: 5 Read option: roundrobin (default) Write option: parallel (default) |
In this example, the -p option changes a mirror's pass number to 5.
Read Creating and Maintaining RAID-1 Volumes.
Make sure that you have root privilege and that you have a current backup of all data.
Use one of the following methods to expand a mirror.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action->Properties and click the Submirror tab. Follow the onscreen instructions. For more information, see the online help.
Use the metattach command to attach additional slices to each submirror.
# metattach submirror slice |
Each submirror in a mirror must be expanded. See the metattach(1M) man page for more information.
Use the metattach command to cause the mirror to recompute its size based on the size of the submirror.
# metattach mirror |
# metastat d8: Mirror Submirror 0: d9 State: Okay Submirror 1: d10 State: Okay ... # metattach d9 c0t2d0s5 d9: component is attached # metattach d10 c0t3d0s5 d10: component is attached # metattach d8 |
This example shows how to expand a mirrored, mounted file system by concatenating two disk drives to the mirror's two submirrors. The mirror is named d8 and contains two submirrors named d9 and d10.
For a UFS, run the growfs(1M) command on the mirror volume. See How to Expand a File System.
An application, such as a database, that uses the raw volume must have its own way of expanding the added storage.
Assume the Primary Administrator role, or become superuser.
The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.
Use the metastat command to view the status of the RAID-1 volume and associated submirrors.
# metastat mirror-name |
or
metastat -a |
Use the metasync -c volume command to cancel the resynchronization process.
The following example illustrates how to cancel the resynchronization process on a volume that is part of the disk set blue. Notice that the submirrors are in the “Resync cancelled” state after running the metasync command.
# metastat -a blue/d10: Mirror Submirror 0: blue/d1 State: Resyncing Submirror 1: blue/d2 State: Okay Resync in progress: 0 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 10485760 blocks (5.0 GB) blue/d1: Submirror of blue/d10 State: Resyncing Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s0 0 No Okay Yes blue/d2: Submirror of blue/d10 State: Okay Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s1 0 No Okay Yes Device Relocation Information: Device Reloc Device ID /dev/dsk/c3t50020F230000FA57d0 Yes id1,ssd@n60020f200000fa574033661f000c641 4 # metasync -s blue -c d10 Mar 1 12:46:18 SunSystem1 md_mirror: WARNING: md: blue/d10: Resync cancelled # metastat -a blue/d10: Mirror Submirror 0: blue/d1 State: Resync cancelled Submirror 1: blue/d2 State: Okay Resync cancelled: 3 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 10485760 blocks (5.0 GB) blue/d1: Submirror of blue/d10 State: Resync cancelled Invoke: metasync blue/d10 Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s0 0 No Okay Yes blue/d2: Submirror of blue/d10 State: Okay Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s1 0 No Okay Yes Device Relocation Information: Device Reloc Device ID /dev/dsk/c3t50020F230000FA57d0 Yes id1,ssd@n60020f200000fa574033661f000c641 4 |
Assume the Primary Administrator role, or become superuser.
The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.
Use the metastat command to view the status of the RAID-1 volume and associated submirrors.
# metastat mirror-name |
or
metastat -a |
Use the metasync volume command to resume the resynchronization process.
# metasync volume |
The following example illustrates how to resume the resynchronization process on a volume that is part of the disk set blue. Notice that the submirrors are in the “Resync cancelled” state before running the metasync command. Once the metasync command is issued, the resynchronization process resumes.
# metastat -a blue/d10: Mirror Submirror 0: blue/d1 State: Resync cancelled Submirror 1: blue/d2 State: Okay Resync cancelled: 3 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 10485760 blocks (5.0 GB) blue/d1: Submirror of blue/d10 State: Resync cancelled Invoke: metasync blue/d10 Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s0 0 No Okay Yes blue/d2: Submirror of blue/d10 State: Okay Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s1 0 No Okay Yes Device Relocation Information: Device Reloc Device ID /dev/dsk/c3t50020F230000FA57d0 Yes id1,ssd@n60020f200000fa574033661f000c641 4 # metasync -s blue d10 # metastat -a blue/d10: Mirror Submirror 0: blue/d1 State: Resyncing Submirror 1: blue/d2 State: Okay Resync in progress: 3 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 10485760 blocks (5.0 GB) blue/d1: Submirror of blue/d10 State: Resyncing Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s0 0 No Okay Yes blue/d2: Submirror of blue/d10 State: Okay Size: 10485760 blocks (5.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare /dev/dsk/c3t50020F230000FA57d0s1 0 No Okay Yes Device Relocation Information: Device Reloc Device ID /dev/dsk/c3t50020F230000FA57d0 Yes id1,ssd@n60020f200000fa574033661f000c641 4 |
Read Overview of Replacing and Enabling Components in RAID-1 and RAID-5 Volumes and Creating and Maintaining RAID-1 Volumes.
Make sure that you have root privilege and that you have a current backup of all data.
Use the metastat command to view the status of the RAID-1 volume and associated submirrors.
# metastat mirror-name |
Use one of the following methods to replace a slice in a submirror.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties and click the Submirror tab. Follow the onscreen instructions. For more information, see the online help.
Use the following form of the metareplace command to replace a slice in a submirror:
# metareplace mirror-name component-name |
mirror-name is the name of the volume to create.
component-name specifies the name of the component to replace.
Specifies the name of the volume to create
Specifies the name of the component to replace
See the following examples and the metainit(1M) man page for more information.
The following example illustrates how to replace a failed slice when the system is not configured to use hot spare pools for the automatic replacement of failed disks. See Chapter 16, Hot Spare Pools (Overview) for more information about using hot spare pools.
# metastat d6 d6: Mirror Submirror 0: d16 State: Okay Submirror 1: d26 State: Needs maintenance ... d26: Submirror of d6 State: Needs maintenance Invoke: metareplace d6 c0t2d0s2 <new device> ... # metareplace d6 c0t2d0s2 c0t2d2s2 d6: device c0t2d0s2 is replaced with c0t2d2s2 |
The metastat command confirms that mirror d6 has a submirror, d26, with a slice in the “Needs maintenance” state. The metareplace command replaces the slice as specified in the “Invoke” line of the metastat output with another available slice on the system. The system confirms that the slice is replaced, and starts resynchronizing the submirror.
Read Overview of Replacing and Enabling Components in RAID-1 and RAID-5 Volumes and Creating and Maintaining RAID-1 Volumes.
Make sure that you have root privilege and that you have a current backup of all data.
Use the metastat command to view the status of the RAID-1 volume and associated submirrors.
# metastat mirror-name |
Use one of the following methods to replace a submirror.
From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node. Choose the mirror. Then, choose Action⇒Properties and click the Submirror tab. Follow the onscreen instructions. For more information, see the online help.
Use the metadetach, metaclear, metatinit, and metattach commands to replace an entire submirror.
Use the metadetach command to the failed submirror from the mirror.
# metadetach -f mirror-name submirror |
Forces the detach to occur
Specifies the name of the mirror
Specifies the submirror to detach
Use the metaclear command to delete the submirror.
# metaclear -f submirror |
Forces the deletion of the submirror to occur
Specifies the submirror to delete
Use the metainit command to create a new submirror.
# metainit volume-name number-of-stripes components-per-stripe component-name |
Specifies the name of the volume to create. For information on naming volumes, see Volume Names.
Specifies the number of stripes to create.
Specifies the number of components each stripe should have.
Specifies the names of the components that are used. This example uses the root slice, c0t0d0s0.
Use the metattach command to attach the new submirror.
# metattach mirror submirror |
The following example illustrates how to replace a submirror in an active mirror.
# metastat d20 d20: Mirror Submirror 0: d21 State: Okay Submirror 1: d22 State: Needs maintenance ... # metadetach -f d20 d22 d20: submirror d22 is detached # metaclear -f d22 d22: Concat/Stripe is cleared # metainit d22 2 1 c1t0d0s2 1 c1t0d1s2 d22: Concat/Stripe is setup # metattach d20 d22 d20: components are attached |
In this example, the metastat command confirms that the two-way mirror, d20, has a submirror, d22, in the “Needs maintenance” state. In this case, the entire submirror needs to be cleared and recreated. The metadetach command detaches the failed submirror from the mirror by using the -f option, which forces the detachment to occur. The metaclear command clears the submirror. The metainit command recreates submirror, d22, with new slices. Finally, the metattach command attaches the rebuilt submirror. A mirror resynchronization begins automatically.
The specific configuration of the new volume, d22, depends on the component you are replacing. A concatenation, as shown here, can sufficiently replace a concatenation. However, a concatenation would not be an ideal replacement for a stripe because it could impact performance.
You temporarily lose the capability for data redundancy while the mirror is a one-way mirror.
Use this procedure to unmirror a file system that can be unmounted while the system is running. To unmirror root (/), /var, /usr, or swap, or any other file system that cannot be unmounted while the system is running, see How to Unmirror a File System That Cannot Be Unmounted.
Read Creating and Maintaining RAID-1 Volumes.
Make sure that you have root privilege and that you have a current backup of all data.
Verify that at least one submirror is in the Okay state.
# metastat mirror |
Unmount the file system.
# umount /file-system |
Detach the submirror that will continue to be used for the file system.
# metadetach mirror submirror |
For more information, see the metadetach(1M) man page.
Clear the mirror and remaining subcomponents.
# metaclear -r mirror |
For more information, see the metaclear(1M) man page.
Edit the /etc/vfstab file to use the component detached in Step 4, if necessary.
Remount the file system.
# mount /file-system |
# metastat d4 d4: Mirror Submirror 0: d2 State: Okay Submirror 1: d3 State: Okay Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 2100735 blocks (1.0 GB) d2: Submirror of d4 State: Okay Size: 2100735 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0t0d0s0 0 No Okay Yes d3: Submirror of d4 State: Okay Size: 2100735 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c1t0d0s0 0 No Okay Yes ... # umount /opt # metadetach d4 d2 d4: submirror d2 is detached # metaclear -r d4 d4: Mirror is cleared d3: Concat/Stripe is cleared (Edit the /etc/vfstab file so that the entry for /opt is changed from d4 to the underlying slice or volume) # mount /opt |
In this example, the /opt file system is composed of a two-way mirror, d4. The submirrors of the mirror are d2 and d3. The submirrors are composed of slices /dev/dsk/c0t0d0s0 and /dev/dsk/c1t0d0s0. The metastat command verifies that at least one submirror is in the “Okay” state. (A mirror with no submirrors in the “Okay” state must be repaired first.) The file system is unmounted. Then, submirror d2 is detached. The metaclear -r command deletes the mirror and the other submirror, d3.
Next, the entry for /opt in the /etc/vfstab file is changed to reference the underlying slice.
In this example the /etc/vfstab file contains the following entry for the /opt file system:
/dev/md/dsk/d4 /dev/md/rdsk/d4 /opt ufs 2 yes - |
Change the entry to read as follows:
/dev/md/dsk/d2 /dev/md/rdsk/d2 /opt ufs 2 yes - |
By using the submirror name, you can continue to have the file system mounted on a volume. Finally, the /opt file system is remounted.
By using d2 instead of d4 in the /etc/vfstab file, you have unmirrored the mirror. Because d2 consists of a single slice, you can mount the file system on the slice name (/dev/dsk/c0t0d0s0) if you do not want the device to support a volume.
Use this task to unmirror file systems, including root (/), /usr, /opt, and swap, that cannot be unmounted during normal system operation.
Make sure that you have root privilege and that you have a current backup of all data.
Verify that at least one submirror is in the Okay state.
# metastat mirror |
Detach the submirror that will continue to be used for the file system.
# metadetach mirror submirror |
For more information, see the metadetach(1M) man page.
Use one of the following commands, depending the file system you want to unmirror:
For the /usr, /opt, or swap file systems, change the file system entry in the /etc/vfstab file to use a non-Solaris Volume Manager device (slice).
For the root (/) file system only: run the metaroot command.
# metaroot rootslice |
For more information, see the metaroot(1M) man page.
Reboot the system.
# reboot |
Clear the remaining mirror and submirrors.
# metaclear -r mirror |
For more information, see the metaclear(1M) man page.
# metastat d0 d0: Mirror Submirror 0: d10 State: Okay Submirror 1: d20 State: Okay Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 2100735 blocks (1.0 GB) d10: Submirror of d0 State: Okay Size: 2100735 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0t3d0s0 0 No Okay Yes d20: Submirror of d0 State: Okay Size: 2100735 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c1t3d0s0 0 No Okay Yes # metadetach d0 d20 d0: submirror d20 is detached # metaroot /dev/dsk/c0t3d0s0 # reboot ... # metaclear -r d0 d0: Mirror is cleared d10: Concat/Stripe is cleared # metaclear d20 d20: Concat/Stripe is cleared |
In this example, the root (/) file system is a two-way mirror, d0. The submirrors of the mirror are d10 and d20. The submirrors are composed of slices /dev/dsk/c0t3d0s0 and /dev/dsk/c1t3d0s0. The metastat command verifies that at least one submirror is in the “Okay” state. (A mirror with no submirrors in the “Okay” state must be repaired first.) Submirror d20 is detached to make d0 a one-way mirror.
The rootslice is the slice containing the root (/) file system. The metaroot command is run, using the rootslice from which the system is going to boot. This command edits the /etc/system and /etc/vfstab files. The command removes information that specifies mirroring of the root (/) file system.
After rebooting the system, the metaclear -r command deletes the mirror and the other submirror, d10. The last metaclear command clears submirror d20.
# metastat d1 d1: Mirror Submirror 0: d11 State: Okay Submirror 1: d21 State: Okay ... # metadetach d1 d21 d1: submirror d21 is detached (Edit the /etc/vfstab file to change the entry for swap from metadevice to slice name) # reboot ... # metaclear -r d1 d1: Mirror is cleared d11: Concat/Stripe is cleared # metaclear d21 d21: Concat/stripe is cleared |
In this example, the swap file system is made of a two-way mirror, d1. The submirrors of the mirror are d11 and d21. The submirrors are composed of slices /dev/dsk/c0t3d0s1 and /dev/dsk/c1t3d0s1. The metastat command verifies that at least one submirror is in the “Okay” state. (A mirror with no submirrors in the “Okay” state must be repaired first.) Submirror d21 is detached to make d1 a one-way mirror. Next, the /etc/vfstab file is edited to change the entry for swap to reference the slice that is in submirror d21.
In this example, the /etc/vfstab file contains the following entry for the swap file system:
/dev/md/dsk/d4 /dev/md/rdsk/d4 /opt ufs 2 yes - |
/dev/md/dsk/d1 - - swap - no - |
Change the entry to read as follows:
/dev/dsk/c0t3d0s1 - - swap - no - |
After rebooting the system, the metaclear -r command deletes the mirror and the other submirror, d11. The final metaclear command clears submirror d21.
Solaris Volume Manager is not meant to be a “backup product.” Solaris Volume Manager does provide a means for backing up mirrored data without causing any of the following to occur:
Unmounting the mirror
Taking the entire mirror offline
Halting the system
Denying users access to data
Solaris Volume Manager backs up mirrored data by first taking one of the submirrors offline. During the backup, mirroring is temporarily unavailable. As soon as the backup is complete, the submirror is then placed back online and resynchronized.
The UFS Snapshots feature provides an alternative way to backup a system without taking the file system offline. You can perform the backup without detaching the submirror and incurring the performance penalty of resynchronizing the mirror later. Before performing a backup using the UFS Snapshots feature, make sure you have enough space available on your UFS file system. For more information, see Chapter 26, Using UFS Snapshots (Tasks), in System Administration Guide: Devices and File Systems.
You can use this procedure on any file system except the root (/) file system. Be aware that this type of backup creates a “snapshot” of an active file system. Depending on how the file system is being used when it is write-locked, some files on the backup might not correspond to the actual files on disk.
The following limitations apply to this procedure:
If you use this procedure on a two-way mirror, be aware that data redundancy is lost while one submirror is offline for backup. A multi-way mirror does not have this problem.
There is some overhead on the system when the reattached submirror is resynchronized after the backup is complete.
The high-level steps in this procedure are as follows:
Write-locking the file system (UFS only). Do not lock root (/).
Flushing all data from cache to disk.
Using the metadetach command to take one submirror off of the mirror
Unlocking the file system
Using the fsck command to check the file system on the detached submirror
Backing up the data on the detached submirror
Using the metattach command to place the detached submirror back in the mirror
If you use these procedures regularly, put them into a script for ease of use.
The safer approach to this process is to attach a third or fourth submirror to the mirror, allow it to resynchronize, and use it for the backup. This technique ensures that data redundancy is maintained at all times.
Verify that the mirror is in the “Okay” state.
A mirror that is in the “Maintenance” state should be repaired first.
# metastat mirror |
Flush data and UFS logging data from cache to disk and write-lock the file system.
# /usr/sbin/lockfs -w mount-point |
Only a UFS volume needs to be write-locked. If the volume is set up as a raw device for database management software or some other application, running the lockfs command is not necessary. You might, however, want to run the appropriate vendor-supplied utility to flush any buffers and lock access.
Do not write-lock the root (/) file system. Write-locking the root (/) file system causes the system to hang. If you are backing up your root (/) file system, skip this step.
Detach one submirror from the mirror.
# metadetach mirror submirror |
Is the volume name of the mirror.
Is the volume name of the submirror (volume) being detached.
Reads continue to be made from the other submirror. The mirror is out of sync as soon as the first write is made. This inconsistency is corrected when the detached submirror is reattached in Step 7.
Unlock the file system and allow writes to continue.
# /usr/sbin/lockfs -u mount-point |
You might need to perform necessary unlocking procedures based on vendor-dependent utilities used in Step 2.
Use the fsck command to check the file system on the detached submirror. This step ensures a clean backup occurs.
# fsck /dev/md/rdsk/name |
Perform a backup of the offlined submirror.
Use the ufsdump command or your usual backup utility. For information on performing the backup using the ufsdump command, see Performing Mounted Filesystem Backups Using the ufsdump Command.
To ensure a proper backup, use the raw volume name, such as /dev/md/rdsk/d4. Using the raw volume name access to storage that is greater than 2 Gbytes.
Attach the submirror.
# metattach mirror submirror |
Solaris Volume Manager automatically begins resynchronizing the submirror with the mirror.
This example uses a mirror, d1. The mirror consists of submirrors d2, d3 and d4. The submirror d3 is detached and backed up while submirrors d2 and d4 stay online. The file system on the mirror is /home1.
# metastat d1 d1: Mirror Submirror 0: d2 State: Okay Submirror 1: d3 State: Okay Submirror 1: d4 State: Okay ... # /usr/sbin/lockfs -w /home1 # metadetach d1 d3 # /usr/sbin/lockfs -u /home1 # /usr/sbin/fsck /dev/md/rdsk/d3 (Perform backup using /dev/md/rdsk/d3) # metattach d1 d3 |