Monday, March 1, 2010

Mirroring root disk in solaris 10 on x86 system

Lets assume you are running an critical system on an x86 server...u can’t say everything will be safe n secure all the time…always there is an evil hiding in some corner of the data center to disturb your systems…so its better to mirror the root file system and configure an alternate boot ,in case if the system doesn’t boot atleast u can boot the OS from the other active disk and have your server up to make the necessary troubleshooting…….
I like to share the steps followed in mirroring of the root file system in an x86 machine running solaris 10 operating system.
I have an solaris 10 installed on my laptop (offcourse an x86 machine) on one of the virtual machine .Along with the boot disk u need to attach one more hard disk of same size.This new hard disk will be made bootable disk in the latter part of this document.
Slice7 of both the hard disks must have been assigned an minute space ,say 50 mb…this will accommodate the metadb information.

Step1: run the format command and confirm the existence of 2nd hard disk.
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0d0
/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c0d1
/pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
Specify disk (enter its number): ^C


Step2: update the second disk vtoc as of the root disk
# prtvtoc /dev/rdsk/c0d0s2 | fmthard – -s /dev/rdsk/c0d1s2
Step3: have a look on the second disks prtvtoc which should show same as root disk.
# prtvtoc /dev/rdsk/c0d1s2

Step4:Now create 3 copies metadb on both disks
# metadb –a –f –c3 c0d0s7 c0d1s7
Step5:check the metadb status
#metadb –i
Step 6: ok,lets go for volume manager tasks.
#metainit -f d1 1 1 c0d0s0
d1: Concat/Stripe is setup

#metainit d0 –m d1
d0: Mirror is setup

#metaroot d0

check for the newly created meta devices under vfstab file

/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -

Step7: so reboot the server now
#init 6
Step 8: now we need to add second disk under volume management.
#metainit -f d2 1 1 c0d1s0
d2:Concat/Stripe is setup

step9:attach them to the mirrors created previously.

# metattach d0 d2
d0: submirror d2 is attached

now at this point to time process of resynchronization starts and u can monitor it by the following command

# metastat | grep %

Step 10: after resync reaches 100%,then we are left with making the second disk as bootable active disk.we need to check whether the partition on the second disk is active.


# fdisk /dev/rdsk/c0d1p0
Total disk size is 1566 cylinders
Cylinder size is 16065 (512 byte) blocks

Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 1 1565 1565 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: 5


Step11: make the second disk bootable by installing the bootloader.

# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0d1s0
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 233 sectors starting at 50 (abs 16115)

step12: edit the file /boot/grub/menu.lst to update the mirror-boot parameters.
Add the following line,title can be given of your wish, b carefull while using that vi editor (personally I hate that vi editor…yuk!!)
title mirror-boot
root (hd1,0,a)
kernel /platform/i86pc/multiboot
module /platform/i86pc/boot_archive


step13: check for the new entry of mirror-boot in the bootadm list

# bootadm list-menu
The location for the active GRUB menu is: /boot/grub/menu.lst
default 0
timeout 10
0 Solaris 10 5/08 s10x_u5wos_10 X86
1 Solaris failsafe
2 mirror-boot


So these are all the steps needed for completion of the process of mirror-boot.
now reboot the server and u should see the option mirror-boot at the grub menu.




0 comments:

Post a Comment