Solaris X86 – SVM Root Mirroring

Step by Step procedure for SVM root mirroring:

Root and mirror disks, are here referred to as primary and secondary disks respectively.

1. In this step, you will need to boot cdrom in single user mode off the Solaris media or network. You will need to initialize each disk prior to installation and or mirroring.

In order to initialize any new X86 disk, you need to run fdisk prior to mirroring and or installation. You could run this through format and or on command with exact fdisk and logical boot device (/dev/rdsk/c#t#d#s# or /dev/dsk/c#d#s#) pertaining to your platform. It is recommended to delete the current layout and then create the new partition as follows. I am using c1t1d0s2 in this case but that will vary according to your system and format output.

# fdisk /dev/rdsk/c1t0d0s2
WARNING: Device /dev/rdsk/c1t0d0s2:
The device does not appear to include absolute
sector 0 of the PHYSICAL disk (the normal location for an fdisk table).
Fdisk is normally used with the device that represents the entire fixed disk.
(For example, /dev/rdsk/c0d0p0 on x86 or /dev/rdsk/c0t5d0s2 on sparc).
Are you sure you want to continue? (y/n) y
Total disk size is 8924 cylinders
Cylinder size is 16065 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 0 365 366 4
2 Diagnostic 365 366 2 0
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: 3
Specify the partition number to delete (or enter 0 to exit): 1
Are you sure you want to delete partition 1?

This will make all files and programs in this partition inaccessible (type “y” or “n”). y
Partition 1 has been deleted. This was the active partition.1
Total disk size is 8924 cylinders
Cylinder size is 16065 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Diagnostic 365 366 2 0
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: 3
Specify the partition number to delete (or enter 0 to exit): 1
Are you sure you want to delete partition 1? This will make all files and programs in this partition inaccessible (type “y” or “n”). y
Partition 1 has been deleted.1
Total disk size is 8924 cylinders
Cylinder size is 16065 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
WARNING: no partitions are defined!
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: 1
Select the partition type to create:
1=SOLARIS2 2=UNIX 3=PCIXOS 4=Other
5=DOS12 6=DOS16 7=DOSEXT 8=DOSBIG
9=DOS16LBA A=x86 Boot B=Diagnostic C=FAT32
D=FAT32LBA E=DOSEXTLBA F=EFI 0=Exit? 1
Specify the percentage of disk to use for this partition[1]
(or type “c” to specify the size in cylinders). c
Enter starting cylinder number: 1
Enter partition size in cylinders: 8000
Should this become the active partition? If yes, it will be activated each time the computer is reset or turned on.
Please type “y” or “n”. y
Partition 1 is now the active partition.1
Total disk size is 8924 cylinders
Cylinder size is 16065 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 1 8000 8000 90
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: 1
Select the partition type to create:
1=SOLARIS2 2=UNIX 3=PCIXOS 4=Other
5=DOS12 6=DOS16 7=DOSEXT 8=DOSBIG
9=DOS16LBA A=x86 Boot B=Diagnostic C=FAT32
D=FAT32LBA E=DOSEXTLBA F=EFI 0=Exit? B
Specify the percentage of disk to use for this partition[B]
(or type “c” to specify the size in cylinders). c
Enter starting cylinder number: 8001
Enter partition size in cylinders: 924
Total disk size is 8924 cylinders
Cylinder size is 16065 (512 byte) blocks
Should this become the active partition? If yes, it will be activated
each time the computer is reset or turned on.
Please type “y” or “n”. n
Total disk size is 8924 cylinders
Cylinder size is 16065 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 1 8000 8000 90
2 Diagnostic 8001 8919 919 10
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: 5
#
Please note if the disk geometry of the x86 is different you will need to match this in disk labeling under format and in fdisk.
print disk 0
Volume:
Current partition table (original):
Total disk cylinders available: 15940 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 518 – 15581 17.44GB (15064/0/0) 36575392
1 swap wu 1 – 432 512.16MB (432/0/0) 1048896
2 backup wm 0 – 15939 18.45GB (15940/0/0) 38702320
3 unassigned wm 433 – 517 100.77MB (85/0/0) 206380
4 unassigned wu 0 0 (0/0/0) 0
5 unassigned wu 0 0 (0/0/0) 0
6 unassigned wu 0 0 (0/0/0) 0
7 unassigned wu 0 0 (0/0/0) 0
8 boot wu 0 – 0 1.19MB (1/0/0) 2428
9 unassigned wu 0 0 (0/0/0) 0
print disk 1
Current partition table (original):
Total disk cylinders available: 2548 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 129 – 2404 17.44GB (2276/0/0) 36563940
1 swap wu 1 – 128 1004.06MB (128/0/0) 2056320
2 backup wm 0 – 2547 19.52GB (2548/0/0) 40933620
3 unassigned wm 2405 – 2417 101.98MB (13/0/0) 208845
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 – 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0
You will have to layout your disks in format to label them with the same disk geometry as shown above but varied according to your specifications. It is recommended that the primary disk should be the smaller of the two disks per Bugid 6225636 .

2. Check for the latest Solaris 10 x86 SVM patches. Check for the latest patch cluster at: http://sunsolve.sun.com . It is recommended to keep the patch level to the latest revision.

3. Create one slice(preferably Slice 3) of 100MB(minimum recommended) on the primary disk, for storing the metadb replicas.

4. After creating the slice for metadb replicas, copy the VTOC of the primary disk to the secondary disk, so the same slice information is copied to the secondary disk.(In the examples. c1t0d0 is primary and c1t1d0 is secondary disk)

For example: # prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s – /dev/rdsk/c1t1d0s2
**Please note the above mentioned examples are just that and the device mentioned can vary between systems. If you are not sure of the /dev/rdsk/c#d#s# or /dev/dsk/c#t#d#s# to be used above that pertains to your platform it is recommended you run format and verify it.

5. Create metadb replicas in slice 3 of both primary and secondary disks.

For example: # metadb -afc 3 c1t0d0s3 c1t1d0s3
6. Create metadevices for /, swap, and /export/home file systems. Create meta-devices for any other filesystems that are part of the primary disk.

For example:

# metainit -f d10 1 1 c1t0d0s0 —>
This creates metadevice d10 for root slice of primary disk.
# metainit d20 1 1 c1t1d0s0
This creates metadevice d20 for root slice of secondary disk.
# metainit d0 -m d10
creating a one way mirror using d10.
In the same way create, metadevices for other file systems, including swap.
7. Update the /etc/vfstab file, with the metadevices for the file systems.

Example: metaroot d0

–> This command will update vfstab – /dev/md/dsk/d0 as / filesystem.
For other filesystems and swap, manually edit the vfstab
entries.
8. Lock all mouted filesystems and force a synchronous flush of all data that is dirty at the time fsflush is run. Prevents you having trouble with corrupted filesystems

# lockfs -af

9. reboot the system.

10. Once the system has booted, check with either the “df” or “mount” command, to check whether the file systems are using metadevices.

11. Attach the second part of the mirror to the meta mirrors.

Example: # metattach d0 d20
This will attach metadevice d20 to d0. After this command, mirror resync will start.

12. Once all file systems are attached, check all the metadevice status are “Okay”. Then, update the secondary disk bootable using an installgrub command.

Note: From Solaris 10 x86 U1, the installboot command is obselete. So, use the installgrub command, to make the second disk bootable. It is better to run this command once, to make sure the secondary disk is bootable.

Example: # installgrub -fm /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0
The installgrub utility will update the Master Boot record of the secondary disk, so that it can be bootable.

13. Now update the secondary disk as alternate bootpath in /boot/solaris/bootenv.rc file. (This can be done by executing the eeprom command)

Example: eeprom altbootpath=””
If you are not sure what the physical path is that belongs in the above “”. It is recommended you run the following command:

# ls -la /dev/dsk/c#t#d#s#
This example was taken from an X2100 platform:

# ls -la /dev/dsk/c2d0s0
lrwxrwxrwx 1 root root 48 Sep 5 21:35 /dev/dsk/c2d0s0 -> ../../devices/pci@0,0/pci-ide@7/ide@1/cmdk@0,0:a
so the path that needs to added to the bootenv.rc file is eeprom

# eeprom altbootpath=”/pci-ide@7/ide@1/cmdk@0,0:a”
It is important to add this altbootpath to the bootenv.rc for successful mirroring.

14. Now the system can be safely rebooted, to check if it is booting with root disk mirrored.

Recovering from primary boot disk failure:

If the primary root disk fails, the system will continue to run from the
secondary boot disk. There will be SCSI errors on the console, about the disk
failure.

“Primary root disk can be replaced online without bringing down the system”
Note: If you don’t use the cfgadm command when hot swapping and syncing the disk, the mirror will go back into “Needs Maintenance?”mode after the next reboot. A subsequent sync of the mirror will fix it for good however. It is thus recommended that you use cfgadm to avoid future issues.

Note: All the usual rules apply to SVM. For example, make sure you have at least 3 metadb’s on the working disks to avoid a panic due to insufficient replicas.

Step-by-Step Procedure for replacing a failed disk:

1. cfgadm -al

2. cfgadm -c unconfigure cx::xxxxxxx

This may fail with a lists of reasons. Address each reasons then try again.

Examples:

If SVM metadb resides on a slice of the failed disk. do a forced remove of the metadb via metadb -d
If there’s another SVM mirror on the disk, you need to force detach it.
Use dumpadm to check if a dump device is assigned to this disk.
3. Hotswap the failed disk.

4. cfgadm -c configure cx::xxxxxxx

5. Redo the partitioning for the replacement disk using format or prtvtoc.

Example: prtvtoc /dev/rdsk/c1t1d0s2 | fmthard -s – /dev/rdsk/c1t0d0s2
6. Then re-attach the failed mirrors using the metareplace command.

Example: metareplace -e d0 < new disk >
Once the synchronisation has completed, the primary disk is successfully mirrored back online.

NOTE: The above procedure can be followed for replacing a secondary disk failure.

Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

4 Responses

  1. Yogesh Raheja says:

    Don not forget to add the entry of your mirror disk in /boot/grub/menu.lst else you wont see any option in the GRUB menu. In that case you need to find the mirror disk via Grub prompt and have to boot the server from mirror disk accordingly. So best option is to keep the entry in menu.lst while doing mirroring in x-86 servers. Also you will encounter many errors while performing this activity in x-86 servers. That you champs need to check and ask..:)

  2. rony says:

    How to break the root mirroring on Solaris 10 x86

  3. Yogesh Raheja says:

    @Rony, here we have to cases: one is SVM software RAID.In this case the procedure will remain the same as that of SPARC but unfortunately you wont be able to boot your box with mirror disk. I chased up with SUN for much time but No vaild work around was provided by them. At last I tried some methods to recover the same and find the way to boot the box from mirror disk but it requires couple of tricks which I will share in seperate post. The second method is hardware RAID in that case you can bring out the disk using raidctl command or simple pull out the disk as inacse of Linux.

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us