ユーザ用ツール

サイト用ツール


サイドバー

solaris:solaris10_02

Solaris 10 設定 svm RAID 1編

RAID 1 (2面ミラー)作成

準備

VMにプライマリと同じサイズのディスクを追加する。今回は12Gbyte HDDを追加。

関連ファイルのバックアップを行う。それぞれ、cp -p 元ファイル名 元ファイル名.yyyymmddなどでバックアップ。

  • /etc/vfstab
  • /etc/lvm/md.tab
  • /etc/lvm/mddb.cf
  • /etc/system
  • /boot/grub/menu.lst

ディスクの命名規則は以下の通りとする。

mount ミラーディスク名 サブミラー名
c0d0上 c0d1上
/d0d10d20
/vard3d13d23
swapd4d14d24
/optd5d15d25
/usrd6d16d26
/export/homed7d17d27

手順

追加したHDDを認識させる。

  • 認識前のformat
# 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
Specify disk (enter its number):
  • devfsadmの実行
# devfsadm
# (特に応答はない)
  • devfsadm実行後のformat
# 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 1564 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
Specify disk (enter its number):

c0d1にSolaris用の領域を確保する。

  • format → c0d1選択 → fdisk
format> fdisk
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
n
  • Create → SOLARIS2 → 100%
             Total disk size is 1566 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===



WARNING: no partitions are defined!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: 1
Select the partition type to create:
   1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other
   5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
   9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
   D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? 1
Specify the percentage of disk to use for this partition
(or type "c" to specify the size in cylinders). 100
Should this become the active partition? If yes, it  will be activated
each time the computer is reset or turned on.
Please type "y" or "n". n

パーティション情報のコピー

  • c0d0の情報をc0d1へコピー
# prtvtoc /dev/rdsk/c0d0s2 | fmthard -s - /dev/rdsk/c0d1s2
fmthard:  New volume table of contents now in place.
#
  • prtvtocで確認
# prtvtoc /dev/rdsk/c0d1s2
* /dev/rdsk/c0d1s2 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*    1565 cylinders
*    1563 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00      48195   1076355   1124549
       1      0    00    1124550    273105   1397654
       2      5    00          0  25109595  25109594
       3      7    00    1397655   4209030   5606684
       4      3    01    5606685   2104515   7711199
       5      0    00    7711200   2104515   9815714
       6      4    00    9815715  14233590  24049304
       7      8    00   24049305   1060290  25109594
       8      1    01          0     16065     16064
       9      9    01      16065     32130     48194
#

ファイルシステムの作成

  • ファイルシステム作成のスクリプトを作成する。
# cat /var/tmp/01_newfs.sh
#!/bin/sh

newfs /dev/rdsk/c0d1s0
newfs /dev/rdsk/c0d1s1
newfs /dev/rdsk/c0d1s3
newfs /dev/rdsk/c0d1s4
newfs /dev/rdsk/c0d1s5
newfs /dev/rdsk/c0d1s6
newfs /dev/rdsk/c0d1s7
  • 実行例
