本日のお題は、「システムディスクのmirror設定」です。
通常、システムの耐障害性を向上させるため、システムディスク(OSがインストールされているハードディスク)はRAID1(ミラーリング)構成とされます。
Solaris 10 までの場合、ルートファイルシステムは(よっぽど変わり者でない限り)UFSとなります。この場合、RAID1構成とするには、別途Solistice DiskSuiteや、PRIMECLUSTER Global Disk Services等のソフトを利用することとなります。
ところが、Solaris 11 から ZFSルートがデフォルトとなったため、上記のオプションソフトを利用せずにRAID1構成が可能となりました。簡単に出来そうなのですが、ちょっとした落とし穴もあるため、以下に設定手順を整理しておきます。
※インストール時にRAID1構成を指定可能なのかは、検証していません。
インストール直後は、システムディスクは単独構成となっているため、ミラー用のディスクを追加する必要があります。
まずは、現状の状態確認を行います。
% zpool status rpool
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c4t0d0s0 ONLINE 0 0 0
rpoolは、c4t0d0s0単独で構成されている状態です。
ここに、ミラー用のディスクを追加することとなりますが、追加するために若干の作業(ミラー先ディスクに、ラベル付けを行っておく)が必要となります。
% sudo format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c4t0d0 <ATA-VBOX HARDDISK-1.0 cyl 2085 alt 2 hd 255 sec 63>
/pci@0,0/pci1000,8000@16/sd@0,0
1. c4t1d0 <VBOX-HARDDISK-1.0 cyl 2086 alt 2 hd 255 sec 63>
/pci@0,0/pci1000,8000@16/sd@1,0
Specify disk (enter its number): 1
ミラー先ディスクは、c4t1d0になるので、「1」を入力する。
selecting c4t1d0
[disk formatted]
No Solaris fdisk partition found.
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
fdisk - run the fdisk program
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 disk ID
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> fdisk
fdiskパーティションの作成を行うため、「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.
y
「y」を入力し、ディスク全体を、Solarisパーティションとする。
format> partition
スライス設定のため「partition」と入力する。
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 <cmd>, then return
quit
partition> 0
スライス0に全領域を割り当てるため、「0」を入力する。
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 2085c
partition> p
Current partition table (unnamed):
Total disk cylinders available: 2085 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 - 2084 15.97GB (2085/0/0) 33479460
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 2084 15.97GB (2085/0/0) 33495525
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 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 unassigned wu 0 0 (0/0/0) 0
9 unassigned wm 0 0 (0/0/0) 0
スライス0に全領域が割り当てられたことを確認。
partition> label
Ready to label disk, continue? y
変更をディスクに書き込むため「label」と入力する。
partition> q
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
fdisk - run the fdisk program
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 disk ID
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> q
ミラー先ディスクの準備が整ったので、いよいよミラー化の実施です。
% sudo zpool attach -f rpool c4t0d0s0 c4t1d0s0
Make sure to wait until resilver is done before rebooting.
RAID1構成となったこと及び、コピーの進捗確認は、以下のコマンドで。
% zpool status rpool
pool: rpool
state: ONLINE
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scan: resilver in progress since Mon Dec 10 13:08:06 2012
223M scanned out of 5.22G at 2.17M/s, 0h39m to go
223M resilvered, 4.18% done
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c4t0d0s0 ONLINE 0 0 0
c4t1d0s0 ONLINE 0 0 0 (resilvering)
errors: No known data errors
ミラー先ディスクの事前準備を忘れた場合は、s0が存在しないため、cXtXdXで指定することになるが、その場合、以下のエラーが発生するので注意すること。
% sudo zpool attach rpool c4t0d0 c4t1d0
cannot label 'c4t1d0': EFI labeled devices are not supported on root pools.
zpool の attach コマンドで、"-f" オプションを指定しなかった場合は、こちらのエラーが...
% sudo format zpool attach rpool c4t0d0s0 c4t1d0s0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c4t1d0s0 overlaps with /dev/dsk/c4t1d0s2
Solistic DiskSuiteやPRIMECLUSTER GDSよりも、かなり簡単な作業でRAID1構成とすることが可能と感じた。
-- 2012年12月10日 17時15分 追記 --
-- 2012年12月10日 17時15分 追記 --
上記手順だけでは、ミラー先ディスクから起動できません。
ブートローダーをインストールしましょう。 :-)
手元に、Sparc環境がないので、x86環境のみですが....
まずは、boot archive の更新のため、システムをリブート(もちろん、bootadmコマンドで更新してもOKですが、環境変更後も起動が可能であることを確認する意味もあるため、リブートを推奨)。
% sudo shutdown -i6 -g0 -y
無事起動できたら、ブートローダーをミラー先ディスクにインストール。
% sudo bootadm install-bootloader c4t1d0s0
正常に終了したら、一度システムを停止。
ミラー元ディスク(例の場合、c4t0d0)をアクセスできない状態にして、システムを起動。
無事に起動すれば、設定完了だ。
システムを停止して、ミラー元ディスクをアクセス可能な状態にしておこう。
ブートローダーをインストールしましょう。 :-)
手元に、Sparc環境がないので、x86環境のみですが....
まずは、boot archive の更新のため、システムをリブート(もちろん、bootadmコマンドで更新してもOKですが、環境変更後も起動が可能であることを確認する意味もあるため、リブートを推奨)。
% sudo shutdown -i6 -g0 -y
無事起動できたら、ブートローダーをミラー先ディスクにインストール。
% sudo bootadm install-bootloader c4t1d0s0
正常に終了したら、一度システムを停止。
ミラー元ディスク(例の場合、c4t0d0)をアクセスできない状態にして、システムを起動。
無事に起動すれば、設定完了だ。
システムを停止して、ミラー元ディスクをアクセス可能な状態にしておこう。
0 件のコメント:
コメントを投稿