2007年 1月 25日 木曜日
やっぱり Sun がスキ!
システム監視ツール fsstat の紹介
皆さん fsstat って知っていますか?
fsstat は Solaris 10 の 3番目のアップデートリリースとなる、Solaris 10 11/06 で組み込まれた新機能の 1つです。
この機能は iostat や vmstat のようなカーネル統計情報を取得するための機能です。
基本的な機能の特徴は以下となります。
・カーネルによるファイルオペレーション動作をレポートします
・監視対象としてはマウントポイント単位、ファイルシステムタイプ単位となります
(※ 統計情報は Gバイト、Kバイト、Mバイトなど見やすい形式に自動的に単位が
設定されます)
使用方法は、全てのファイルシステムの統計情報を表示するために -F オプションを指定
するか、その他のオプション(-a | f | i | n | v )と一緒に 「ファイルシステム」 か
「マウントポイント」 を指定します。
連続して監視を行う場合は interval と count を指定することもできます。
(※)オプションの種類や表示項目の詳細についてはマニュアルをご参照ください。
実際にどのようなことができるか確認してみましょう。
まずは -F オプションを使用します。
bash-3.00# fsstat -F
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
276 47 11 41.0K 119 266K 1.03K 47.6K 81.6M 3.68K 3.95M ufs
0 0 0 295 0 456 178 111 34.6K 0 0 proc
0 0 0 0 0 0 0 0 0 0 0 nfs
0 0 0 0 0 0 0 0 0 0 0 zfs
0 0 0 1.76K 0 0 0 0 0 0 0 lofs
2.75K 2.38K 178 17.0K 28 3.38K 4 34.5K 34.5M 36.6K 31.6M tmpfs
0 0 0 62 0 0 0 32 5.07K 0 0 mntfs
0 0 0 0 0 0 0 0 0 0 0 nfs3
0 0 0 0 0 0 0 0 0 0 0 nfs4
0 0 0 0 0 0 0 0 0 0 0 autofs
bash-3.00#
上から 2行目までがファイルオペレーションの種類となります。
右側に全てのファイルシステム一覧が表示されます。
上記はシステム起動直後の状態ですが、すでに ufs や tmpfs 等が頻繁に使用されて
いるのがわかります。
次に直接 ufs(ファイルシステム) を指定します。
(※)この場合はファイルシステム、またはマウントポイントのどちらか(または両方)を指定することができます。
bash-3.00# fsstat zfs new name name attr attr lookup rddir read read write write file remov chng get set ops ops ops bytes ops bytes 276 47 11 41.0K 119 266K 1.03K 47.6K 81.6M 3.68K 3.95M ufs bash-3.00#
今度は詳細情報を表示する -f オプションを使用してみます。
(※)この場合もファイルシステム、またはマウントポイントのどちらか(または両方)
を指定することができます。
今回はとりあえずルート(/:マウントポイント)を指定します。
bash-3.00# fsstat -f /
/
operation #ops bytes
open 8.32K
close 9.5K
read 49.4K 81.7M
write 5.31K 4.05M
ioctl 10.0K
setfl 35
getattr 33.9K
setattr 94
access 12.0K
lookup 304K
create 257
remove 45
link 0
rename 7
mkdir 18
rmdir 2
readdir 1.37K 553K
symlink 4
readlink 6.64K
fsync 60
inactive 1.16K
fid 0
rwlock 56.1K
rwunlock 56.1K
seek 30.4K
cmp 58.1K
frlock 4.80K
space 6
realvp 2.19K
getpage 93.5K
putpage 559
map 15.3K
addmap 28.2K
delmap 26.4K
poll 26.1K
dump 0
pathconf 88
pageio 2
dumpctl 0
dispose 27.1K
getsecattr 404
setsecattr 19
shrlock 0
vnevent 0
このオプションは他のオプションとは表示形式が異なり左側にファイルシステムのオペレーションの種類、右側にはオペレーション数が表示されます。
上の例は、システムが起動してから現在までのルート(/)で行われたオペレーション情報が全て表示されています。
コマンドの説明はこれくらいにして、zfs ファイルシステムを作成して fsstat でその様子を確認してみましょう。
pool(pooltest1) を作成してみます。
bash-3.00# zpool create -f pooltest1 raidz c1t2d0s0 c1t2d0s1 c1t2d0s3
bash-3.00# fsstat zfs /pooltest1
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
0 0 0 1 0 0 0 0 0 0 0 zfs
0 0 0 1 0 0 0 0 0 0 0 /pooltest1
pool を作成したときにはattr getの値が増えています。
作成した pool に対してアクセスしてみましょう。
bash-3.00# ls -la /pooltest1/
合計 6
drwxr-xr-x 2 root sys 2 1月 22日 11:43 .
drwxr-xr-x 33 root root 1024 1月 22日 11:43 ..
bash-3.00#
bash-3.00# fsstat zfs /pooltest1
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
0 0 0 13 0 5 2 0 0 0 0 zfs
0 0 0 13 0 5 2 0 0 0 0 /pooltest1
今度は attr get, lookup ops, rddir ops の値が増えているのがわかります。
システムが起動されて初めて pool を作成したのでファイルシステム(zfs)もマウントポイント(pooltest1)もオペレーション数は同じになっています。 以降はシステムを再起動しない限りファイルシステム(zfs)の情報は蓄積されていきます。 もちろんマウントポイント(pooltest1)に対してのアクセスがあった場合にはマウント ポイント(pooltest1)の情報も蓄積されますが、そのときはファイルシステム(zfs)も 情報が蓄積されます。
もうひとつ pool(pootest2) を作成してみて、どんな情報が得られるか確認してみます。
bash-3.00# zpool create -f pooltest2 c1t2d0s4
bash-3.00# ls -la /pooltest2
合計 5
drwxr-xr-x 2 root sys 2 1月 22日 13:16 .
drwxr-xr-x 34 root root 1024 1月 22日 13:16 ..
bash-3.00#
bash-3.00# fsstat zfs /pooltest1 /pooltest2
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
0 0 0 23 0 10 4 0 0 0 0 zfs
0 0 0 13 0 5 2 0 0 0 0 /pooltest1
0 0 0 10 0 5 2 0 0 0 0 /pooltest2
pooltest2 が作成されたことによってファイルシステム(zfs)の値も増えているのがわかります。
(pooltest1 + pooltest2 = zfs)
マウントポイント(/pooltest1/test1)に対して直接ファイルやディレクトリ作成したり、内容を確認したりしても情報が蓄積されます。
現状の状態を確認
bash-3.00# fsstat zfs /pooltest1 /pooltest1/test1
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
1 0 0 33 0 24 10 0 0 0 0 zfs
1 0 0 22 0 19 8 0 0 0 0 /pooltest1
0 0 0 1 0 0 0 0 0 0 0 /pooltest1/test1
ディレクトリ、ファイルを作成
bash-3.00# mkdir aaa
bash-3.00# mkfile 100m bbb
bash-3.00# fsstat zfs /pooltest1 /pooltest1/test1
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
3 0 0 49 1 48 14 0 0 12.5K 100M zfs
1 0 0 27 0 37 10 0 0 0 0 /pooltest1
2 0 0 12 1 6 2 0 0 12.5K 100M /pooltest1/test1
ディレクトリ、ファイルを作成したことによりnew file, attr get, attr set, write ops, write bytes 等の値が増えています。
ディレクトリ名変更/削除、及びファイル名変更/削除
bash-3.00# mv aaa ccc
bash-3.00# rmdir ccc
bash-3.00# mv bbb aaa
bash-3.00# rm aaa
bash-3.00# fsstat zfs /pooltest1 /pooltest1/test1
new name name attr attr lookup rddir read read write write
file remov chng get set ops ops ops bytes ops bytes
3 2 2 89 1 133 16 0 0 12.5K 100M zfs
1 0 0 33 0 59 10 0 0 0 0 /pooltest1
2 2 2 46 1 69 4 0 0 12.5K 100M /pooltest1/test1
ディレクトリやファイル名前の変更/削除を行った結果、name remov, name chng等の値が増えています。
このように fsstat は ファイルシステムやマウントポイントに対して行われた情報を リアルタイムに取得することも可能ですし、システムが起動してから現在までの全情報 を取得することも可能となっています。
fsstat はデバイス単位でなく、ファイルシステムやマウントポイント単位で統計情報 が取れるってすごくないですか。皆さんもこの新機能を使ってファイルシステムの健全性のチェックに役立ててください。
Posted at 01:27午後 1 25, 2007 by Golgo1.3 in Sun | 投稿されたコメント[1]
Posted by Solaris User on 7月月 12日, 2007年 at 11:01 午後 JST #