Advertisements

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

Advertisements
%d bloggers like this: