Wednesday, June 23, 2010

Enabling High Availability in Solaris 10 via SVM(Solaris Volume Manager)


Attach atleast two disks to the hardware running Solaris 10. Here I have taken two disks.

Inspecting the disk partition information.

c0t0d0 (root partition)
c0t1d0 (extra disk)

bash-3.00# format
Searching for disks...done

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

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

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm     421 -  6055       54.69GB    (5635/0/0)  114683520
  1       swap    wu       0 -   412        4.01GB    (413/0/0)     8405376
  2     backup    wm       0 - 14086      136.71GB    (14087/0/0) 286698624
  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       root    wm    6056 -  6057       19.88MB    (2/0/0)         40704
  7       home    wm    6058 - 14086       77.92GB    (8029/0/0)  163406208

Copying VTOC info from disk c0t0d0 to c0t1d0

bash-3.00#prtvtoc /dev/rdsk/c0t0d0s0 | fmthard -s - /dev/rsk/c0t1d0s0

Modifying the partitions in disk c0t1d0.

bash-3.00# format
Searching for disks...done

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

selecting c0t1d0: deepak
[disk formatted]

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       2 -  5636       54.69GB    (5635/0/0)  114683520
  1 unassigned    wu       0                0         (0/0/0)             0
  2     backup    wm       0 - 14086      136.71GB    (14087/0/0) 286698624
  3 unassigned    wu       0                0         (0/0/0)             0
  4 unassigned    wu       0                0         (0/0/0)             0
  5 unassigned    wu       0                0         (0/0/0)             0
  6       root    wm    6056 -  6057       19.88MB    (2/0/0)         40704
  7       home    wm    6058 - 14086       77.92GB    (8029/0/0)  163406208

partition> label
Ready to label disk, continue? y

partition>quit

Creating State Database Replicas

bash-3.00# metadb -a -f c0t0d0s6
bash-3.00# metadb
        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c0t0d0s6

Adding one more copy

bash-3.00# metadb -a -f c0t1d0s6
bash-3.00# metadb
        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c0t0d0s6
     a        u         16              8192            /dev/dsk/c0t1d0s6

Creating first RAID-0 volume/ Submirror (single stripe on single slice)

bash-3.00# metainit d21 1 1 c0t0d0s7
d21: Concat/Stripe is setup

Creating second RAID-0 volume/ Submirror (single stripe on single slice)

bash-3.00# metainit d22 1 1 c0t1d0s7
d22: Concat/Stripe is setup

Creating RAID-1 volumes/ Mirrors on first submirror

bash-3.00# metainit d0 -m d21
d0: Mirror is setup

Adding the second submirror to RAID-1 volume

bash-3.00# metattach d0 d22
d0: submirror d22 is attached

Creating a new UFS filesystem on metadevice d0

bash-3.00# newfs /dev/md/dsk/d0
newfs: construct a new file system /dev/md/rdsk/d0: (y/n)? y
Warning: 5760 sector(s) in last cylinder unallocated
/dev/md/rdsk/d0:        163406208 sectors in 26597 cylinders of 48 tracks, 128 sectors
        79788.2MB in 1663 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
.................................
super-block backups for last 10 cylinder groups at:
 162503328, 162601760, 162700192, 162798624, 162897056, 162995488, 163093920,
 163192352, 163290784, 163389216

Mounting the filesystem

bash-3.00# mount /dev/md/dsk/d0 /mydisk/

Testing Availability

bash-3.00# cd /mydisk/
bash-3.00# touch deepak.txt
bash-3.00# cat /mydisk/deepak.txt
This is a test message
bash-3.00# umount -f /mydisk/
bash-3.00# pwd
/mydisk
bash-3.00# ls
.: Not a directory
bash-3.00# cd /
Recovering data from disk c0t0d0
bash-3.00# mount /dev/dsk/c0t0d0s7 /mydisk/
bash-3.00# cat /mydisk/deepak.txt
This is a test message
bash-3.00# umount -f /mydisk/
bash-3.00# cd /
Recovering data from disk c0t1d0
bash-3.00# mount /dev/dsk/c0t1d0s7 /mydisk/
bash-3.00# cat /mydisk/deepak.txt
bash-3.00# umount -f /mydisk/
This is a test message
Reverting back to metadevice ie, RAID-1 volume.
bash-3.00# mount /dev/md/dsk/d0 /mydisk/



No comments:

Post a Comment