![]()
|
Tech Tip Cats
|
How to Mirror root With Solaris Volume Manager in the Solaris 9 and 10 OSby Dave Donohue, July 2008 Here is a procedure for mirroring root with Solaris Volume Manager. For the Solaris 10 OS, I used SVM Version 3.0, REV=2005.01.09.21.19, and for the Solaris 9 OS, I used SVM version 1.0, REV=2002.04.14.23.49. (Note: Results may vary.) PrerequisitesFirst, you need to identify the disks that you want to create mirrors with. You can do this by using the format command to find the disks in question. Run the format command; below is an example of the output:
AVAILABLE DISK SELECTIONS:
0. c3t2d0 <DEFAULT cyl 17845 alt 2 hd 255 sec 63>
/pci@7b,0/pci1022,7458@11/pci1000,3060@2/sd@2,0
1. c3t3d0 <DEFAULT cyl 17845 alt 2 hd 255 sec 63>
/pci@7b,0/pci1022,7458@11/pci1000,3060@2/sd@3,0
In my example, I'm mirroring the root partitions along with the other partitions from the disk drive. My drives are c3t2d0 and c3t3d0. Procedure for Mirroring rootFirst, partition your primary drive, typically the one that the Solaris OS is currently running on. (In my case, this is drive 0, c3t2d0.) I traditionally do this during the installation of the Solaris OS to prevent data loss. You will need one partition that is about 10 Mbyte for the meta database. Once you are satisfied with the partition that you have created, ensure that you label the disk, and then perform the following steps to transfer the same partitioning table. Transfer the partition table from one drive to another. prtvtoc /dev/rdsk/c3t2d0s2 | fmthard -s - /dev/rdsk/c3t3d0s2 Note: Notice the use of s2, which is typically the overlap partition; if you changed this on the disk, please substitute the proper slice in its place. Now that you have the two disks looking the same, execute the following: metadb -a -c 3 -f c3t2d0s7 c3t3d0s7 The -c 3 creates three copies of the metastat database in this space, just in case a single copy gets corrupted (which is never good). We will initialize the disk that makes up the root partition by doing the following. I'm using s0 because this is my root partition; you can substitute where appropriate. metainit -f d11 1 1 c3t2d0s0 metainit -f d12 1 1 c3t3d0s0 Now we will create the actual mirror: metainit d10 -m d11 After you have completed the preceding steps, you need to run the following command, which will automatically update /etc/system and /etc/vfstab to let it know that you are using a metadevice as your root disk. metaroot d10 After you have executed the commands above, you need to reboot the machine before attaching the other half of the mirror to the root device. You can't attach a currently mounted device, or the machine will go crazy. In order to attach the device you will need to do the following: metattach d10 d12 To check on the status of the mirror, you can do the following: metastat d10 You will want to update the Openboot with the prior alias for the boot devices. You can do this by doing the following: ls -l /dev/dsk/c0t0d0s0 You output will look similar to the following lrwxrwxrwx 1 root root 42 Jul 12 2007 /dev/dsk/c0t0d0s0 -> ../../devices/pci@1e,600000/ide@d/sd@0,0:a You will need to update the bold part above, with your output. You will then run the following command from the OS eeprom "nvramrc=devalias mirror /pci@1e,600000/ide@d/sd@0,0:a devalias mirror-a /pci@1e,600000/ide@d/sd@1,0:a" eeprom boot-device="mirror mirror-a" eeprom "use-nvramrc?=true" The below commands for doing this are from the OK prompt, don't do this else wise. "nvalias mirror /pci@1e,600000/ide@d/sd@0,0:a mirror-a /pci@1e,600000/ide@d/sd@1,0:a" "setenv boot-device mirror mirror-a" If you are mirroring just the two internal drives, you will want to add the following line to /etc/system to allow it to boot from a single drive. This will bypass the SVM Quorum rule set md:mirrored_root_flag = 1 Please note that if you are running a Sparc platform you can use the installboot command in order to install the boot blocks onto the head of the drive. For a UFS based File system you will use the below command. installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0 And on a ZFS based File System you will use the below command. installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0t1d0s0 If you are on a X86 Platform you will want to use installgrub to do similar functions, below you will find references for that /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0d0s0 |
Comments (6)
Aug 01, 2008
tsergei says:
metadb -a -c 3 -f c3t2d0s2 c3t3d0s2 Are you shure about cXtXdXs2 ? or you are m...metadb -a -c 3 -f c3t2d0s2 c3t3d0s2
Are you shure about cXtXdXs2 ?
or you are mistake?
Do you want to add line "set md:mirrored_root_flag=1" to /etc/system ?
Do you want to run installboot ?
Don you want to correct NVRAm for boot device?
Aug 01, 2008
ddonohue79 says:
You are correct, the cxtxdxs2 should have been s7, I've corrected this. "Do y...You are correct, the cxtxdxs2 should have been s7, I've corrected this.
"Do you want to add line "set md:mirrored_root_flag=1" to /etc/system ?"
The mirror_root_flag is useful if you are only mirroring 2 drives internall. I'll add reference for this.
Oct 13, 2008
thai.nguyen says:
What's about installboot as tsergei says?What's about installboot as tsergei says?
May 07
ddonohue79 says:
I've addressed the installboot and grubinstall for the different platforms.I've addressed the installboot and grubinstall for the different platforms.
Oct 13, 2008
ddonohue79 says:
i need to find time to go look into the installboot option. This however is not...i need to find time to go look into the installboot option. This however is not reliant to the Sparc version, so for now this is correct for a sparc based machine. I'll update this with a note about installboot as soon as i have time to validate it's proper usage.
May 22
eoconnor says:
Hi In the step eeprom "nvramrc=devalias mirror /pci@1e,600000/ide@d/sd@0,0:a dev...Hi
In the step
eeprom "nvramrc=devalias mirror /pci@1e,600000/ide@d/sd@0,0:a devalias mirror-a /pci@1e,600000/ide@d/sd@1,0:a"
you need to replace the major name ( sd in this case ) with "disk" i.e.
eeprom "nvramrc=devalias mirror /pci@1e,600000/ide@d/disk@0,0:a devalias mirror-a /pci@1e,600000/ide@d/disk@1,0:a"
also do same for the step that follows that for the ok prompt.
cheers good article
Enda