Tag: metastat

Setup a SVM mirror in Solaris 10

In a Solaris server there are two local disks

root@solaris10:~ # echo | format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@0,600000/pci@0/scsi@1/sd@0,0
1. c0t1d0
/pci@0,600000/pci@0/scsi@1/sd@1,0
Specify disk (enter its number): Specify disk (enter its number):

Specify disk (enter its number): 1

Verify partition table

selecting c0t1d0
[disk formatted]

FORMAT MENU:
disk – select a disk
type – select (define) a disk type
partition – select (define) a partition table
current – describe the current disk
format – format and analyze the disk
repair – repair a defective sector
label – write label to the disk
analyze – surface analysis
defect – defect list management
backup – search for backup labels
verify – read and display labels
save – save new disk/partition definitions
inquiry – show vendor, product and revision
volname – set 8-character volume name
!<cmd> – execute , then return
quit
format> p

Display disk partitions

PARTITION MENU:
0 – change `0′ partition
1 – change `1′ partition
2 – change `2′ partition
3 – change `3′ partition
4 – change `4′ partition
5 – change `5′ partition
6 – change `6′ partition
7 – change `7′ partition
select – select a predefined table
modify – modify a predefined partition table
name – name the current table
print – display the current table
label – write partition map and label to the disk
!<cmd> – execute , then return
quit
partition> p

Partition 0 is /
Partition 1 is swap
Partition 3 is /var
Partition 7 is where metadevice state database

Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 2061 – 4121 20.00GB (2061/0/0) 41945472
1 swap wu 4122 – 10716 64.00GB (6595/0/0) 134221440
2 backup wm 0 – 14086 136.71GB (14087/0/0) 286698624
3 var wm 0 – 2060 20.00GB (2061/0/0) 41945472
4 unassigned wm 10717 – 11026 3.01GB (310/0/0) 6309120
5 unassigned wm 11027 – 11233 2.01GB (207/0/0) 4212864
6 usr wm 11234 – 11749 5.01GB (516/0/0) 10501632
7 unassigned wm 11750 – 11755 59.62MB (6/0/0) 122112

partition>

Checking metadevice state database

root@solaris10:~ # metadb
metadb: solaris10: there are no existing databases

In the example below I’m going to create three copies on partition 7 of disk c0t1d0

root@solaris10:~ # metadb -a -f -c3 /dev/dsk/c0t1d0s7

Checking metadevice state database

root@solaris10:~ # metadb
flags first blk block count
a u 16 8192 /dev/dsk/c0t1d0s7
a u 8208 8192 /dev/dsk/c0t1d0s7
a u 16400 8192 /dev/dsk/c0t1d0s7

Creating the metadevice with disk partitions

root@solaris10:~ # metainit -f d12 1 1 c0t1d0s0
d12: Concat/Stripe is setup
root@solaris10:~ # metainit -f d22 1 1 c0t1d0s1
d22: Concat/Stripe is setup
root@solaris10:~ # metainit -f d32 1 1 c0t1d0s3
d32: Concat/Stripe is setup

Metadevices created

root@solaris10:~ # metastat -p
d32 1 1 c0t1d0s3
d22 1 1 c0t1d0s1
d12 1 1 c0t1d0s0

Setting up Solaris Volume Manager mirror.

root@solaris10:~ # metainit d10 -m d12
d10: Mirror is setup

Setting up to boot with the mirror

root@solaris10:~ # metaroot d10

Setting up the rest of metadevices as mirror as well

root@solaris10:~ # metainit d30 -m d32
d30: Mirror is setup

root@solaris10:~ # metainit d20 -m d22
d20: Mirror is setup

Checking the status

root@solaris10:~ # metastat -p
d20 -m d22 1
d22 1 1 c0t1d0s1
d30 -m d32 1
d32 1 1 c0t1d0s3
d10 -m d12 1
d12 1 1 c0t1d0s0

root@solaris10:~ # shutdown -y -g0 -i0

After the reboot, check if the server is using the metadevice using df -h

Then create the metadevices for the other side of the mirror and attach them

metainit -f d11 1 1 c0t0d0s0
metainit -f d21 1 1 c0t0d0s1
metainit -f d31 1 1 c0t0d0s3

