Hello, stes.
Here is my work for OS mirroring:
■ Solaris 10 x86 Info:
Code: Select all
# more /etc/release
Oracle Solaris 10 1/13 s10x_u11wos_24a X86
Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.
Assembled 17 January 2013
# uname -a
SunOS solaris101 5.10 Generic_147148-26 i86pc i386 i86pc
# df -h /
Filesystem size used avail capacity Mounted on
/dev/dsk/c0t0d0s0 18G 3.9G 14G 23% /
■ OS disk information and partition table:
Code: Select all
OS Disk : SATA 20GB (Port 0)
CD/DVD : SATA (Port 29)
# cfgadm -al | grep 'sata0/0\>'
sata0/0::dsk/c0t0d0 disk connected configured ok
# echo | format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <ATA -VBOX HARDDISK -1.0 cyl 2607 alt 2 hd 255 sec 63>
/pci@0,0/pci8086,2829@d/disk@0,0
Specify disk (enter its number): Specify disk (enter its number):
Part Tag Flag Cylinders Size Blocks
0 root wm 1 - 2340 17.93GB (2340/0/0) 37592100
1 swap wu 2341 - 2602 2.01GB (262/0/0) 4209030
2 backup wm 0 - 2606 19.97GB (2607/0/0) 41881455
3 unassigned wm 2603 - 2606 31.38MB (4/0/0) 64260
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
■ Adding new disk (20GB/Port 1):
Code: Select all
# cfgadm -al | grep 'sata0/[01]\>'
sata0/0::dsk/c0t0d0 disk connected configured ok
sata0/1 sata-port disconnected unconfigured failed
# cfgadm -x sata_port_activate sata0/1
Activate the port: /devices/pci@0,0/pci8086,2829@d:1
This operation will enable activity on the SATA port
Continue (yes/no)? yes
# cfgadm -c configure sata0/1
# cfgadm -al | grep 'sata0/[01]\>'
sata0/0::dsk/c0t0d0 disk connected configured ok
sata0/1::dsk/c0t1d0 disk connected configured ok
# echo | format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <ATA -VBOX HARDDISK -1.0 cyl 2607 alt 2 hd 255 sec 63>
/pci@0,0/pci8086,2829@d/disk@0,0
1. c0t1d0 <ATA -VBOX HARDDISK -1.0 cyl 2608 alt 2 hd 255 sec 63>
/pci@0,0/pci8086,2829@d/disk@1,0
Specify disk (enter its number): Specify disk (enter its number):
■ Labeling new disk by using the prtvtoc and fmthard commands:
Code: Select all
# fdisk -B /dev/rdsk/c0t1d0p0
# prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
fmthard: New volume table of contents now in place.
# prtvtoc /dev/rdsk/c0t0d0s2 | grep -v '^*'
0 2 00 16065 37592100 37608164 /
1 3 01 37608165 4209030 41817194
2 5 00 0 41881455 41881454
3 0 00 41817195 64260 41881454
8 1 01 0 16065 16064
# prtvtoc /dev/rdsk/c0t1d0s2 | grep -v '^*'
0 2 00 16065 37592100 37608164
1 3 01 37608165 4209030 41817194
2 5 00 0 41881455 41881454
3 0 00 41817195 64260 41881454
8 1 01 0 16065 16064
■ Creating MetaDB:
Code: Select all
# metadb -f -a c0t0d0s3
# metadb -a c0t1d0s3
# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c0t0d0s3
a u 16 8192 /dev/dsk/c0t1d0s3
■ Creating one-way mirror:
Code: Select all
# metainit -f d11 1 1 c0t0d0s0
d11: Concat/Stripe is setup
# metainit -f d21 1 1 c0t0d0s1
d21: Concat/Stripe is setup
# metainit d10 -m d11
d10: Mirror is setup
# metainit d20 -m d21
d20: Mirror is setup
# metaroot d10
# echo 'set md:mirrored_root_flag=1' >> /etc/system
# vi /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/md/dsk/d20 - - swap - no - # changed /dev/dsk/c0t0d0s1 to /dev/md/dsk/d20
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no -
/devices - /devices devfs - no -
sharefs - /etc/dfs/sharetab sharefs - no -
ctfs - /system/contract ctfs - no -
objfs - /system/object objfs - no -
swap - /tmp tmpfs - yes -
# sync
# init 6
# df -h /
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d10 18G 3.9G 14G 23% /
# swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d20 85,20 8 4209016 4209016
# dumpadm -d swap
Dump content: kernel pages
Dump device: /dev/md/dsk/d20 (swap)
Savecore directory: /var/crash
Savecore enabled: yes
Save compressed: on
■ Creating two-way mirror:
Code: Select all
# metainit d12 1 1 c0t1d0s0
d12: Concat/Stripe is setup
# metainit d22 1 1 c0t1d0s1
d22: Concat/Stripe is setup
# metattach d10 d12
d10: submirror d12 is attached
# metattach d20 d22
d20: submirror d22 is attached
# metastat d10
d10: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d12
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 37592100 blocks (17 GB)
d11: Submirror of d10
State: Okay
Size: 37592100 blocks (17 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s0 0 No Okay Yes
d12: Submirror of d10
State: Okay
Size: 37592100 blocks (17 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s0 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBe4b17a10-75090f7e
c0t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB27121653-c2012b38
# metastat d20
d20: Mirror
Submirror 0: d21
State: Okay
Submirror 1: d22
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 4209030 blocks (2.0 GB)
d21: Submirror of d20
State: Okay
Size: 4209030 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s1 0 No Okay Yes
d22: Submirror of d20
State: Okay
Size: 4209030 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s1 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBe4b17a10-75090f7e
c0t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB27121653-c2012b38
■ Modifying the boot parameter:
Code: Select all
# eeprom bootpath
bootpath=/pci@0,0/pci8086,2829@d/disk@0,0:a
# eeprom bootpath=/pseudo/md@0:0,10,blk
■ Installing a boot block on second disk:
Code: Select all
# cd /boot/grub
# installgrub stage1 stage2 /dev/rdsk/c0t1d0s0
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 274 sectors starting at 50 (abs 16115)
■ Removing the first disk to force a failure:
Code: Select all
# echo | format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <drive type unknown>
/pci@0,0/pci8086,2829@d/disk@0,0
1. c0t1d0 <ATA -VBOX HARDDISK -1.0 cyl 2607 alt 2 hd 255 sec 63>
/pci@0,0/pci8086,2829@d/disk@1,0
Specify disk (enter its number): Specify disk (enter its number):
# cfgadm -al | grep 'sata0/[01]\>'
sata0/0 sata-port empty unconfigured ok
sata0/1::dsk/c0t1d0 disk connected configured ok
# metadb
flags first blk block count
Wm p l 16 8192 /dev/dsk/c0t0d0s3
a p luo 16 8192 /dev/dsk/c0t1d0s3
# metastat d10
d10: Mirror
Submirror 0: d11
State: Needs maintenance
Submirror 1: d12
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 37592100 blocks (17 GB)
d11: Submirror of d10
State: Needs maintenance
Invoke: metareplace d10 c0t0d0s0 <new device>
Size: 37592100 blocks (17 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s0 0 No Maintenance Yes
d12: Submirror of d10
State: Okay
Size: 37592100 blocks (17 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s0 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBe4b17a10-75090f7e
c0t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB27121653-c2012b38
# metastat d20
d20: Mirror
Submirror 0: d21
State: Needs maintenance
Submirror 1: d22
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 4209030 blocks (2.0 GB)
d21: Submirror of d20
State: Needs maintenance
Invoke: metareplace d20 c0t0d0s1 <new device>
Size: 4209030 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s1 0 No Maintenance Yes
d22: Submirror of d20
State: Okay
Size: 4209030 blocks (2.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s1 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBe4b17a10-75090f7e
c0t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB27121653-c2012b38
■Removing failed device information:
Code: Select all
# metadb -f -d c0t0d0s3
# metadb
flags first blk block count
a p luo 16 8192 /dev/dsk/c0t1d0s3
# metadetach -f d10 d11
d10: submirror d11 is detached
# metadetach -f d20 d21
d20: submirror d21 is detached
# metaclear d11 d21
d11: Concat/Stripe is cleared
d21: Concat/Stripe is cleared
# devfsadm -Cv
■Adding new disk(20GB/Port 0):
Code: Select all
# cfgadm -al | grep 'sata0/[01]\>'
sata0/0::dsk/c0t0d0 disk connected configured unusable <<<<<---- 'My question is about this point.'
sata0/1::dsk/c0t1d0 disk connected configured ok
I tried many tests but could not change unusable to ok.
I need help how to recognize new disk without system reboot at this point.
Thank you.