usage of vgdisplay

4月 18, 2009

Linuxで使われるLVMのコマンド、vgdisplay。
LVM(Logical Volume Manager)とは何か、なんてところから始めると話が大きく
なってしまうので、取り急ぎLVM関連で頻繁に使用すると思われる、vgdisplayに
ついてまとめておこうかな、と。

vgdisplayは何かというと・・・英文manから抜粋して、内容をまとめてみた。

vgdisplay – display attributes of volume groups

vgdisplay allows you to see the attributes of VolumeGroupName (or all volume groups if none is given) with it’s physical and logical volumes and their sizes etc.


以下、意訳入ってるけどこんな感じかと。

「vgdisplay – ボリュームグループの情報を表示する」
ボリュームグループ名を指定した場合はそのボリュームグループの、そうでなければすべての
ボリュームグループについて、物理及び論理ボリュームのサイズ、その他属性情報を表示する。
(そもそもボリュームグループとは何か、というのは今回は割愛)

以下、hp社のサイトからの抜粋ですが、言っていることは同じ。
最後に、「ボリュームグループは表示する前にアクティベイト(活性化)しておく必要がある」
と一言添えてある。

vgdisplay — display information about LVM volume groups

The vgdisplay command displays information about volume groups. For each vg_name specified, vgdisplay displays information for that volume group only. If no vg_name is specified, vgdisplay displays names and corresponding information for all defined volume groups.

The volume group must be activated (see vgchange(1M)) before it can be displayed.


ちなみに上記については翻訳版のページもあるのだが、機械翻訳入っているので正直意味不明
だったり・・・
英語ページとはいえシンプルな表現が続くので、英語で読んだ方が、翻訳版よりもかえって
頭に入りやすい気が、する。
では、オプションの説明についてよく使いそうなのをピックアップ。

-v
--verbose

Display verbose information containing long listings of physical and logical volumes. If given twice, also display verbose runtime information of vgdisplay’s activities.

詳細な情報を表示する。2回繰り返すと、vgdisplayアクティビティのランタイムインフォメーションも詳細に表示する。


一番よく使われるオプションではないだろうか。
verboseは「冗長な、くどい」などの意味だが、コンピュータ関連においては「詳細な」となる。
-vオプションは他にも多くのコマンドに使われるけど、もとはverboseなんですね。
(って、以前も調べておいて「ふ〜ん」と思ったはずなんだが、すぐ忘れてしまう)

vgdisplay -vで表示される情報は以下の通り(実際の出力結果はまた別)。
翻訳したところで”physical extent size”が「物理エクステントサイズ」になるだけなので、詳細は省略。

1 volume group name
2 volume group access
3 volume group status
4 internal volume group number
5 maximum number of logical volumes
6 current number of logical volumes
7 open count of all logical volumes in this volume group
8 maximum logical volume size
9 maximum number of physical volumes
10 current number of physical volumes
11 actual number of physical volumes
12 size of volume group in kilobytes
13 physical extent size
14 total number of physical extents for this volume group
15 allocated number of physical extents for this volume group
16 free number of physical extents for this volume group
17 uuid of volume group


あと、vgdisplay -vv。
-vvで出力される「ランタイムインフォメーション」ってそもそも何、って感じだが、
出力結果をみると、以下のようにVGの情報を捉える過程というか、findしている様子が
表示されるようだ。少なくとも自分は普段必要とすることはなさそうだが・・・

# vgdisplay -vv
Setting global/locking-type to 1
Setting global/locking-dir to /var/lock/lvm
File-based locking enabled

Finding all volume groups

/dev/ramdisk : No label detected
/dev/root : No label detected
(略)
/dev/cciss/c0d0p2 : lvm2 label detected
(略)
Unlocking /var/lock/lvm/VG NAME
Locking /var/lock/lvm/VG NAME RB

Finding volume group “VG NAME”
(略)


vgdisplay -cとは…

-c
--colon

Generate colon seperated output for easier parsing in scripts or programs.

スクリプトやプログラムにおいて解析しやすいように、コロンで区切られた出力結果を表示する。


出力結果は、上記のとおりそのまんま、です。
それから、vgdisplay -s。

-s
--short

Give a short listing showing the existence of volume groups.


あっさりした情報だけ表示、ってところかな。
出力結果は以下のような感じ。VGのサイズだけちょっと確認したい時なんかによいのだろーか?

# vgdisplay -s
VG NAME” 15.00GB [15.00GB used / 0MB free]
VG NAME” 16.00GB [16.00GB used / 0MB free]


以下は、まぁ、そのまんま。

-h
--help
--version


あとは、こんなのも。

-A
--activevolumegroups

Only select the active volume groups.

アクティブなボリュームグループのみ選択して表示


これはちょっと、条件がそろってる時じゃないと出力結果の確認はできないので、
機会があったら見てみようと思いマス。

【追記】
この後、機会があったので以下の状態で試してみた。
# vgchange -a n VG NAME で対象のVGを非アクティベイト

# vgdisplay -A

・・・が、対象VGの情報は表示された。
なので、「アクティブなボリュームグループ」っていうのがどういう状態なのか、
よくわかりません。


LVMは深いので、そう簡単には身に付かない。
でも、「あーだこーだ」とやっているうちに「あ、そういうことか」とつかめる時がきたりする。
LVMについてはまた改めてまとめてみようと思うw

関連記事
LVMをまとめてみようと思いついた
pvs,pvdisplayで物理ボリュームの確認
vgs,vgdisplayでボリュームグループの確認
lvs,lvdisplayで論理ボリュームの確認

Categories: Linux

No Responses so far | Have Your Say!

Comments are closed.