metattach d10 d11
metattach d20 d21
metattach d30 d31

Create the database replicas on the other disk as well

metadb -a -f -c3 /dev/dsk/c0t0d0s7

Setting up a SVM soft partition in a mirror

This is the mirror we will be using

root@solaris:/ # metastat d80
d80: Mirror
Submirror 0: d82
State: Okay
Submirror 1: d81
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 96081792 blocks (45 GB)

d82: Submirror of d80
State: Okay
Size: 96081792 blocks (45 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t8d0s4 0 No Okay Yes

d81: Submirror of d80
State: Okay
Size: 96081792 blocks (45 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t10d0s4 0 No Okay Yes

Device Relocation Information:
Device Reloc Device ID
c1t8d0 Yes id1,sd@TSEAGATE_ST314670LSUN146G3KS2ZHD2
c0t10d0 Yes id1,sd@TSEAGATE_ST314670LSUN146G3KS2RP29

Creating a soft partition and instead of indicating a partition, declare the mirror

root@solaris:/ # metainit d83 -p d80 2g
d83: Soft Partition is setup

Create the filesystem

root@solaris:/ # newfs /dev/md/rdsk/d83
newfs: construct a new file system /dev/md/rdsk/d83: (y/n)? y
Warning: 18560 sector(s) in last cylinder unallocated
/dev/md/rdsk/d83: 4194304 sectors in 207 cylinders of 24 tracks, 848 sectors
2048.0MB in 42 cyl groups (5 c/g, 49.69MB/g, 12032 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 102640, 205248, 307856, 410464, 513072, 615680, 718288, 820896, 923504,
3256352, 3358960, 3461568, 3564176, 3666784, 3769392, 3872000, 3974608,
4077216, 4179824

Check status

root@solaris:/ # metastat -c
d83 p 2.0GB d80
d80 m 45GB d82 d81
d82 s 45GB c1t8d0s4
d81 s 45GB c0t10d0s4
d50 m 516MB d52 d51
d52 s 516MB c1t8d0s7
d51 s 516MB c0t10d0s7
d40 m 19GB d42 d41
d42 s 19GB c1t8d0s6
d41 s 19GB c0t10d0s6
d30 m 19GB d32 d31
d32 s 19GB c1t8d0s5
d31 s 19GB c0t10d0s5
d20 m 31GB d22 d21
d22 s 31GB c1t8d0s1
d21 s 31GB c0t10d0s1
d10 m 19GB d12 d11
d12 s 19GB c1t8d0s0
d11 s 19GB c0t10d0s0

Solaris SVM – Metadevice in needs maintenance state. Invoke metareplace

On your Solaris server, a disk that is part of a mirror goes bad and needs replacement.

root@solaris:~ # metastat d50
d50: Mirror
Submirror 0: d51
State: Needs maintenance
Submirror 1: d52
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 32776896 blocks (15 GB)

d51: Submirror of d50
State: Needs maintenance
Invoke: metareplace d50 c0t0d0s5

Size: 32776896 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s5 0 No Maintenance Yes

d52: Submirror of d50
State: Okay
Size: 32776896 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s5 0 No Okay Yes

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@n500000e013633ce0
c0t1d0 Yes id1,sd@n500000e013633810

After you physically replace the bad disk, the submirror will still show as needing maintenance. You need to invoke metareplace to sync the submirror

root@solaris:~ # metareplace -e d50 /dev/dsk/c0t0d0s5
d50: device c0t0d0s5 is enabled

root@solaris:~ # metastat d50
d50: Mirror
Submirror 0: d51
State: Resyncing
Submirror 1: d52
State: Okay
Resync in progress: 0 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 32776896 blocks (15 GB)

d51: Submirror of d50
State: Resyncing
Size: 32776896 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s5 0 No Resyncing Yes

d52: Submirror of d50
State: Okay
Size: 32776896 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s5 0 No Okay Yes

Device Relocation Information:
Device Reloc Device ID
c0t0d0 Yes id1,sd@n500000e013633ce0
c0t1d0 Yes id1,sd@n500000e013633810

Repeat the process to all the remaining submirrors that were on that disk