# sh /var/tmp/01_newfs.sh
/dev/rdsk/c0d1s0: Unable to find Media type. Proceeding with system determined parameters.
newfs: construct a new file system /dev/rdsk/c0d1s0: (y/n)? y
/dev/rdsk/c0d1s0: Unable to find Media type. Proceeding with system determined parameters.
Warning: 4990 sector(s) in last cylinder unallocated
/dev/rdsk/c0d1s0:       1076354 sectors in 176 cylinders of 48 tracks, 128 sectors
        525.6MB in 14 cyl groups (13 c/g, 39.00MB/g, 18624 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 80032, 160032, 240032, 320032, 400032, 480032, 560032, 640032, 720032,
 800032, 880032, 960032, 1040032
(以下、c0d1s7まで続く)

c0d1を起動ディスクとして使用可能にする

  • mbootのインストール
# fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c0d1p0

             Total disk size is 1566 cylinders
             Cylinder size is 16065 (512 byte) blocks 

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 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
  • grubのインストール
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0d1s0
Solaris boot partition inactive.
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 265 sectors starting at 50 (abs 16115)
#

状態データベースの作成

  • c0d0s1(/REPLICA)に状態データベースを作成するため、umountする
# umount /REPLICA
#
  • /etc/vfstabで/REPLICAを無効化する
 #/dev/dsk/c0d0s1        /dev/rdsk/c0d0s1        /REPLICA        ufs     2 yes     -
  • (気になるなら)/REPLICAを削除する
 # rm -r /REPLICA
* 状態データベースを作成する
 # metadb -a -c 5 -l 8192 -f c0d0s1 c0d1s1
 #
  • metadbで確認
# metadb
        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c0d0s1
     a        u         8208            8192            /dev/dsk/c0d0s1
     a        u         16400           8192            /dev/dsk/c0d0s1
     a        u         24592           8192            /dev/dsk/c0d0s1
     a        u         32784           8192            /dev/dsk/c0d0s1
     a        u         16              8192            /dev/dsk/c0d1s1
     a        u         8208            8192            /dev/dsk/c0d1s1
     a        u         16400           8192            /dev/dsk/c0d1s1
     a        u         24592           8192            /dev/dsk/c0d1s1
     a        u         32784           8192            /dev/dsk/c0d1s1
#

ミラーの作成

  • /var/tmp/02_metainit.shを作成
#!/bin/sh

metainit -f d10 1 1 c0d0s0
metainit -f d20 1 1 c0d1s0
metainit d0 -m d10

metainit -f d13 1 1 c0d0s3
metainit -f d23 1 1 c0d1s3
metainit d3 -m d13

metainit -f d14 1 1 c0d0s4
metainit -f d24 1 1 c0d1s4
metainit d4 -m d14

metainit -f d15 1 1 c0d0s5
metainit -f d25 1 1 c0d1s5
metainit d5 -m d15

metainit -f d16 1 1 c0d0s6
metainit -f d26 1 1 c0d1s6
metainit d6 -m d16

metainit -f d17 1 1 c0d0s7
metainit -f d27 1 1 c0d1s7
metainit d7 -m d17
  • ミラー構成

</code> # sh /var/tmp/02_metainit.sh d10: Concat/Stripe is setup d20: Concat/Stripe is setup d0: Mirror is setup

(中略)

d17: Concat/Stripe is setup d27: Concat/Stripe is setup d7: Mirror is setup # </code>

状態確認

  • まだc0d1上のサブミラーは接続されていないのでd1xのみ表示される。
# metastat
d7: Mirror
    Submirror 0: d17
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 1060290 blocks (517 MB)

d17: Submirror of d7
    State: Okay
    Size: 1060290 blocks (517 MB)
    Stripe 0:
        Device   Start Block  Dbase        State Reloc Hot Spare
        c0d0s7          0     No            Okay   Yes
(以下略)

起動ディスク変更

  • metarootで起動ディスクをd0に変更する
# metaroot d0
#
  • /etc/vfstabの/のデバイスが/dev/®dsk/d0に更新されている事を確認する
# cat /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/dsk/c0d0s4 -       -       swap    -       no      -
/dev/md/dsk/d0  /dev/md/rdsk/d0 /       ufs     1       no      -
(以下略)
  • /etc/systemにrootdevのエントリが追加された事を確認する
# cat /etc/system
(中略)
* Begin MDD root info (do not edit)
rootdev:/pseudo/md@0:0,0,blk
* End MDD root info (do not edit)
  • /etc/vfstabを編集し、各デバイスをmdに変更する。
mount point FS type 変更前 変更後
device to mount device to fsck device to mount device to fsck
/ufs/dev/dsk/c0d0s0/dev/rdsk/c0d0s0/dev/md/dsk/d0/dev/md/rdsk/d0
/varufs/dev/dsk/c0d0s3/dev/rdsk/c0d0s3/dev/md/dsk/d3/dev/md/rdsk/d3
-swap/dev/dsk/c0d0s4-/dev/md/dsk/d4-
/optufs/dev/dsk/c0d0s5/dev/rdsk/c0d0s5/dev/md/dsk/d5/dev/md/rdsk/d5
/usrufs/dev/dsk/c0d0s6/dev/rdsk/c0d0s6/dev/md/dsk/d6/dev/md/rdsk/d6
/export/homeufs/dev/dsk/c0d0s7/dev/rdsk/c0d0s7/dev/md/dsk/d7/dev/md/rdsk/d7

一度リブート後、サブミラーの接続を行う。

  • /var/tmp/03_metattach.shの作成
#!/bin/sh

metattach d0 d20
metattach d3 d23
metattach d4 d24
metattach d5 d25
metattach d6 d26
metattach d7 d27
  • サブミラー接続
 # sh /var/tmp/03_metattach.sh
 d0: submirror d20 is attached
 d3: submirror d23 is attached
 d4: submirror d24 is attached
 d5: submirror d25 is attached
 d6: submirror d26 is attached
 d7: submirror d27 is attached
 #
  • 状態確認
# metastat
d7: Mirror
    Submirror 0: d17
      State: Okay
    Submirror 1: d27
      State: Resyncing
    Resync in progress: 6 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 1060290 blocks (517 MB)

d17: Submirror of d7
    State: Okay
    Size: 1060290 blocks (517 MB)
    Stripe 0:
        Device   Start Block  Dbase        State Reloc Hot Spare
        c0d0s7          0     No            Okay   Yes


d27: Submirror of d7
    State: Resyncing
    Size: 1060290 blocks (517 MB)
    Stripe 0:
        Device   Start Block  Dbase        State Reloc Hot Spare
        c0d1s7          0     No            Okay   Yes
(以下略)

同期完了の確認を行う。同期の進捗は以下の様に出力される。何も表示されなくなったら完了。

 # metastat | grep done
     Resync in progress: 46 % done
     Resync in progress: 24 % done
     Resync in progress: 24 % done
     Resync in progress: 12 % done
     Resync in progress: 51 % done
     Resync in progress: 2 % done
 #

metastatで各ミラー(d<n>)に属するSubmirrorのStateが全てOkay(Resyncingではない)であれば同期完了

GRUB設定

  • /boot/grub/menu.lstに代替ルートを追加する。
title alternate boot
root(hd1,0,a)
kernel /platform/i86pc/multiboot
module /platform/i86pc/boot_archive

追加した構成で起動できる事を確認する。

RAID 1 (3面ミラー)作成

2面ミラー構成後に3面ミラーにする手順は下記の通り。

準備

VMにプライマリと同じサイズのディスクを追加する。今回は12Gbyte HDDを追加。

関連ファイルのバックアップを行う。それぞれ、cp -p 元ファイル名 元ファイル名.yyyymmddなどでバックアップ。

  • /etc/vfstab
  • /etc/lvm/md.tab
  • /etc/lvm/mddb.cf
  • /etc/system
  • /boot/grub/menu.lst

ディスクの命名規則

mount ミラーディスク名 サブミラー名
c0d0上 c0d1上 c1d1上
/d0d10d20d30
/vard3d13d23d33
swapd4d14d24d34
/optd5d15d25d35
/usrd6d16d26d36
/export/homed7d17d27d37

手順

追加したHDDを認識させる

  • 認識前のformat
# 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):
  • devfsadmの実行
# devfsadm
# (特に応答はない)
  • 認識後のformat
# 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
       2. c1d1 <DEFAULT cyl 1564 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0
Specify disk (enter its number):+領域の確保

c1d1にSolaris用の領域を確保する

  • format → c1d1選択 → fdisk
format> fdisk
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
n
  • Create → SOLARIS2 → 100%
             Total disk size is 1566 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===



WARNING: no partitions are defined!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: 1
Select the partition type to create:
   1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other
   5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
   9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
   D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? 1
Specify the percentage of disk to use for this partition
(or type "c" to specify the size in cylinders). 100
Should this become the active partition? If yes, it  will be activated
each time the computer is reset or turned on.
Please type "y" or "n". n

パーティション情報のコピー

  • c0d0の情報をc1d1へコピー
# prtvtoc /dev/rdsk/c0d0s2 | fmthard -s - /dev/rdsk/c0d1s2
fmthard:  New volume table of contents now in place.
#
  • prtvtocで確認
# prtvtoc /dev/rdsk/c1d1s2
* /dev/rdsk/c1d1s2 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*    1565 cylinders
*    1563 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00      48195   1076355   1124549
       1      0    00    1124550    273105   1397654
       2      5    00          0  25109595  25109594
       3      7    00    1397655   4209030   5606684
       4      3    01    5606685   2104515   7711199
       5      0    00    7711200   2104515   9815714
       6      4    00    9815715  14233590  24049304
       7      8    00   24049305   1060290  25109594
       8      1    01          0     16065     16064
       9      9    01      16065     32130     48194
#

ファイルシステムの作成

  • スクリプトの再利用
# cat /var/tmp/01_newfs.sh
#!/bin/sh

newfs /dev/rdsk/c1d1s0
newfs /dev/rdsk/c1d1s1
newfs /dev/rdsk/c1d1s3
newfs /dev/rdsk/c1d1s4
newfs /dev/rdsk/c1d1s5
newfs /dev/rdsk/c1d1s6
newfs /dev/rdsk/c1d1s7
  • 実行例
# sh /var/tmp/01_newfs.sh
/dev/rdsk/c1d1s0: Unable to find Media type. Proceeding with system determined parameters.
newfs: construct a new file system /dev/rdsk/c1d1s0: (y/n)? y
/dev/rdsk/c1d1s0: Unable to find Media type. Proceeding with system determined parameters.
Warning: 4990 sector(s) in last cylinder unallocated
/dev/rdsk/c1d1s0:       1076354 sectors in 176 cylinders of 48 tracks, 128 sectors
        525.6MB in 14 cyl groups (13 c/g, 39.00MB/g, 18624 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 80032, 160032, 240032, 320032, 400032, 480032, 560032, 640032, 720032,
 800032, 880032, 960032, 1040032 
(以下、c1d1s7まで続く)

c1d1を起動ディスクとして使用可能にする

  • mbootのインストール
# fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c1d1p0

             Total disk size is 1566 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 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
  • grubのインストール
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1d1s0
Solaris boot partition inactive.
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 265 sectors starting at 50 (abs 16115)
#

状態データベースの追加

  • 状態データベースをc1d1s1にも作成する
# metadb -a -c 5 -l 8192 c1d1s1
#
  • metadbで確認
# metadb
        flags           first blk       block count
     a m  p  luo        16              8192            /dev/dsk/c0d0s1
     a    p  luo        8208            8192            /dev/dsk/c0d0s1
     a    p  luo        16400           8192            /dev/dsk/c0d0s1
     a    p  luo        24592           8192            /dev/dsk/c0d0s1
     a    p  luo        32784           8192            /dev/dsk/c0d0s1
     a    p  luo        16              8192            /dev/dsk/c0d1s1
     a    p  luo        8208            8192            /dev/dsk/c0d1s1
     a    p  luo        16400           8192            /dev/dsk/c0d1s1
     a    p  luo        24592           8192            /dev/dsk/c0d1s1
     a    p  luo        32784           8192            /dev/dsk/c0d1s1
     a        u         16              8192            /dev/dsk/c1d1s1
     a        u         8208            8192            /dev/dsk/c1d1s1
     a        u         16400           8192            /dev/dsk/c1d1s1
     a        u         24592           8192            /dev/dsk/c1d1s1
     a        u         32784           8192            /dev/dsk/c1d1s1
#
  • サブミラーの作成 。/var/tmp/02_metainit.shを再利用
#!/bin/sh

metainit -f d30 1 1 c1d1s0
metainit -f d33 1 1 c1d1s3
metainit -f d34 1 1 c1d1s4
metainit -f d35 1 1 c1d1s5
metainit -f d36 1 1 c1d1s6
metainit -f d37 1 1 c1d1s7
  • サブミラー構成
# sh /var/tmp/02_metainit.sh
d30: Concat/Stripe is setup
d33: Concat/Stripe is setup
d34: Concat/Stripe is setup
d35: Concat/Stripe is setup
d36: Concat/Stripe is setup
d37: Concat/Stripe is setup
#

状態確認

  • まだc1d1上のサブミラーは接続されていない
# metastat
(省略)
d37: Concat/Stripe
    Size: 1060290 blocks (517 MB)
    Stripe 0:
        Device   Start Block  Dbase     Reloc
        c1d1s7          0     No        Yes

(中略)

d30: Concat/Stripe
    Size: 1076355 blocks (525 MB)
    Stripe 0:
        Device   Start Block  Dbase     Reloc
        c1d1s0          0     No        Yes

Device Relocation Information:
Device   Reloc  Device ID
c1d1   Yes      id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=11000000000000000001
c0d1   Yes      id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=01000000000000000001
c0d0   Yes      id1,cmdk@AVMware_Virtual_IDE_Hard_Drive=00000000000000000001
  • サブミラーの接続。/var/tmp/03_metattach.shの再利用
#!/bin/sh

metattach d0 d30
metattach d3 d33
metattach d4 d34
metattach d5 d35
metattach d6 d36
metattach d7 d37
  • サブミラー接続
# sh /var/tmp/03_metattach.sh
d0: submirror d30 is attached
d3: submirror d33 is attached
d4: submirror d34 is attached
d5: submirror d35 is attached
d6: submirror d36 is attached
d7: submirror d37 is attached
#
  • 状態確認
# metastat
d7: Mirror
    Submirror 0: d17
      State: Okay
    Submirror 1: d27
      State: Okay
    Submirror 2: d37
      State: Resyncing
    Resync in progress: 4 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 1060290 blocks (517 MB)
(以下略)
  • 同期完了の確認。何も表示されなくなったら完了
# metastat | grep done
    Resync in progress: 19 % done
    Resync in progress: 9 % done
    Resync in progress: 9 % done
    Resync in progress: 4 % done
    Resync in progress: 21 % done
    Resync in progress: 0 % done
#

metastatで各ミラー(d<n>)に属するSubmirrorのStateが全てOkay(Resyncingではない)であれば同期完了

GRUB設定

  • /boot/grub/menu.lstに代替ルートを追加する。
title boot from c1d1
root(hd2,0,a)
kernel /platform/i86pc/multiboot
module /platform/i86pc/boot_archive
  • 追加した構成で起動できる事を確認する。
solaris/solaris10_02.txt · 最終更新: 2011/10/18 09:44 by dummy@dummy