Preamble
This document is directed to give idea how to create mirroring of
root filesystem in Solaris x86 with the help of Solaris Volume Manager.
Here will be used already installed OS and all the work will be done
without need of reinstall
Prerequisites
1. First we should be sure have two identical harddisks in the server
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0d0 <DEFAULT cyl 1563 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c0d1 <DEFAULT cyl 1563 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
Specify disk (enter its number): ^C
2. Its need to create small slice for metadb information (usually slice 7) like:
partition> p
Current partition table (unnamed):
Total disk cylinders available: 1563 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 518 - 1562 8.01GB (1045/0/0) 16787925
1 swap wu 3 - 133 1.00GB (131/0/0) 2104515
2 backup wm 0 - 1562 11.97GB (1563/0/0) 25109595
3 unassigned wm 0 0 (0/0/0) 0
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 134 - 135 15.69MB (2/0/0) 32130
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 alternates wu 1 - 2 15.69MB (2/0/0) 32130
3. Next step is to create the same partitions on the second disk. To
avoid human error it is much better to use some kind of automations:
prtvtoc /dev/rdsk/c0d0s2 > /tmp/c0d0s2.toc
fmthard -s /tmp/c0d0s2.toc /dev/rdsk/c0d1s2
4. Then we should identify the partitions need to be mirrored:
# egrep "ufs|swap" /etc/vfstab|grep "/dev/dsk"
/dev/dsk/c0d0s1 - - swap - no -
/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 / ufs 1 no -
LVM
1. Let’s create few copies of metadb on the partitions we create for this puspose:
# metadb -a -f -c 2 c0d0s7 c0d1s7
2. It’s time to put our disks where OS reside under management of SVM
# metainit -f d10 1 1 c0d0s0
d10: Concat/Stripe is setup
# metainit -f d11 1 1 c0d0s1
d11: Concat/Stripe is setup
# metainit d0 -m d10
d0: Mirror is setup
# metainit d1 -m d11
d1: Mirror is setup
# metaroot d0
3. Check newly created devices:
# ls -l /dev/md/rdsk
total 8
lrwxrwxrwx 1 root root 36 Aug 30 18:29 d0 -> ../../../devices/pseudo/md@0:0,0,raw
lrwxrwxrwx 1 root root 36 Aug 30 18:29 d1 -> ../../../devices/pseudo/md@0:0,1,raw
lrwxrwxrwx 1 root root 37 Aug 30 18:28 d10 -> ../../../devices/pseudo/md@0:0,10,raw
lrwxrwxrwx 1 root root 37 Aug 30 18:28 d11 -> ../../../devices/pseudo/md@0:0,11,raw
# ls -l /dev/md/dsk
total 8
lrwxrwxrwx 1 root root 36 Aug 30 18:29 d0 -> ../../../devices/pseudo/md@0:0,0,blk
lrwxrwxrwx 1 root root 36 Aug 30 18:29 d1 -> ../../../devices/pseudo/md@0:0,1,blk
lrwxrwxrwx 1 root root 37 Aug 30 18:28 d10 -> ../../../devices/pseudo/md@0:0,10,blk
lrwxrwxrwx 1 root root 37 Aug 30 18:28 d11 -> ../../../devices/pseudo/md@0:0,11,blk
4. Make appropriate changes in
/etc/vfstab to get boot from mirror, not standard disks
# egrep "ufs|swap" /etc/vfstab|grep "/dev/md/dsk"
/dev/md/dsk/d1 - - swap - no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
5. The next step is to flush cache buffers and reboot
# sync;sync;sync
# reboot
6. It is time to put second disk under management of SVN
# metainit -f d20 1 1 c0d1s0
d20: Concat/Stripe is setup
# metainit -f d21 1 1 c0d1s1
d21: Concat/Stripe is setup
7. And to add them to created previously mirrors. Be aware process of
synchronisation will continue in background and you can check the
process
# metattach d0 d20
d0: submirror d20 is attached
# metattach d1 d21
d1: submirror d21 is attached
8. Check the process of building mirrors and wait till they finnish
# metastat
d1: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d21
State: Resyncing
Resync in progress: 96 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 2104515 blocks (1.0 GB)
d11: Submirror of d1
State: Okay
Size: 2104515 blocks (1.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0d0s1 0 No Okay Yes
d21: Submirror of d1
State: Resyncing
Size: 2104515 blocks (1.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0d1s1 0 No Okay Yes
d0: Mirror
Submirror 0: d10
State: Okay
Submirror 1: d20
State: Resyncing
Resync in progress: 13 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 16787925 blocks (8.0 GB)
d10: Submirror of d0
State: Okay
Size: 16787925 blocks (8.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0d0s0 0 No Okay Yes
d20: Submirror of d0
State: Resyncing
Size: 16787925 blocks (8.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0d1s0 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c0d1 Yes id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=01000000000000000001
c0d0 Yes id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=00000000000000000001
Boot
1. Next step is to check if partition on 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
2. And to add boot record to the second disk to make it bootable
# /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)
3. Add new item in the boot menu (/boot/grub/menu.lst) to have alternative way to boot
title Alternate boot
root (hd1,0,a)
kernel /platform/i86pc/multiboot
module /platform/i86pc/boot_archive
4. Check if the new item is added to the boot menu
# 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 Alternate boot
5. That’s all, you have already mirrored root partition (plus swap)
Conclusion
In the document are not mentioned all the options and possibilities
of SVM, but only short set, need to done the work. For further
information, please consult official Oracle documentation.
No comments:
Post a Comment