Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
10.  RAID 1 (Mirror) Volumes (Tasks) Creating a RAID 1 Volume How to Create a RAID 1 Volume From a File System  Previous   Contents   Next 
   
 

Example--Creating a Two-Way Mirror (Unmountable File System)

# 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

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 or greater than that 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. For example, the following line:

/dev/dsk/c1t0d0s0 /dev/rdsk/c1t0d0s0 /var ufs 2 yes -

should be changed to:

/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.

Example--Creating a Mirror From root (/)

# metainit -f d1 1 1 c0t0d0s0
d11: Concat/Stripe is setup
# metainit d2 1 1 c0t1d0s0
d12: Concat/Stripe is setup
# metainit d0 -m d1
d10: Mirror is setup
# metaroot d0
# lockfs -fa
# reboot
...
# metattach d0 d2
d10: Submirror d12 is attached
# ls -l /dev/rdsk/c0t1d0s0
lrwxrwxrwx   1 root     root          88 Feb  8 15:51 /dev/rdsk/c1t3d0s0 ->
../../devices/iommu@f,e0000000/vme@f,df010000/SUNW,pn@4d,1080000/ipi3sc@0,0/i
d@3,0:a,raw

Note - Do not attach the second submirror before the system is rebooted. You must reboot between running the metaroot command and attaching the second submirror.


The -f option forces the creation of the first RAID 0 volume, d1, which contains the mounted file system root (/) on /dev/dsk/c0t0d0s0. The second concatenation, d2, is created from /dev/dsk/c0t1d0s0. (This slice must be the same size or greater than that 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.) 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.

Example--Creating a Two-way Mirror (File System That Cannot Be Unmounted--/usr)

# 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

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 or greater than that of d12.) The metainit command with the -m option creates the one-way mirror d2 using the concatenation containing /usr. Next, the /etc/vfstab file must be edited to change the entry for /usr to reference the mirror. For example, the following line:

/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 yes -

should be changed to:

/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. (The system confirms that the concatenation and the mirror are set up, and that submirror d22 is attached.

Example--Creating a Mirror From swap

# 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

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 or greater than that 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. For example, the following line:

/dev/dsk/c0t0d0s1 - - swap - no -

should be changed to:

/dev/md/dsk/d1 - - swap - no -

After a reboot, the second submirror d21 is attached to the mirror, causing a mirror resynchronization. (The system confirms that the concatenations and the mirror are set up, and that submirror d21 is attached.

To save the crash dump when you have mirrored swap, 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.

Mirroring root (/) Special Considerations

The process for mirroring root (/) is the same as in mirroring any other file system that you cannot unmount, with the exception that you run the metaroot command instead of manually editing the /etc/vfstab file. See "How to Create a RAID 1 Volume From a File System". The following sections outline special considerations and issues for mirroring root (/) file systems.

How to Record the Path to the Alternate Boot Device

When you are mirroring root (/), you might need the path to the alternate boot device later if the primary device fails. The process for finding and recording the alternate boot device differs, depending on your system's architecture. See "SPARC: Example--Recording the Alternate Boot Device Path" or "IA: Example--Recording the Alternate Boot Device Path".

SPARC: Example--Recording the Alternate Boot Device Path

In this example, you determine the path to the alternate root device by using the ls -l command on the slice that is being attached as the second submirror to the root (/) mirror.

# ls -l /dev/rdsk/c1t3d0s0
lrwxrwxrwx 1  root root  55 Mar 5 12:54  /dev/rdsk/c1t3d0s0 -> \ 
../../devices/sbus@1,f8000000/esp@1,200000/sd@3,0:a

Here you would record the string that follows the /devices directory: /sbus@1,f8000000/esp@1,200000/sd@3,0:a.

Solaris Volume Manager users who are using a system with OpenBoot™ Prom can use the OpenBoot nvalias command to define a "backup root" device alias for the secondary root (/) mirror. For example:

ok  nvalias backup_root /sbus@1,f8000000/esp@1,200000/sd@3,0:a

Then, 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 of primary root disk failure, the system would automatically boot to the second submirror. Or, if you boot manually, rather than using auto boot, you would only enter:

ok  boot backup_root

IA: Example--Recording the Alternate Boot Device Path

In this example, you would determine the path to the alternate boot device by using the ls -l command on the slice that is being attached as the second submirror to the root (/) mirror.

# ls -l /dev/rdsk/c1t0d0s0
lrwxrwxrwx 1  root root  55 Mar 5 12:54  /dev/rdsk/c1t0d0s0 -> ../.
./devices/eisa/eha@1000,0/cmdk@1,0:a

Here, you would record the string that follows the /devices directory: /eisa/eha@1000,0/cmdk@1,0:a

 
 
 
  Previous   Contents   Next