論理ボリュームマネージャの管理


Red Hat Enterprise Linux 6

LVM 管理者ガイド

Steven Levine

Red Hat Customer Content Services

概要

本ガイドは、クラスター化環境における LVM の実行に関する情報など、LVM 論理ボリュームマネージャについて説明しています。

第1章 はじめに

本ガイドは、クラスター化環境における LVM の実行に関する情報など、論理ボリュームマネージャ (LVM) について説明しています。

1.1. 対象読者

This book is intended to be used by system administrators managing systems running the Linux operating system. It requires familiarity with Red Hat Enterprise Linux 6.

1.2. ソフトウェアのバージョン

Expand
表1.1 ソフトウェアのバージョン
ソフトウェア説明
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 6 以降を指します
GFS2
Red Hat Enterprise Linux 6 以降の GFS2 を指します

1.4. フィードバック

誤字/脱字を発見された場合、もしくは本ガイドを改善するためのご意見/ご提案がございましたら、弊社にご連絡ください。その場合は、製品 Red Hat Enterprise Linux 6 およびコンポーネント doc-Logical_Volume_Manager に対して、Bugzilla (http://bugzilla.redhat.com/) 内でご報告ください。バグ報告を提出される時には、以下のマニュアルの識別子を必ずご記入いただくようお願いします。
Logical_Volume_Manager_Administration(EN)-6 (2017-3-8-15:20)
Copy to Clipboard Toggle word wrap
If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, include the section number and some of the surrounding text so we can find it easily.

第2章 LVM 論理ボリュームマネージャ

この章では、Red Hat Enterprise Linux 6 の初期リリースならびにそれ以降のリリースに新たに組み込まれている LVM 論理ボリュームマネージャの機能についてまとめています。その後に、論理ボリュームマネージャ (LVM) のコンポーネントの概要を大まかに説明します。

2.1. 新機能および変更された機能

このセクションでは、Red Hat Enterprise Linux 6 の初期リリース以降に組み込まれている LVM 論理ボリュームマネージャの新機能および変更された機能について説明します。

2.1.1. Red Hat Enterprise Linux 6.0 で新規追加および変更された機能

Red Hat Enterprise Linux 6.0 では、ドキュメントと機能が以下のように更新/変更されています。
  • lvm.conf ファイルの activation セクション内の mirror_image_fault_policymirror_log_fault_policy のパラメーターを使用して、デバイスに障害が発生した場合にミラー化論理ボリュームがどのように動作するかを定義することができます。このパラメーターが remove に設定されている場合、システムは、障害の発生したデバイスを削除し、そのデバイスなしで稼働を試みます。このパラメーターが allocate に設定されている場合、システムは障害の発生したデバイスを削除し、そのデバイスの代わりとなる新たなデバイス上にスペースの割り当てを試みます。代わりとなる適切なデバイスとスペースを割り当てることができない場合、このポリシーは remove と同様に機能します。LVM のミラー障害ポリシーに関する情報は、「ミラー化論理ボリュームの障害ポリシー」 をご覧ください。
  • Red Hat Enterprise Linux 6 リリースでは、Linux I/O スタックが強化され、ベンダーの提供する I/O 制限情報を処理できるようになりました。これによって、LVM を含むストレージ管理ツールでデータの配置とアクセスを最適化することができます。このサポートは、lvm.conf ファイル内の data_alignment_detectiondata_alignment_offset_detection のデフォルト値を変更することによって無効にすることが可能ですが、このサポートの無効化は推奨されません。
    LVM 内のデータ配置に関する情報ならびに data_alignment_detectiondata_alignment_offset_detection のデフォルト値の変更に関する情報は、/etc/lvm/lvm.conf ファイルのインラインドキュメントをご覧ください。これは、付録B LVM 設定ファイル にも記載されています。Red Hat Enterprise Linux 6 における I/O スタックおよび I/O 制限のサポートに関する概説は、『ストレージ管理ガイド』 をご覧ください。
  • Red Hat Enterprise Linux 6 では、デバイスマッパーが udev 統合に対する直接のサポートを提供します。これによって、デバイスマッパーは、LVM デバイスを含むすべてのデバイスマッパーデバイスに関連したすべての udev 処理と同期化されます。udev デバイスマネージャに対するデバイスマッパーのサポートに関する情報は、「デバイスマッパーの udev デバイスマネージャサポート」 をご覧ください。
  • Red Hat Enterprise Linux 6 リリースでは、ディスク障害発生後に、lvconvert --repair コマンドを使用してミラーを修復することができます。これによって、ミラーが一貫性のある状態に戻ります。lvconvert --repair コマンドに関する情報は、 「ミラー化論理ボリュームの修復」 をご覧ください。
  • Red Hat Enterprise Linux 6 リリースでは、lvconvert コマンドの --merge オプションを使用してスナップショットを複製元のボリュームにマージすることができます。スナップショットのマージに関する情報は、「スナップショットボリュームのマージ」 をご覧ください。
  • Red Hat Enterprise Linux 6 リリースでは、lvconvert コマンドの --splitmirrors 引数を使用してミラー化論理ボリュームの冗長イメージを分割して新たな論理ボリュームを形成することができます。このオプションの使用に関する情報は、「ミラー化論理ボリュームの冗長イメージの分割」 をご覧ください。
  • ミラー化論理デバイスを作成する際に、lvcreate コマンドの --mirrorlog mirrored 引数を使用して、自動的にミラー化されるミラー化論理デバイスのミラーログを作成できるようになりました。このオプションの使用に関する情報は、「ミラー化ボリュームの作成」 をご覧ください。

2.1.2. Red Hat Enterprise Linux 6.1 で新規追加および変更された機能

Red Hat Enterprise Linux 6.1 では、ドキュメントと機能が以下のように更新/変更されています。
  • Red Hat Enterprise Linux 6.1 リリースは、ミラー化論理ボリュームのスナップショット論理ボリューム作成をサポートしています。リニアまたはストライプ化された論理ボリュームの作成と同様に、ミラー化ボリュームのスナップショットを作成することができます。スナップショットボリュームの作成方法については、 「スナップショットボリュームの作成」 をご覧ください。
  • LVM ボリュームを拡張する際には、lvextend コマンドの --alloc cling オプションを使用して、cling 割り当てポリシーを指定することができます。このポリシーによって、同一の物理ボリューム上のスペースが、既存の論理ボリュームの最終セグメントとして選択されます。物理ボリューム上に十分なスペースがなく、タグの一覧が lvm.conf ファイル内で定義されている場合には、LVM は、その物理ボリュームにいずれかのタグが付けられているかを確認し、既存エクステントと新規エクステント間で、物理ボリュームのタグを適合させようとします。
    lvextend コマンドで --alloc cling オプションを使用した LVM ミラー化ボリュームの拡張については、cling 割り当てポリシーを使用した論理ボリュームの拡張」 をご覧ください。
  • pvchangevgchange、または lvchange の単一のコマンドで、--addtag および --deltag の引数を複数指定することができるようになりました。オブジェクトタグの追加と削除については、「オブジェクトタグの追加と削除」 をご覧ください。
  • LVM オブジェクトタグで使用可能な文字の一覧が拡大され、タグには "/"、"="、"!"、":"、"#"、および "&" の文字が使用できるようになりました。LVM オブジェクトタグについては、付録D LVM オブジェクトタグ をご覧ください。
  • 単一の論理ボリューム内で RAID0 (ストライピング) と RAID1 (ミラーリング) の併用ができるようになりました。論理ボリュームの作成と同時にミラーの数 (--mirrors X) とストライプの数 (--stripes Y) を指定すると、ミラーデバイスの構成デバイスがストライプ化されます。ミラー化論理ボリュームの作成については、「ミラー化ボリュームの作成」 をご覧ください。
  • Red Hat Enterprise Linux 6.1 リリースでは、クラスター化されたボリューム上で恒常的なデータバックアップ作成が必要な場合、ボリュームを排他的にアクティブ化した上で、スナップショットを作成することができます。ノード上における論理ボリュームの排他的なアクティブ化についての情報については、「クラスター内の個別ノード上の論理ボリュームのアクティブ化」 をご覧ください。

2.1.3. Red Hat Enterprise Linux 6.2 で新規追加および変更された機能

Red Hat Enterprise Linux 6.2 では、ドキュメントと機能が以下のように更新/変更されています。
  • The Red Hat Enterprise Linux 6.2 release supports the issue_discards parameter in the lvm.conf configuration file. When this parameter is set, LVM will issue discards to a logical volume's underlying physical volumes when the logical volume is no longer using the space on the physical volumes. For information on this parameter, see the inline documentation for the /etc/lvm/lvm.conf file, which is also documented in 付録B LVM 設定ファイル.

2.1.4. Red Hat Enterprise Linux 6.3 で新規追加および変更された機能

Red Hat Enterprise Linux 6.3 では、ドキュメントと機能が以下のように更新/変更されています。

2.1.5. Red Hat Enterprise Linux 6.4 で新規追加および変更された機能

Red Hat Enterprise Linux 6.4 では、ドキュメントと機能が以下のように更新/変更されています。
  • 論理ボリュームのシンプロビジョニングが可能になりました。これにより、利用可能なエクステントより大きい論理ボリュームを作成できます。シンプロビジョニングを使用すると、空き領域のストレージプール (シンプールと呼ばれる) を管理して、アプリケーションにより必要な場合に任意の数のデバイスに割り当てることができます。その後、アプリケーションを実際に論理ボリュームに書き込むときに、シンプールにバインド可能なデバイスを後ほどの割り当て用に作成できます。シンプールは、コスト効率が高いストレージ領域の割り当てに必要な場合に動的に拡張できます。
    For general information on thinly-provisioned logical volumes, see 「シンプロビジョニングされた論理ボリューム (シンボリューム)」. For information on creating thin volumes, see 「シンプロビジョニングされた論理ボリュームの作成」.
  • Red Hat Enterprise Linux 6.4 バージョンの LVM は、シンプロビジョニングされたスナップショットボリュームのサポートを提供します。シンプロビジョニングされたスナップショットボリュームにより、多くの仮想デバイスを同じデータボリューム上に格納することができます。これにより管理が簡略化され、スナップショットボリューム間でのデータシェアが可能になります。
    For general information on thinly-provisioned snapshot volumes, see 「シンプロビジョニングされたスナップショットボリューム」. For information on creating thin snapshot volumes, see 「シンプロビジョニングされたスナップショットボリュームの作成」.
  • 本ガイドには、LVM の割り当てポリシーについて説明した 「LVM の割り当て」 のセクションが新たに追加されました。
  • LVM now provides support for raid10 logical volumes. For information on RAID logical volumes, see 「RAID 論理ボリューム」.
  • Red Hat Enterprise Linux 6.4 リリースは、LVM メタデータデーモンである lvmetad をサポートしています。このデーモンを有効にすることで、多くのブロックデバイスを持つシステムのスキャン量を減らすことができます。lvmetad デーモンは、クラスターのノード間では現在サポートされておらず、ロックタイプはローカルのファイルベースである必要があります。
    For information on the metadata daemon, see 「メタデータデーモン (lvmetad)」.
さらに、ドキュメント全体にわたり技術的な内容の若干の修正と明確化を行いました。

2.1.6. New and Changed Features for Red Hat Enterprise Linux 6.5

Red Hat Enterprise Linux 6.5 includes the following documentation and feature updates and changes.
さらに、ドキュメント全体にわたり技術的な内容の若干の修正と明確化を行いました。

2.1.7. New and Changed Features for Red Hat Enterprise Linux 6.6

Red Hat Enterprise Linux 6.6 includes the following documentation and feature updates and changes.
さらに、ドキュメント全体にわたり技術的な内容の若干の修正と明確化を行いました。

2.1.8. New and Changed Features for Red Hat Enterprise Linux 6.7

Red Hat Enterprise Linux 6.7 includes the following documentation and feature updates and changes.

2.1.9. New and Changed Features for Red Hat Enterprise Linux 6.8

Red Hat Enterprise Linux 6.8 includes the following documentation and feature updates and changes.
  • When defining selection criteria for LVM commands, you can now specify time values as selection criteria for fields with a field type of time. For information on specifying time values as selection criteria, see 「Specifying Time Values」.

2.2. 論理ボリューム

ボリューム管理によって、物理ストレージ上に抽象化レイヤが作成され、論理ストレージボリュームを作成できるようになります。これは、物理ストレージディレクトリを使用するよりもはるかに高い柔軟性を数々の方法で提供します。論理ボリュームが作成されると、物理ディスクのサイズに制限されません。また、ハードウェアストレージ設定は、ソフトウェアには表示されないので、アプリケーションを停止したりファイルシステムをアンマウントせずに、サイズ変更や移動が可能になります。これにより運用コストを削減することができます。
論理ボリュームは、物理ストレージを直接使用するのと比べると、以下のような利点があります:
  • 容量の柔軟性
    論理ボリュームを使用している場合、ディスクとパーティションを1つの論理ボリュームに集約できるため、ファイルシステムを複数のディスクに渡って拡張することが可能です。
  • サイズ変更可能なストレージプール
    基になるディスクデバイスを再フォーマットしたり再パーティションせずに、簡単なソフトウェアコマンドを使用して論理ボリュームのサイズを拡大したり縮小したりすることができます。
  • オンラインデータ移動
    より新しく、迅速で、障害耐性の高いストレージサブシステムを導入するために、システムがアクティブな時でもデータを移動することができます。データはディスクが使用中の場合でもディスク上で再配置できます。例えば、ホットスワップ可能なディスクを削除する前に空にすることができます。
  • 便宜的なデバイスの命名
    論理ストレージボリュームはユーザー定義のグループで管理することができ、便宜的な命名をすることが可能です。
  • ディスクのストライプ化
    2つまたはそれ以上のディスクに渡ってデータをストライプ化する論理ボリュームを作成することができます。これにより、スループットが劇的に向上します。
  • ボリュームのミラー化
    論理ボリュームはデータのミラー化の設定に便利な手法を提供します。
  • ボリュームスナップショット
    論理ボリュームを使用すると、一貫性のあるバックアップのためのデバイススナップショットを取ったり、実際のデータに影響を及ぼすことなく変更の効果をテストすることができます。
LVM でのこれらの機能の実装については、本ガイドの後半で説明しています。

2.3. LVM アーキテクチャーの概要

Linux オペレーティングシステムの Red Hat Enterprise Linux 4 リリースでは、オリジナルの LVM1 論理ボリュームマネージャが LVM2 に置き換えられました。LVM2 は、LVM1 よりも汎用性の高いカーネルフレームワークを採用しています。また、LVM2 は、LVM1 と比べて、以下のような点が改善されています:
  • 容量の柔軟性
  • より効率的なメタデータストレージ
  • より優れた復元の形式
  • 新たな ASCII メタデータ形式
  • メタデータのアトミックな変更
  • メタデータの冗長コピー
LVM2 は LVM1 に対して下位互換性を持っています。ただし、スナップショットとクラスターサポートは例外となっています。ボリュームグループは、vgconvert コマンドを使用して LVM1 形式から LVM2 形式に変換することができます。LVM メタデータ形式の変換に関する情報は、vgconvert(8) の man ページをご覧ください。
LVM 論理ボリュームの配下の物理ストレージユニットは、パーティションあるいはディスク全体などのブロックデバイスです。このデバイスは LVM 物理ボリューム (Physical Volume: PV) として初期化されます。
LVM 論理ボリュームを作成するために、物理ボリュームは ボリュームグループ (Volume Group: VG) に統合されます。これによってディスク領域のプールが作成され、そこから LVM 論理ボリューム (Logical Volume: LV) が割り当てられます。この工程は、ディスクがパーティションに分割される方法に類似しています。論理ボリュームはファイルシステムやアプリケーション (データベースなど) に使用されます。
図2.1「LVM 論理ボリュームのコンポーネント」 簡易 LVM 論理ボリュームのコンポーネントを示しています:

図2.1 LVM 論理ボリュームのコンポーネント

LVM 論理ボリュームのコンポーネントに関する詳細情報については、3章LVM コンポーネント をご覧ください。

2.4. クラスター化論理ボリュームマネージャ (CLVM)

Clustered Logical Volume Manager (CLVM) は LVM のクラスタリング拡張機能セットです。これらの拡張機能により、コンピューターのクラスターは、LVM を使用した共有ストレージ (例: SAN 上のストレージ) を管理できるようになります。CLVM は、Resilient Storage アドオンの一部です。
CLVM を使用すべきかどうかはシステム要件により左右されます:
  • ご使用のシステムのノードの1つのみが、論理ボリュームとして設定するストレージへのアクセスを必要とする場合は、CLVM 拡張機能を使用せずに LVM が使用可能であり、そのノードで作成される論理ボリュームは、そのノードに対してすべてローカルとなります。
  • フェイルオーバーにクラスター化したシステムを使用しており、ストレージにアクセスする単一のノードのみが常にアクティブである場合は、High Availability Logical Volume Management (HA-LVM) エージェントの使用をお勧めします。
  • ご使用のクラスターの複数のノードが共有ストレージへのアクセスを必要とし、そのストレージがアクティブなノード間で共有される場合は、CLVM を使用する必要があります。CLVM の使用により、ユーザーは論理ボリュームの設定中に物理ストレージへのアクセスをロックすることによって、共有ストレージ上の論理ボリュームを設定することができるようになります。CLVM は、クラスター化ロッキングサービスを使用して共有ストレージを管理します。
CLVM を使用するには、clvmd デーモンを含む High Availability アドオンおよび Resilient Storage アドオンのソフトウェアが稼働していなければなりません。clvmd デーモンは LVM の主要なクラスタリング拡張機能です。clvmd デーモンは、各クラスターコンピューター内で稼働し、クラスター内で LVM メタデータ更新を配布して、各クラスターコンピューターに論理ボリュームの同一ビューを提供します。High Availability アドオンのインストールと管理の詳細については、『クラスターの管理』 を参照してください。
clmvd が起動時に確実に開始するようにするためには、以下のようにして、chkconfig ... on コマンドをclvmd サービスに対して実行します:
# chkconfig clvmd on
Copy to Clipboard Toggle word wrap
clvmd デーモンが開始していない場合は、以下のようにして、clvmd サービスを service ... start コマンドで実行します。
# service clvmd start
Copy to Clipboard Toggle word wrap
クラスター環境で LVM 論理ボリュームを作成することは、単一ノード上に LVM 論理ボリュームを作成することと同じです。5章CLI コマンドでの LVM 管理8章LVM GUI での LVM 管理 で示してあるように、LVM コマンド自体や LVM グラフィカルユーザーインターフェースに相違はありません。クラスター内に作成する LVM ボリュームを有効にするためには、クラスターインフラストラクチャーが稼働中で、かつクラスターが定足数を満たしている必要があります。
デフォルトでは、共有ストレージ上に CLVM で作成された論理ボリュームは、その共有ストレージにアクセス可能なすべてのシステムに対して可視となっています。ただし、全ストレージデバイスがクラスター内の 1 つのノードのみに可視となるようにボリュームグループを作成することも可能です。また、ボリュームグループのステータスをローカルボリュームグループからクラスター化ボリュームグループへ変更することもできます。詳細については、「クラスター内でのボリュームグループ作成」 および 「ボリュームグループのパラメーター変更」 をご覧ください。

警告

CLVM を使用して共有ストレージ上にボリュームグループを作成する際には、クラスター内のすべてのノードがボリュームグループを構成する物理ボリュームに確実にアクセスできるようにする必要があります。ストレージにアクセスできるノードとできないノードが混在する、非対称型のクラスター構成はサポートされていません。
図2.2「CLVM の概観」 は、クラスター内の CLVM の概観を示しています。

図2.2 CLVM の概観

注記

CLVM で、クラスター全体をロッキングするには、lvm.conf ファイルを変更する必要があります。クラスター化ロッキングをサポートするための lvm.conf ファイルの設定に関する情報は、lvm.conf ファイル自体に記載されています。lvm.conf ファイルについての情報は 付録B LVM 設定ファイル をご覧ください。

2.5. ドキュメントの概要

本ガイドの後半には、以下のような章が含まれています:

第3章 LVM コンポーネント

この章では、LVM 論理ボリュームのコンポーネントについて説明します。

3.1. 物理ボリューム

LVM 論理ボリュームの配下にある物理ストレージユニットは、パーティションやディスク全体のようなブロックデバイスです。LVM 論理ボリューム用にデバイスを使用するには、デバイスは物理ボリューム (PV) として初期化されなければなりません。ブロックデバイスを物理ボリュームとして初期化すると、デバイスの先頭位置にラベルを付けられます。
デフォルトでは、LVM ラベルは2番目の 512 バイトセクターに配置されます。先頭の4つのセクターのいずれかにラベルを配置することにより、このデフォルトを書き換えることができます。これにより、LVM ボリュームは、必要であればこれらのセクターの他のユーザーと共存できるようになります。
システム起動時にデバイスは任意の順序で立ち上がることがあります。そのため、LVM ラベルでは、物理デバイスに正しい ID とデバイスの順序を提供します。LVM ラベルは再起動後にもクラスター全域に渡って永続的な状態が維持されます。
LVM ラベルは、デバイスを LVM 物理ボリュームとして識別するものです。これは、物理ボリューム用のランダムな一意識別子 (UUID) を含んでいます。また、ブロックデバイスのサイズもバイト単位で保存し、LVM メタデータがデバイス上で保存される位置も記録します。
LVM メタデータには、システム上の LVM ボリュームグループの設定詳細が含まれています。デフォルトでは、メタデータの複製コピーが、ボリュームグループ内ですべての物理ボリュームのすべてのメタデータエリアで維持されています。LVM メタデータは小規模で ASCII 形式で格納されます。
現在、LVM により、各物理ボリューム上のメタデータの1つまたは2つの同一コピーの保存が可能になっています。デフォルトでは、コピーは1つです。物理ボリューム上のメタデータのコピー数を一旦設定すると、後でその数を変更することはできません。最初のコピーはデバイスの先頭のラベルの後に保存されます。2つ目のコピーがある場合は、それはデバイスの最終位置に配置されます。意図したものとは異なるディスクに書き込みをして、ディスクの先頭位置に誤って上書きしてしまった場合でも、デバイス後部にあるメタデータの2つ目のコピーでメタデータの復元が可能となります。
LVM メタデータとメタデータパラメーターの変更に関する詳細については、付録E LVM ボリュームグループメタデータ をご覧ください。

3.1.1. LVM 物理ボリュームレイアウト

図3.1「物理ボリュームレイアウト」 LVM 物理ボリュームのレイアウトを示しています。LVM ラベルは2番目のセクターにあり、その後にメタデータ領域とデバイスの使用可能なスペースが順に続いています。

注記

Linux カーネル (および本ガイド全体) では、セクターは 512 バイトのサイズとされています。

図3.1 物理ボリュームレイアウト

3.1.2. ディスク上の複数パーティション

LVM の使用により、ディスクパーティションから物理ボリュームを作成することが可能になります。それを以下のような理由により、ディスク全体をカバーする1つのパーティションを作成して、単一の LVM 物理ボリュームとしてラベルを付けることが一般的に推奨されます:
  • 管理上の便宜
    それぞれの実ディスクが1度だけ提示されると、システム内のハードウェアを追跡記録するのが簡単になります。これはディスクに障害が発生した場合に、特に役に立ちます。更には、単一のディスク上の複数物理ボリュームは、起動時にカーネルによって不明なパーティションとして警告を受ける原因となる可能性があります。
  • ストライピングのパフォーマンス
    LVM は、2 つの物理ボリュームが同一の物理ディスクにあることは認識しません。2 つの物理ボリュームが同一の物理ディスク上にある場合にストライプ化された論理ボリュームを作成すると、ストライプ化されたボリュームは同じディスク上の異なるパーティション上にある可能性があります。これはパフォーマンスの向上ではなく、低下をもたらします。
推奨されることではありませんが、1 つのディスクを別々の LVM 物理ボリュームに分割しなければならない状況が考えられます。例えば、少数のディスクしかないシステム上では、既存システムを LVM ボリュームに移行する場合にデータをパーティション間で移動しなければならない場合があります。さらに、大容量のディスクが存在し、管理目的で複数のボリュームグループを必要とする場合は、そのディスクでパーティションを設定する必要があります。ディスクに複数のパーティションがあり、それらのパーティションがいずれも同じボリュームグループ内に存在する場合にストライプ化ボリュームを作成する時には、論理ボリュームに含めるパーティションの指定は注意して行ってください。

3.2. ボリュームグループ

物理ボリュームはボリュームグループ (VG) に統合されます。これにより、論理ボリュームに割り当てるためのディスク領域のプールが作成されます。
ボリュームグループ内で、割り当て可能なディスク領域はエクステントと呼ばれる固定サイズの単位に分割されます。1 エクステントが割り当て可能な領域の最小単位となります。物理ボリューム内では、エクステントは物理エクステントと呼ばれます。
論理ボリュームは物理エスクテントと同サイズの論理エクステント割り当てることができます。そのため、エクステントは、ボリュームグループ内のすべての論理ボリュームで同じサイズになります。ボリュームグループは論理エクステントを物理エクステントにマッピングします。

3.3. LVM 論理ボリューム

LVM では、ボリュームグループは複数のボリュームに分割されます。LVM 論理ボリュームには 3つのタイプがあります。リニア (linear) ボリューム、 ストライプ化 (striped) ボリューム、および ミラー化 (mirrored) ボリュームです。これらについては、以下のセクションで説明します。

3.3.1. リニアボリューム

リニアボリュームは複数の物理ボリュームの領域を 1 つの論理ボリュームに統合します。例えば、60GB ディスクが 2 つある場合、120GB の論理ボリュームを作成できます。物理ストレージは連結されます。
リニアボリュームを作成すると、物理エクステントの範囲を順番に論理ボリュームの領域に割り当てることになります。例えば、図3.2「エクステントマッピング」 に示してあるように、1から 99 までの論理エクステントを1つの物理ボリュームにマッピングして、 100 から 198 までの論理エクステントを2番目の物理ボリュームにマッピングすることができます。アプリケーションの観点からは、デバイスには 198 のエクステントのサイズのデバイスが1つあることになります。

図3.2 エクステントマッピング

The physical volumes that make up a logical volume do not have to be the same size. 図3.3「サイズの異なる物理ボリュームを用いたリニアボリューム」 shows volume group VG1 with a physical extent size of 4MB. This volume group includes 2 physical volumes named PV1 and PV2. The physical volumes are divided into 4MB units, since that is the extent size. In this example, PV1 is 200 extents in size (800MB) and PV2 is 100 extents in size (400MB). You can create a linear volume any size between 1 and 300 extents (4MB to 1200MB). In this example, the linear volume named LV1 is 300 extents in size.

図3.3 サイズの異なる物理ボリュームを用いたリニアボリューム

物理エクステントのプールから希望のサイズのリニア論理ボリュームを複数設定することができます。図3.4「複数の論理ボリューム」 は、図3.3「サイズの異なる物理ボリュームを用いたリニアボリューム」 と同じボリュームグループを示していますが、この場合は、そのボリュームグループから 2 つの論理ボリュームが作り出されています。LV1 は 250 エクステントでサイズは 1000MB です。LV2 は 50 エクステントでサイズは 200MB です。

図3.4 複数の論理ボリューム

3.3.2. ストライプ化論理ボリューム

LVM 論理ボリューム上にデータを書き込む場合、ファイルシステムは、配下にある物理ボリュームすべてに渡ってデータを分配します。その場合、ストライプ化論理ボリュームを作成することにより、データを物理ボリュームに書き込む方法を制御することができます。大量の順次読み取りと書き込みには、この方法でデータ I/O の効率を向上させることが可能です。
ストライピングは、所定数の物理ボリュームにデータをラウンドロビン式に書き込んでいくことにより、パフォーマンスを向上させます。ストライピングでは、I/O は並行して実行されます。場合によっては、これはストライプ内に追加する各物理ボリュームに、ほぼ直線的なパフォーマンス向上をもたらします。
以下のイラストでは、3つの物理ボリュームに渡ってデータがストライプ化されている状態を示しています。この図では:
  • データの1番目のストライプは PV1 に書き込まれます。
  • データの2番目のストライプは PV2 に書き込まれます。
  • データの3番目のストライプは PV3 に書き込まれます。
  • データの4番目のストライプは PV1 に書き込まれます。
ストライプ化された論理ボリュームでは、ストライプのサイズはエクステントのサイズを超過することはできません。

図3.5 3つの PV に渡るストライプのデータ

Striped logical volumes can be extended by concatenating another set of devices onto the end of the first set. In order to extend a striped logical volume, however, there must be enough free space on the underlying physical volumes that make up the volume group to support the stripe. For example, if you have a two-way stripe that uses up an entire volume group, adding a single physical volume to the volume group will not enable you to extend the stripe. Instead, you must add at least two physical volumes to the volume group. For more information on extending a striped volume, see 「ストライプ化ボリュームの拡張」.

3.3.3. ミラー化論理ボリューム

ミラーはデータの同一コピーを異なるデバイスに維持します。データが1つのデバイスに書き込まれると、それはまた2つ目のデバイスにも書き込まれて、データのミラー化をします。この重複保存により、デバイス障害に対する保護を提供します。ミラーレッグの1つに障害が発生した場合、論理ボリュームはリニアボリュームとなりますが、依然としてアクセス可能です。
LVM はミラー化ボリュームに対応しています。ミラー化論理ボリュームを作成する場合、LVM は、配下にある物理ボリュームに書き込まれるデータが、別の物理ボリュームに確実にミラー化されるようにします。LVM では、複数のミラーを持つミラー化論理ボリュームを作成することができます。
LVM ミラーは複製されるデバイスを、標準的な 512KB サイズのリージョンに分割します。LVM はミラーと同期しているリージョンを追跡記録するのに使用する小さなログを維持します。このログは、再起動後にも永続的に残るようにディスク上に保存したり、メモリー内で維持したりすることができます。
図3.6「ミラー化論理ボリューム」 は、単一のミラーを用いたミラー化論理ボリュームを示しています。この設定では、ログはディスク上で維持されます。

図3.6 ミラー化論理ボリューム

ミラーの作成と修正に関する情報は、 「ミラー化ボリュームの作成」 をご覧ください。

3.3.4. RAID Logical Volumes

As of the Red Hat Enterprise Linux 6.3 release, LVM supports RAID logical volumes. For information on the RAID implementations that LVM supports, see 「RAID 論理ボリューム」.

3.3.5. シンプロビジョニングされた論理ボリューム (シンボリューム)

As of the Red Hat Enterprise Linux 6.4 release, logical volumes can be thinly provisioned. This allows you to create logical volumes that are larger than the available extents. Using thin provisioning, you can manage a storage pool of free space, known as a thin pool, which can be allocated to an arbitrary number of devices when needed by applications. You can then create devices that can be bound to the thin pool for later allocation when an application actually writes to the logical volume. The thin pool can be expanded dynamically when needed for cost-effective allocation of storage space.

注記

シンボリュームはクラスターのノード間ではサポートされません。シンプールとそのすべてのシンボリュームは、1 つのクラスターノードでのみ排他的にアクティブ化する必要があります。
ストレージ管理者は、シンプロビジョニングを使用することで物理ストレージをオーバーコミットできるため、多くの場合、追加のストレージを購入する必要がなくなります。例えば、10 人のユーザーが各アプリケーション用にそれぞれ 100GB ファイルシステムを要求した場合、ストレージ管理者は各ユーザーに 100GB ファイルシステムと思われるもの (しかし実際は 100GB より少ないストレージにより利用可能で必要な場合にのみ使用される) を作成できます。シンプロビジョニングの使用時には、ストレージ管理者は、ストレージプールをモニターして、容量が一杯になり始めたら容量を追加することが重要です。
すべての利用可能な領域が使用できるようにするために、LVM ではデータの破棄が可能です。これにより、破棄されたファイルやその他のブロックの範囲で以前に使用された領域を再利用できます。
Thin volumes provide support for a new implementation of copy-on-write (COW) snapshot logical volumes, which allow many virtual devices to share the same data in the thin pool. For information on thin snapshot volumes, see 「シンプロビジョニングされたスナップショットボリューム」.

3.3.6. スナップショットボリューム

LVM スナップショット機能により、サービスを中断せずに任意の時点でデバイスの仮想イメージを作成することができます。スナップショットの取得後に複製元のデバイスに変更が加えられた場合、このスナップショット機能により、データが変更される前に変更部分のコピーを作成してデバイスの状態を再構築できます。

注記

As of the Red Hat Enterprise Linux 6.4 release, LVM supports thinly-provisioned snapshots. For information on thinly provisioned snapshot volumes, see 「シンプロビジョニングされたスナップショットボリューム」.

注記

LVM スナップショットは、クラスター内のノード全域に渡ってはサポートされていません。クラスター化されたボリュームグループ内ではスナップショットボリュームを作成できません。
スナップショットは、スナップショットが作成された後に変更されたデータ部分のみをコピーするため、スナップショット機能に必要なストレージの容量は最小限で済みます。例えば、複製元が稀にしか更新されない場合、その容量の 3-5 % だけで十分にスナップショットを維持することができます。

注記

ファイルシステムのスナップショットコピーは仮想コピーであり、ファイルシステム用の実際のメディアバックアップではありません。スナップショットはバックアップ手順の代替を提供するものではありません。
スナップショットのサイズによって、複製元のボリュームへの変更を保管するために確保するスペースの量が左右されます。例えば、スナップショットを作成後に複製元を完全に上書きした場合に、その変更を保管するには、スナップショットが最低でも複製元のボリュームと同じサイズである必要があることになります。スナップショットのサイズは、予想される変更レベルに応じて決定する必要があります。例えば、/usr などの、ほとんど読み取り用に使用されるボリュームの短期的なスナップショットには、/home のように大量の書き込みが行われるボリュームの長期的なスナップショットほどスペースを必要としません。
スナップショットが満杯になると、スナップショットは無効になります。これは、複製元のボリューム上の変更をトラッキングできなくなるためです。スナップショットのサイズは常時監視する必要があります。ただし、スナップショットは完全にサイズ変更可能のため、ストレージに余裕があれば、スナップショットのボリュームサイズを拡大してそれが停止することを防止できます。逆に、スナップショットボリュームサイズが必要以上に大きければ、そのボリュームのサイズを縮小して、他の論理ボリューム用に必要となる領域を開放することができます。
スナップショットファイルシステムを作成すると、複製元への完全な読み取り/書き込みのアクセスがそのまま残ります。スナップショット上のチャンクが変更された場合、そのチャンクはマーク付けされ、そこには複製元のボリュームのコピーは入りません。
スナップショット機能にはいくつかの用途があります:
  • 最も一般的な用途は、継続的にデータを更新している稼動中のシステムを停止せずに、論理ボリューム上でバックアップを実行する必要がある場合のスナップショット作成です。
  • スナップショットファイルシステム上で fsck コマンドを実行すると、ファイルシステムの整合性をチェックして、複製元のファイルシステムが修復を必要とするかどうかを判断することができます。
  • スナップショットは読み取り/書き込み用のため、スナップショットを取ってそのスナップショットに対してテストを実行することにより、実際のデータに触れることなく実稼働データに対するアプリケーションのテストができます。
  • LVM ボリュームを作成して、Red Hat の仮想化と併用することが可能です。LVM スナップショットを使用して、仮想ゲストイメージのスナップショットを作成することができます。これらのスナップショットは、最小限のストレージを使用して、既存のゲストの変更や新規ゲストの作成を行う利便性の高い方法を提供します。Red Hat の仮想化による LVM ベースのストレージプールの作成についての詳細は、『仮想化管理ガイド』 を参照してください。
スナップショットボリュームの作成に関する情報は、「ミラー化ボリュームの作成」 をご覧ください。
Red Hat Enterprise Linux 6 リリースでは、lvconvert--merge オプションを使用して、スナップショットを複製元のボリュームにマージすることが可能です。この機能の用途の1つとしてあげられるのは、データやファイルを紛失した際のシステムロールバックの実行で、これがなければ、以前の状態に復元する必要があります。スナップショットボリュームのマージの結果作成される論理ボリュームには複製元のボリューム名、マイナー番号、UUID が使用され、マージされたスナップショットは削除されます。このオプションの使用方法についての情報は、 「スナップショットボリュームのマージ」 をご覧ください。

3.3.7. シンプロビジョニングされたスナップショットボリューム

Red Hat Enterprise Linux 6.4 バージョンの LVM は、シンプロビジョニングされたスナップショットボリュームのサポートを提供します。シンプロビジョニングされたスナップショットボリュームにより、多くの仮想デバイスを同じデータボリューム上に格納することができます。これにより管理が簡略化され、スナップショットボリューム間でのデータシェアが可能になります。
すべてのシンボリュームだけでなくすべての LVM スナップショットボリュームの場合、シンプロビジョニングされたスナップショットボリュームはクラスター内のノード間でサポートされていません。スナップショットボリュームは、1 つのクラスターノードでのみ排他的にアクティブ化する必要があります。
シンプロビジョニングされたスナップショットボリュームの利点は以下のとおりです。
  • 同じボリュームからのスナップショットが複数ある場合、シンプロビジョニングされたスナップショットボリュームはディスクの使用量を減らすことができます。
  • 複製元が同じスナップショットが複数ある場合は、複製元に 1 回書き込むことにより 1 回の COW 操作でデータを保存できます。複製元のスナップショットの数を増やしても、大幅な速度の低下は発生しないはずです。
  • シンプロビジョニングされたスナップショットボリュームは、別のスナップショットの作成元の論理ボリュームとして使用できます。これにより、再帰的スナップショット (スナップショットのスナップショットのそのまたスナップショットなど) の深度を任意に決定できます。
  • シン論理ボリュームのスナップショットは、シン論理ボリュームを作成することもできます。これにより、COW 操作が必要になるまで、あるいはスナップショット自体が書き込まれるまで、データ領域は消費されません。
  • シンプロビジョニングされたスナップショットボリュームは、その複製元によりアクティブ化する必要はありません。そのため、アクティブでないスナップショットボリュームが多くある間は、ユーザーは複製元のみをアクティブにしておくことができます。
  • シンプロビジョニングされたスナップショットボリュームの複製元を削除する場合、複製元のボリュームの各スナップショットは、独立するシンプロビジョニングされたボリュームになります。これは、あるスナップショットとその複製元のボリュームをマージする代わりに、複製元のボリュームを削除して、その独立したボリュームを新しいスナップショットの複製元のボリュームとして使用して新しいシンプロビジョニングされたスナップショットを作成することが選択できることを意味しています。
シンプロビジョニングされたスナップショットボリュームを使用する利点は数多くありますが、旧の LVM スナップショットボリューム機能の方がご使用のニーズに合うケースがあります。
  • シンプールのチャンクサイズは変更できません。シンプールのチャンクサイズが大きい場合 (1MB など) やチャンクサイズが短時間のスナップショットには効率的でない場合は、旧のスナップショット機能の使用を選択することができます。
  • シンプロビジョニングされたスナップショットボリュームのサイズを制限することはできません。スナップショットは、必要な場合はシンプール内の全領域を使用するため、ご使用のニーズに合わない場合があります。
一般的には、使用するスナップショットの形式を決定する際に使用しているサイトの特定の要件を考慮に入れるようにしてください。

3.3.8. Cache Volumes

As of the Red Hat Enterprise Linux 6.7 release, LVM supports the use of fast block devices (such as SSD drives) as write-back or write-though caches for larger slower block devices. Users can create cache logical volumes to improve the performance of their existing logical volumes or create new cache logical volumes composed of a small and fast device coupled with a large and slow device.
For information on creating LVM cache volumes, see 「Creating LVM Cache Logical Volumes」.

第4章 LVM 管理の概要

この章では、LVM 論理ボリュームの設定に用いる管理手続きの概要を説明し、必要な手順についての全般的な理解を図ることを目的としています。一般的な LVM 設定手順における特定の段階的な例については、6章LVM 設定の例 をご覧ください。
LVM 管理を執行するために使用できる CLI コマンドの説明については、5章CLI コマンドでの LVM 管理 を ご覧ください。別の方法として、8章LVM GUI での LVM 管理 で説明している LVM GUI を使用することもできます。

4.1. クラスター内での LVM ボリューム作成

クラスター環境内で論理ボリュームを作成するには、CLVM (Clustered Logical Volume Manager) を使用します。これは LVM へのクラスタリング拡張のセットです。この拡張により、コンピューターのクラスターが LVM を使用して共有ストレージ (例えば SAN 上など) を管理できるようになります。CLVM を使用するには、「クラスター化論理ボリュームマネージャ (CLVM)」 で示してあるように clmvd デーモンを含む High Availability アドオンおよび Resilient Storage アオドンソフトウェアが、起動時に開始する必要があります。
クラスター環境で LVM 論理ボリュームを作成することは、単一ノード上に LVM 論理ボリュームを作成することと同じです。LVM コマンド自体や LVM GUI インターフェースに相違はありません。クラスター内に作成する LVM ボリュームを有効にするためには、クラスターインフラストラクチャーが稼働中で、かつクラスターが定足数を満たしている必要があります。
CLVM で、クラスター全体をロッキングするには、lvm.conf ファイルを変更する必要があります。クラスター化ロッキングをサポートするための lvm.conf ファイルの設定に関する情報は、lvm.conf ファイル自体に記載されています。lvm.conf ファイルについての情報は 付録B LVM 設定ファイル をご覧ください。
デフォルトでは、共有ストレージ上に CLVM で作成された論理ボリュームは、その共有ストレージにアクセス可能なすべてのシステムに対して可視となっています。ただし、全ストレージデバイスがクラスター内の 1 つのノードのみに可視となるようにボリュームグループを作成することも可能です。また、ボリュームグループのステータスをローカルボリュームグループからクラスター化ボリュームグループへ変更することもできます。詳細については、「クラスター内でのボリュームグループ作成」 および 「ボリュームグループのパラメーター変更」 をご覧ください。

警告

CLVM を使用して共有ストレージ上にボリュームグループを作成する際には、クラスター内のすべてのノードがボリュームグループを構成する物理ボリュームに確実にアクセスできるようにする必要があります。ストレージにアクセスできるノードとできないノードが混在する、非対称型のクラスター構成はサポートされていません。
High Availability アドオンのインストールとクラスターインフラストラクチャーのセットアップ方法についての情報は、『クラスターの管理』 をご覧ください。
クラスター内でミラー化された論理ボリュームを作成する例は、「クラスター内でのミラー化 LVM 論理ボリュームの作成」 をご覧ください。

4.2. 論理ボリューム作成の概要

LVM 論理ボリュームを作成するために実行すべき手順を簡単にまとめると以下のようになります。
  1. LVM ボリューム用に使用するパーティションを物理ボリュームとして初期化します (この操作によってラベル付けされます)。
  2. ボリュームグループを作成します。
  3. 論理ボリュームを作成します。
論理ボリュームを作成した後は、ファイルシステムを作成してマウントできます。この文書内の例では、GFS2 ファイルシステムを使用します。

注記

GFS2 ファイルシステムはスタンドアロンシステムもしくはクラスター構成の一部として実装することが可能ですが、Red Hat Enterprise Linux 6 リリースでは、Red Hat は単一ノードのファイルシステムとしての GFS2 の使用をサポートしていません。クラスターファイルシステムのスナップショット (例: バックアップ目的) をマウントするための単一ノードの GFS2 ファイルシステムは引き続きサポートします。
  1. mkfs.gfs2 コマンドを使用して、論理ボリューム上に GFS2 ファイルシステムを作成します。
  2. mkdir コマンドで新規のマウントポイントを作成します。クラスター化システムでは、そのクラスター内のすべてのノード上にマウントポイントを作成します。
  3. ファイルシステムをマウントします。システム内の各ノード用の fstab に一行追加することもできます。
別の方法として、LVM GUI を使用して GFS2 ファイルシステムを作成してマウントすることもできます。
LVM セットアップ情報の保存エリアは物理ボリューム上にあって、ボリュームが作成されたマシンではないため、LVM ボリュームの作成はマシンから独立しています。ストレージを使用するサーバーがローカルコピーを持っていますが、それは物理ボリューム上にあるものから復元できます。LVM のバージョンが互換性を持つ場合には、物理ボリュームを異なるサーバーに接続することができます。

4.3. 論理ボリューム上におけるファイルシステムの拡張

論理ボリューム上でファイルシステムを拡張するには、以下の手順を実行します:
  1. 新規の物理ボリュームを作成します。
  2. 拡張するファイルシステムを持つ論理ボリュームを含んだボリュームグループを拡張して、新規の物理ボリュームを組み入れます。
  3. 論理ボリュームを拡張して新規の物理ボリュームを組み入れます。
  4. ファイルシステムを拡張します。
ボリュームグループ内に十分な未割り当ての領域がある場合は、手順1と2を実行する代わりに、その領域を使用して論理ボリュームを拡張することができます。

4.4. 論理ボリュームのバックアップ

メタデータのバックアップとアーカイブは、lvm.conf ファイル内で無効になっていない限り、すべてのボリュームグループと論理ボリューム設定の変更時に自動的に作成されます。デフォルトでは、メタデータのバックアップは /etc/lvm/backup ファイルに保存され、メタデータのアーカイブは /etc/lvm/archive ファイルに保存されます。メタデータのアーカイブが /etc/lvm/archive ファイルに保存される期間と保存されるアーカイブファイルの数は、lvm.conf ファイル内で設定可能なパラメーターにより決定されます。日次のシステムバックアップでは、バックアップに /etc/lvm ディレクトリの内容が含まれる必要があります。
メタデータバックアップでは、論理ボリュームに含まれているユーザーとシステムのデータはバックアップされない点に注意してください。
vgcfgbackup コマンドを使用すると、/etc/lvm/backup ファイルにメタデータを手動でバックアップできます。また、vgcfgrestore コマンドを使用すると、メタデータを復元できます。vgcfgbackup コマンドと vgcfgrestore コマンドに ついては 「ボリュームグループメタデータのバックアップ」 で説明しています。

4.5. ロギング

すべてのメッセージ出力は、以下のロギングレベル用に独立した選択を持つロギングモジュールを通過します。
  • 標準出力/エラー
  • syslog
  • ログファイル
  • 外部ログ関数
ロギングのレベルは /etc/lvm/lvm.conf ファイル内にセットされており、これに関しては、付録B LVM 設定ファイル で説明があります。

4.6. メタデータデーモン (lvmetad)

LVM はオプションで中央メタデータキャッシュを使用できます。これはデーモン (lvmetad) と udev ルールにより実装されます。このメタデータデーモンの目的は主に 2 つあります。1 つ目は LVM コマンドのパフォーマンスを向上すること、2 つ目はシステムが論理ボリュームまたはボリュームグループ全体を利用できるようになった時に udev がそれらを自動的にアクティブ化できることです。

注記

lvmetad デーモンは、クラスターのノード間では現在サポートされておらず、ロックタイプはローカルのファイルベースである必要があります。
このデーモンの利点を活用するには、以下を実行してください。
  • lvm2-lvmetad サービスを使ってデーモンを起動します。デーモンをブート時に自動起動するには、chkconfig lvm2-lvmetad on コマンドを使用してください。手動でデーモンを起動するには、service lvm2-lvmetad start コマンドを使用してください。
  • Configure LVM to make use of the daemon by setting the global/use_lvmetad variable to 1 in the lvm.conf configuration file. For information on the lvm.conf configuration file, see 付録B LVM 設定ファイル.
Normally, each LVM command issues a disk scan to find all relevant physical volumes and to read volume group metadata. However, if the metadata daemon is running and enabled, this expensive scan can be skipped. Instead, the lvmetad daemon scans each device only once, when it becomes available, by means of udev rules. This can save a significant amount of I/O and reduce the time required to complete LVM operations, particularly on systems with many disks. For information on the udev device manager and udev rules, see 「デバイスマッパーの udev デバイスマネージャサポート」.
When a new volume group is made available at runtime (for example, through hotplug or iSCSI), its logical volumes must be activated in order to be used. When the lvmetad daemon is enabled, the activation/auto_activation_volume_list option in the lvm.conf configuration file can be used to configure a list of volume groups and logical volumes that should be automatically activated. Without the lvmetad daemon, a manual activation is necessary. By default, this list is not defined, which means that all volumes are autoactivated once all of the physical volumes are in place. The autoactivation works recursively for LVM stacked on top of other devices, as it is event-based.

注記

When the lvmetad daemon is running, the filter = setting in the /etc/lvm/lvm.conf file does not apply when you execute the pvscan --cache device command. To filter devices, you need to use the global_filter = setting. Devices that fail the global filter are not opened by LVM and are never scanned. You may need to use a global filter, for example, when you use LVM devices in VMs and you do not want the contents of the devices in the VMs to be scanned by the physical host.

4.7. Displaying LVM Information with the lvm Command

The lvm command provides several built-in options that you can use to display information about LVM support and configuration.
  • lvm devtypes
    Displays the recognized built-in block device types (Red Hat Enterprise Linux release 6.6 and later).
  • lvm formats
    Displays recognizes metadata formats.
  • lvm help
    Displays LVM help text.
  • lvm segtypes
    Displays recognized logical volume segment types.
  • lvm tags
    Displays any tags defined on this host. For information on LVM object tags, see 付録D LVM オブジェクトタグ.
  • lvm version
    Displays the current version information.

第5章 CLI コマンドでの LVM 管理

この章では、論理ボリュームを作成し、保守するために LVM CLI (Command Line Interface) コマンドで実行できる個別の管理タスクについてまとめています。

注記

クラスター化環境用に LVM ボリュームを作成または変更する場合、clvmd デーモンが稼働していることを確認する必要があります。詳細は 「クラスター内での LVM ボリューム作成」 を参照してください。

5.1. CLI コマンドの使用

すべての LVM CLI コマンドには一般的な特性がいくつかあります。
コマンドライン引数でサイズが必要な場合は、単位を常に明示的に指定することができます。単位を指定しないと、デフォルト (通常 KB か MB) が使用されます。LVM CLI コマンドでは小数は使用できません。
コマンドライン引数内で単位を指定する場合、LVM は大文字/小文字を区別せず (例えば、M か m の指定は同じことです)、2 の累乗 (1024 の倍数) が使用されます。しかし、コマンド内で --units 引数を指定する場合、小文字では単位が 1024 の倍数、大文字では 1000 の倍数であることを示します。
コマンドが、ボリュームグループ名または論理ボリューム名を引数として取る場合、完全なパス名はオプションとなります。ボリュームグループ vg0 内の論理ボリューム lvol0vg0/lvol0 と指定できます。ボリュームグループの一覧が必要であるのに空のままの場合、すべてのボリュームグループの一覧が代用されます。論理ボリュームの一覧が必要な状態で、1つのボリュームグループだけ提示されている場合、そのボリュームグループ内のすべての論理ボリュームの一覧が代用されます。例えば、lvdisplay vg0 コマンドは、ボリュームグループ vg0 内の すべての論理ボリュームを表示します。
すべての LVM コマンドは -v 引数を使用できるため、これを複数回入力して出力の詳細度を高くすることができます。例えば、次の例では lvcreate コマンドのデフォルト出力を示しています。
# lvcreate -L 50MB new_vg
  Rounding up size to full physical extent 52.00 MB
  Logical volume "lvol0" created
Copy to Clipboard Toggle word wrap
以下の例は、-v 引数を使用した lvcreate コマンドの出力を示しています。
# lvcreate -v -L 50MB new_vg
    Finding volume group "new_vg"
  Rounding up size to full physical extent 52.00 MB
    Archiving volume group "new_vg" metadata (seqno 4).
    Creating logical volume lvol0
    Creating volume group backup "/etc/lvm/backup/new_vg" (seqno 5).
    Found volume group "new_vg"
    Creating new_vg-lvol0
    Loading new_vg-lvol0 table
    Resuming new_vg-lvol0 (253:2)
    Clearing start of logical volume "lvol0"
    Creating volume group backup "/etc/lvm/backup/new_vg" (seqno 5).
  Logical volume "lvol0" created
Copy to Clipboard Toggle word wrap
また、-vv-vvv、あるいは -vvvv の引数を使用して、コマンドの実行内容を徐々に詳しく表示することができます。-vvvv 引数は、現時点で最も詳細な情報を提供します。以下の例では、-vvvv 引数が指定された lvcreate コマンドの出力のうち最初の数行のみを示しています。
# lvcreate -vvvv -L 50MB new_vg
#lvmcmdline.c:913         Processing: lvcreate -vvvv -L 50MB new_vg
#lvmcmdline.c:916         O_DIRECT will be used
#config/config.c:864       Setting global/locking_type to 1
#locking/locking.c:138       File-based locking selected.
#config/config.c:841       Setting global/locking_dir to /var/lock/lvm
#activate/activate.c:358       Getting target version for linear
#ioctl/libdm-iface.c:1569         dm version   OF   [16384]
#ioctl/libdm-iface.c:1569         dm versions   OF   [16384]
#activate/activate.c:358       Getting target version for striped
#ioctl/libdm-iface.c:1569         dm versions   OF   [16384]
#config/config.c:864       Setting activation/mirror_region_size to 512
...
Copy to Clipboard Toggle word wrap
LVM CLI コマンドのいずれにも --help 引数を付けると、そのコマンドのヘルプを表示することができます。
# commandname --help
Copy to Clipboard Toggle word wrap
コマンドの man ページを表示するには、man コマンドを実行します。
# man commandname
Copy to Clipboard Toggle word wrap
man lvm コマンドは、LVM に関する一般的なオンライン情報を提供します。
すべての LVM オブジェクトは、オブジェクトを作成した時に割り当てられる UUID によって、内部で参照されます。これは、例えばボリュームグループの一部である物理ボリューム /dev/sdf を削除した後で、接続し直した際に、/dev/sdk となっていることが判明した場合などに役立ちます。LVM は物理ボリュームをそのデバイス名ではなく、UUID で識別するため、物理ボリュームを見つけることができます。物理ボリュームの作成時に物理ボリュームの UUID を指定する方法については、「物理ボリュームメタデータの復元」 をご覧ください。

5.2. 物理ボリュームの管理

このセクションでは、物理ボリューム管理の様々な側面を実行するコマンドを説明しています。

5.2.1. 物理ボリュームの作成

以下のサブセクションは、物理ボリューム作成に使用するコマンドを説明しています。
5.2.1.1. パーティションタイプの設定
物理ボリューム用にディスクデバイス全体を使用している場合、そのディスクにパーティションテーブルがあってはなりません。DOS のディスクパーティションの場合は、fdisk または cfdisk もしくはそれらに相当するコマンドを使用して、パーティション ID が 0x8e にセットされている必要があります。ディスクデバイス全体のみの場合は、パーティションテーブルを消去する必要があり、これによって、そのディスク上の全データが実質的に破棄されます。以下のコマンドを使用して、最初のセクターをゼロで初期化すると既存のパーティションテーブルを削除することができます:
# dd if=/dev/zero of=PhysicalVolume bs=512 count=1
Copy to Clipboard Toggle word wrap
5.2.1.2. 物理ボリュームの初期化
pvcreate コマンドを使用して、物理ボリュームとして使用するブロックデバイスを初期化します。初期化は、ファイルシステムのフォーマッティングと同様です。
以下のコマンドは、/dev/sdd/dev/sde、および /dev/sdf を LVM 物理ボリュームとして初期化します。これは LVM 論理ボリュームの一部として後ほど使用するためです。
# pvcreate /dev/sdd /dev/sde /dev/sdf
Copy to Clipboard Toggle word wrap
ディスク全体でなく、パーティションを初期化するには、そのパーティション上で pvcreate コマンドを実行します。以下の例では、パーティション /dev/hdb1 を LVM 論理ボリュームの一部として後で使用するために、LVM 物理ボリュームとして初期化します。
# pvcreate /dev/hdb1
Copy to Clipboard Toggle word wrap
5.2.1.3. ブロックデバイスのスキャン
以下の例に示してあるように、lvmdiskscan コマンドを使用して 物理ボリュームとして使用可能なブロックデバイスをスキャンできます。
# lvmdiskscan
  /dev/ram0                    [       16.00 MB]
  /dev/sda                     [       17.15 GB]
  /dev/root                    [       13.69 GB]
  /dev/ram                     [       16.00 MB]
  /dev/sda1                    [       17.14 GB] LVM physical volume
  /dev/VolGroup00/LogVol01     [      512.00 MB]
  /dev/ram2                    [       16.00 MB]
  /dev/new_vg/lvol0            [       52.00 MB]
  /dev/ram3                    [       16.00 MB]
  /dev/pkl_new_vg/sparkie_lv   [        7.14 GB]
  /dev/ram4                    [       16.00 MB]
  /dev/ram5                    [       16.00 MB]
  /dev/ram6                    [       16.00 MB]
  /dev/ram7                    [       16.00 MB]
  /dev/ram8                    [       16.00 MB]
  /dev/ram9                    [       16.00 MB]
  /dev/ram10                   [       16.00 MB]
  /dev/ram11                   [       16.00 MB]
  /dev/ram12                   [       16.00 MB]
  /dev/ram13                   [       16.00 MB]
  /dev/ram14                   [       16.00 MB]
  /dev/ram15                   [       16.00 MB]
  /dev/sdb                     [       17.15 GB]
  /dev/sdb1                    [       17.14 GB] LVM physical volume
  /dev/sdc                     [       17.15 GB]
  /dev/sdc1                    [       17.14 GB] LVM physical volume
  /dev/sdd                     [       17.15 GB]
  /dev/sdd1                    [       17.14 GB] LVM physical volume
  7 disks
  17 partitions
  0 LVM physical volume whole disks
  4 LVM physical volumes
Copy to Clipboard Toggle word wrap

5.2.2. 物理ボリュームの表示

LVM 物理ボリュームのプロパティを表示するのに使用できるコマンドは 3 つあります。pvspvdisplay、および pvscan です。
pvs コマンドは、物理ボリューム情報を設定可能な形式で提供して、1 つの物理ボリュームにつき 1 行ずつ表示します。pvs コマンドは豊富な書式制御を提供するため、スクリプティングに役立ちます。出力をカスタマイズするための pvs コマンドの使用に関する情報は 「LVM 用のカスタム報告」 をご覧ください。
The pvdisplay command provides a verbose multi-line output for each physical volume. It displays physical properties (size, extents, volume group, and so on) in a fixed format.
以下の例では、単一物理ボリュームの pvdisplay コマンドの出力を示しています。
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               new_vg
  PV Size               17.14 GB / not usable 3.40 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              4388
  Free PE               4375
  Allocated PE          13
  PV UUID               Joqlch-yWSj-kuEn-IdwM-01S9-XO8M-mcpsVe
Copy to Clipboard Toggle word wrap
pvscan コマンドは、物理ボリューム用にシステム内のサポートされたすべての LVM ブロックデバイスをスキャンします。
以下のコマンドは、検出された物理デバイスをすべて表示します。
# pvscan
 PV /dev/sdb2   VG vg0   lvm2 [964.00 MB / 0   free]
 PV /dev/sdc1   VG vg0   lvm2 [964.00 MB / 428.00 MB free]
 PV /dev/sdc2            lvm2 [964.84 MB]
 Total: 3 [2.83 GB] / in use: 2 [1.88 GB] / in no VG: 1 [964.84 MB]
Copy to Clipboard Toggle word wrap
You can define a filter in the /etc/lvm/lvm.conf file so that this command will avoid scanning specific physical volumes. For information on using filters to control which devices are scanned, see 「フィルターを使用した LVM デバイススキャンの制御」.

5.2.3. 物理ボリューム上での割り当て防止

pvchange コマンドを使用すると、単一または複数の物理ボリュームの空き領域上での物理エクステントの割り当てを防止することができます。これは、ディスクエラーが発生した場合や、物理ボリュームを取り除く場合に必要となる可能性があります。
以下のコマンドは、/dev/sdk1 上での物理エクステントの割り当てを無効にします。
# pvchange -x n /dev/sdk1
Copy to Clipboard Toggle word wrap
pvchange コマンドで -xy 引数を使用すると、以前に無効にされていた割り当てを許可することができます。

5.2.4. 物理ボリュームのサイズ変更

なんらかの理由で配下のブロックデバイスのサイズを変更する必要がある場合は、pvresize コマンドを使用して LVM を新規サイズに更新します。このコマンドは LVM が物理ボリュームを使用している間に実行することができます。

5.2.5. 物理ボリュームの削除

デバイスを LVM で使用する必要がなくなった場合、pvremove コマンドを使用して LVM ラベルを削除することができます。pvremove コマンドを実行すると、空の物理ボリューム上の LVM メタデータをゼロにします。
削除したい物理ボリュームが現在ボリュームグループの一部である場合、「ボリュームグループからの物理ボリュームの削除」 で説明してあるように、vgreduce コマンドでボリュームグループから物理ボリュームを取り除く必要があります。
# pvremove /dev/ram15
  Labels on physical volume "/dev/ram15" successfully wiped
Copy to Clipboard Toggle word wrap

5.3. ボリュームグループ管理

このセクションでは、ボリュームグループ管理の各種事項を実行するためのコマンドについて説明しています。

5.3.1. ボリュームグループの作成

To create a volume group from one or more physical volumes, use the vgcreate command. The vgcreate command creates a new volume group by name and adds at least one physical volume to it.
以下のコマンドは、vg1 と言う名前のボリュームグループを作成します。これには、物理ボリューム /dev/sdd1/dev/sde1 が含まれます。
# vgcreate vg1 /dev/sdd1 /dev/sde1
Copy to Clipboard Toggle word wrap
ボリュームグループの作成に物理ボリュームが使用される場合、ディスク領域はデフォルトでは 4MB のエクステントに分割されます。このエクステントは、論理ボリュームのサイズを拡張/縮小するための最小単位です。エクステントの数が多くても、論理ボリュームの I/O パフォーマンスに影響を与えることはありません。
エクステントサイズのデフォルト設定が適切でない場合、vgcreate コマンドに -s オプションを使用して、サイズを指定することができます。vgcreate コマンドに -p-l の引数を使用すると、ボリュームグループに追加可能な物理ボリュームまたは論理ボリュームの数を限定することができます。
By default, a volume group allocates physical extents according to common-sense rules such as not placing parallel stripes on the same physical volume. This is the normal allocation policy. You can use the --alloc argument of the vgcreate command to specify an allocation policy of contiguous, anywhere, or cling. In general, allocation policies other than normal are required only in special cases where you need to specify unusual or nonstandard extent allocation. For further information on how LVM allocates physical extents, see 「LVM の割り当て」.
LVM ボリュームグループと配下にある論理ボリュームは、以下のような配置で /dev ディレクトリ内のデバイス特有のファイルがあるディレクトリツリーに格納されます。
/dev/vg/lv/
Copy to Clipboard Toggle word wrap
For example, if you create two volume groups myvg1 and myvg2, each with three logical volumes named lv01, lv02, and lv03, six device special files are created:
/dev/myvg1/lv01
/dev/myvg1/lv02
/dev/myvg1/lv03
/dev/myvg2/lv01
/dev/myvg2/lv02
/dev/myvg2/lv03
Copy to Clipboard Toggle word wrap
The device special files are not present if the corresponding logical volume is not currently active.
LVM でのデバイスの最大サイズは、64 ビット CPU 上で 8 エクサバイトです。

5.3.2. LVM の割り当て

LVM の操作で物理エクステントを単一または複数の論理ボリュームに割り当てる必要がある場合、割り当ては以下のように行われます。
  • ボリュームグループ内で未割り当ての物理エクステントが割り当て用に生成されます。コマンドラインの末尾で物理エクステントの範囲を指定した場合は、指定した物理ボリューム上のその範囲内で未割り当ての物理エクステントのみが割り当て用として考慮に入れられます。
  • 各割り当てポリシーは、最も厳しいポリシー (contiguous) から始まり、最後は --alloc オプションを使用して指定される、あるいは特定の論理ボリュームやボリュームグループ用にデフォルトとしてセットされる割り当てポリシーと、順番に試行されます。割り当てポリシーでは、埋める必要がある空の論理ボリューム領域の最少の論理エクステントから、割り当てポリシーによる制限に沿って、できるだけ多くの領域の割り当てを行います。領域がさらに必要な場合は、LVM は次のポリシーに移動します。
割り当てポリシーの制限は以下のとおりです。
  • contiguous の割り当てポリシーでは、論理ボリュームの 1 番目の論理エクステントではない論理エクステントは、直接先行する論理エクステントに物理的に隣接する必要があります。
    論理ボリュームがストライプ化またはミラー化されると、contiguous の割り当て制限が、領域を必要とする各ストライプまたはミラーイメージ (レッグ) に個別に適用されます。
  • cling の割り当てポリシーでは、既存の論理ボリュームに追加される任意の論理エクステントに使用される物理ボリュームは、その論理ボリューム内でそれより前から 1 つ以上の論理エクステントにより使用されている必要があります。allocation/cling_tag_list の設定パラメーターが定義されている場合に、一覧表示されているいずれかのタグが 2 つの物理ボリュームに存在していると、この両方の物理ボリュームは適合すると考えられます。これにより、同じプロパティ (物理的な場所など) を持つ物理ボリュームのグループを、割り当て目的でタグして同等に処理することができます。LVM ボリュームの拡張時に使用する追加の物理ボリュームを指定する LVM タグとともに、cling ポリシーの使用に関しては、cling 割り当てポリシーを使用した論理ボリュームの拡張」 をご覧ください。
    論理ボリュームがストライプ化またはミラー化されると、cling の割り当て制限が、領域を必要とする各ストライプまたはミラーイメージ (レッグ) に個別に適用されます。
  • normal の割り当てポリシーは、並列の論理ボリューム (異なるストライプまたはミラーイメージ/レッグ) 内の同じオフセットで、その並列の論理ボリュームにすでに割り当て済みの論理エクステントと同じ物理ボリュームを共有する物理エクステントは選択しません。
    ミラーデータ保持のために論理ボリュームと同時にミラーログを割り当てる場合、normal の割り当てポリシーは最初にログやデータに対して異なる物理ボリュームを選択しようとします。それが不可能で、かつ allocation/mirror_logs_require_separate_pvs 設定パラメーターが 0 にセットされている場合は、ログが物理ボリュームとデータの一部を共有できるようになります。
    同様に、シンプールメタデータを割り当てる場合、normal の割り当てポリシーはミラーログを割り当てる場合と同じ注意事項に沿います。allocation/thin_pool_metadata_require_separate_pvs 設定パラメーターの値に基づきます。
  • 割り当て要求を満たすだけの十分な空きエクステントがあっても normal の割り当てポリシーがそれらを使用しない場合は、たとえパフォーマンスが低下しても、同じ物理ボリュームに 2 つのストライプを配置することによって、anywhere 割り当てポリシーが使用します。
割り当てポリシーは vgchange コマンドを使用して変更できます。

注記

If you rely upon any layout behavior beyond that documented in this section according to the defined allocation policies, you should note that this might change in future versions of the code. For example, if you supply on the command line two empty physical volumes that have an identical number of free physical extents available for allocation, LVM currently considers using each of them in the order they are listed; there is no guarantee that future releases will maintain that property. If it is important to obtain a specific layout for a particular Logical Volume, then you should build it up through a sequence of lvcreate and lvconvert steps such that the allocation policies applied to each step leave LVM no discretion over the layout.
割り当てプロセスが特定のケースで現在実行する方法を表示するには、コマンドに -vvvv オプションを追加するなどして、デバッグロギングの出力を読み取ることができます。

5.3.3. クラスター内でのボリュームグループ作成

vgcreate コマンドでクラスター環境内にボリュームグループを作成します。単一ノードでボリュームグループを作成する時と同様です。
By default, volume groups created with CLVM on shared storage are visible to all computers that have access to the shared storage. It is possible, however, to create volume groups that are local, visible only to one node in the cluster, by using the -c n option of the vgcreate command.
クラスター環境内で以下のコマンドを実行すると、コマンドの実行元であるノードに対してローカルとなるボリュームグループが作成されます。このコマンドは、物理ボリュームである /dev/sdd1/dev/sde1 を含むローカルボリューム vg1 を作成します。
# vgcreate -c n vg1 /dev/sdd1 /dev/sde1
Copy to Clipboard Toggle word wrap
vgchange コマンドで -c オプションを使用すると、既存のボリュームグループがローカルあるいはクラスターかを変更できます。詳細は 「ボリュームグループのパラメーター変更」 で説明しています。
既存のボリュームグループがクラスター化したボリュームグループであるかどうかは vgs コマンドでチェックできます。ボリュームがクラスター化されている場合は、c 属性を表示します。以下のコマンドは VolGroup00testvg1 のボリュームグループの属性を表示します。この例では、VolGroup00 はクラスター化されていませんが、testvg1 は、Attr 見出しの下にある c 属性が示すようにクラスター化されています。
# vgs
  VG            #PV #LV #SN Attr   VSize  VFree
  VolGroup00      1   2   0 wz--n- 19.88G    0
  testvg1         1   1   0 wz--nc 46.00G 8.00M
Copy to Clipboard Toggle word wrap
For more information on the vgs command, see 「ボリュームグループの表示 」「LVM 用のカスタム報告」, and the vgs man page.

5.3.4. ボリュームグループへの物理ボリュームの追加

新規に物理ボリュームを既存のボリュームグループに追加するには、vgextend コマンドを使用します。vgextend コマンドは、1つ、または複数の空き物理ボリュームを追加することによってボリュームグループの容量を拡大します。
以下のコマンドは、物理ボリューム /dev/sdf1 をボリュームグループ vg1 に追加します。
# vgextend vg1 /dev/sdf1
Copy to Clipboard Toggle word wrap

5.3.5. ボリュームグループの表示

LVM ボリュームグループのプロパティを表示するのに使用できるコマンドは 2 つあります。vgsvgdisplay です。
vgscan コマンドは、ボリュームグループのすべてのディスクをスキャンして LVM キャッシュファイルを再構築する以外に、ボリュームグループを表示することもできます。vgscan コマンドに関する情報は 「キャッシュファイル構築のためのボリュームグループのディスクスキャン」 をご覧ください。
vgs コマンドは、ボリュームグループの情報を設定可能な形式で提供し、1 ボリュームグループにつき 1 行ずつ表示します。vgs コマンドは豊富な書式制御を提供するため、スクリプティングに役立ちます。出力をカスタマイズするための vgs コマンドの使用については、「LVM 用のカスタム報告」 をご覧ください。
The vgdisplay command displays volume group properties (such as size, extents, number of physical volumes, and so on) in a fixed form. The following example shows the output of a vgdisplay command for the volume group new_vg. If you do not specify a volume group, all existing volume groups are displayed.
# vgdisplay new_vg
  --- Volume group ---
  VG Name               new_vg
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               51.42 GB
  PE Size               4.00 MB
  Total PE              13164
  Alloc PE / Size       13 / 52.00 MB
  Free  PE / Size       13151 / 51.37 GB
  VG UUID               jxQJ0a-ZKk0-OpMO-0118-nlwO-wwqd-fD5D32
Copy to Clipboard Toggle word wrap

5.3.6. キャッシュファイル構築のためのボリュームグループのディスクスキャン

The vgscan command scans all supported disk devices in the system looking for LVM physical volumes and volume groups. This builds the LVM cache file in the /etc/lvm/cache/.cache file, which maintains a listing of current LVM devices.
LVM は、システムの起動時、ならびに vgcreate コマンドを実行した時や LVM が不整合を検出した時など、LVM が動作している他の時点で vgscan コマンドを自動的に実行します。

注記

ハードウェア構成を変更して、ノードに対してデバイスの追加/削除を行う場合、システムの起動時に存在していなかったデバイスがシステムに認識されるように vgscan コマンドを手動で実行しなければならない場合があります。これは、例えば、SAN 上のシステムに新しいディスクを追加したり、物理ボリュームとしてラベルが付けられた新しいディスクをホットプラグする場合に必要になる可能性があります。
lvm.conf ファイル内でフィルターを定義することで、特定デバイスを避けるようにスキャンを限定できます。スキャンするデバイスを制御するためのフィルターの使用については、「フィルターを使用した LVM デバイススキャンの制御」 をご覧ください。
次の例では、vgscan コマンドの出力を示しています。
# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "new_vg" using metadata type lvm2
  Found volume group "officevg" using metadata type lvm2
Copy to Clipboard Toggle word wrap

5.3.7. ボリュームグループからの物理ボリュームの削除

ボリュームグループから使用しない物理ボリュームを削除するには、vgreduce コマンドを使用します。vgreduce コマンドは、1つまたは複数の空の物理ボリュームを削除することにより、ボリュームグループの容量を縮小します。これによって、物理ボリュームが開放され、異なるボリュームグループで使用したり、システムから削除できるようになります。
ボリュームグループから物理ボリュームを削除する前に、pvdisplay コマンドを使用して、その物理ボリュームが論理ボリュームによって使用されていないことを確認することができます。
# pvdisplay /dev/hda1

-- Physical volume ---
PV Name               /dev/hda1
VG Name               myvg
PV Size               1.95 GB / NOT usable 4 MB [LVM: 122 KB]
PV#                   1
PV Status             available
Allocatable           yes (but full)
Cur LV                1
PE Size (KByte)       4096
Total PE              499
Free PE               0
Allocated PE          499
PV UUID               Sd44tK-9IRw-SrMC-MOkn-76iP-iftz-OVSen7
Copy to Clipboard Toggle word wrap
If the physical volume is still being used you will have to migrate the data to another physical volume using the pvmove command. Then use the vgreduce command to remove the physical volume.
以下のコマンドは、物理ボリューム /dev/hda1 を ボリュームグループ my_volume_group から取り除きます。
# vgreduce my_volume_group /dev/hda1
Copy to Clipboard Toggle word wrap
If a logical volume contains a physical volume that fails, you cannot use that logical volume. To remove missing physical volumes from a volume group, you can use the --removemissing parameter of the vgreduce command, if there are no logical volumes that are allocated on the missing physical volumes.

5.3.8. ボリュームグループのパラメーター変更

「ボリュームグループのアクティブ化と非アクティブ化」 で説明しているように、vgchange コマンドは、ボリュームグループの非アクティブ化およびアクティブ化に使用されます。また、このコマンドを使用して、既存のボリュームグループを対象とする、いくつかのボリュームグループパラメーターを変更することも可能です。
以下のコマンドは、ボリュームグループ vg00 の論理ボリュームの最大数を 128 に変更します。
# vgchange -l 128 /dev/vg00
Copy to Clipboard Toggle word wrap
vgchange コマンドで変更できるボリュームグループパラメーターの説明については vgchange(8) の man ページをご覧ください。

5.3.9. ボリュームグループのアクティブ化と非アクティブ化

ボリュームグループを作成すると、デフォルトでアクティブ化されます。これは、そのグループ内の論理ボリュームがアクセス可能で、かつ変更される可能性があることを意味します。
ボリュームグループを非アクティブ化して、カーネルに認識されないようにする必要がある、様々な状況があります。ボリュームグループを非アクティブ化、またはアクティブ化するには、vgchange コマンドで -a (--available) 引数を使用します。
以下の例では、ボリュームグループ my_volume_group を非アクティブ化します。
# vgchange -a n my_volume_group
Copy to Clipboard Toggle word wrap
クラスター化されたロッキングが有効な場合には、「e」を追加すると 1 つのノード上でボリュームグループが排他的にアクティブ化または非アクティブ化されます。「l」を追加すると、ローカルノード上のみでボリュームグループがアクティブ化または非アクティブ化されます。単一ホストのスナップショットを使用する論理ボリュームは、1 度に 1 つのノード上でしか利用できないため、常に排他的にアクティブ化されます。
「論理ボリュームグループのパラメーター変更」 で説明してあるように、lvchange コマンドを使用して、個別の論理ボリュームを非アクティブ化できます。クラスター内の個別ノード上で論理ボリュームをアクティブ化する方法については、「クラスター内の個別ノード上の論理ボリュームのアクティブ化」 をご覧ください。

5.3.10. ボリュームグループの削除

論理ボリュームがないボリュームグループを削除するには、vgremove コマンドを使用します。
# vgremove officevg
  Volume group "officevg" successfully removed
Copy to Clipboard Toggle word wrap

5.3.11. ボリュームグループの分割

ボリュームグループの物理ボリュームを分割して、新しいボリュームグループを作成するには、vgsplit コマンドを使用します。
論理ボリュームはボリュームグループ間で分割することはできません。それぞれの既存の論理ボリュームは完全に物理ボリューム上に存在し、既存または新規のボリュームグループを形成している必要があります。しかし必要であれば、pvmove コマンドを使用して、その分割を強制することができます。
以下の例では、オリジナルのボリュームグループ bigvg から新規のボリュームグループ smallvg を分割しています。
# vgsplit bigvg smallvg /dev/ram15
  Volume group "smallvg" successfully split from "bigvg"
Copy to Clipboard Toggle word wrap

5.3.12. ボリュームグループの統合

2 つのボリュームグループを統合して 1 つのボリュームグループにするには、vgmerge コマンドを使用します。ボリュームの物理エクステントサイズが同じで、かつ両ボリュームグループの物理および論理ボリュームのサマリーが「マージ先」ボリュームグループの制限内に収まる場合は、非アクティブな「マージ元」のボリュームを、アクティブまたは非アクティブの「マージ先」ボリュームにマージすることができます。
以下のコマンドは、非アクティブなボリュームグループ my_vg をアクティブまたは非アクティブなボリュームグループ databases にマージして、詳細なランタイム情報を提供します。
# vgmerge -v databases my_vg
Copy to Clipboard Toggle word wrap

5.3.13. ボリュームグループメタデータのバックアップ

メタデータのバックアップとアーカイブは、lvm.conf ファイル内で無効になっていない限り、すべてのボリュームグループと論理ボリューム設定の変更時に自動的に作成されます。デフォルトでは、メタデータのバックアップは /etc/lvm/backup ファイルに保存され、メタデータのアーカイブは /etc/lvm/archives ファイルに保存されます。vgcfgbackup コマンドを使用するとメタデータを /etc/lvm/backup ファイルに手動でバックアップできます。
vgcfrestore コマンドは、アーカイブからボリュームグループのメタデータをボリュームグループのすべての物理ボリュームに復元します。
物理ボリュームのメタデータを復元するための vgcfgrestore コマンドの使用例は、「物理ボリュームメタデータの復元」 をご覧ください。

5.3.14. ボリュームグループの名前変更

既存ボリュームグループの名前を変更するには、vgrename コマンドを使用します。
以下のいずれかのコマンドで、既存ボリュームグループ vg02 の名前を my_volume_group に変更できます。
# vgrename /dev/vg02 /dev/my_volume_group
Copy to Clipboard Toggle word wrap
# vgrename vg02 my_volume_group
Copy to Clipboard Toggle word wrap

5.3.15. ボリュームグループの別のシステムへの移動

LVM ボリュームグループ全体を別のシステムに移動することができます。これを実行するには、vgexportvgimport のコマンドの使用が推奨されます。

注記

As of Red Hat Enterprise Linux 6.5, you can use the --force argument of the vgimport command. This allows you to import volume groups that are missing physical volumes and subsequently run the vgreduce --removemissing command.
vgexport コマンドは、システムが非アクティブのボリュームグループにアクセスできないようにするため、物理ボリュームのデタッチが可能になります。vgimport コマンドは、vgexport コマンドで停止していたボリュームグループにマシンが再度アクセスできるようにします。
ボリュームグループを 2 つのシステム間で移動するには、以下の手順に従います。
  1. ボリュームグループ内のアクティブなボリュームのファイルにアクセスしているユーザーがいないことを確認してから、論理ボリュームをアンマウントします。
  2. vgchange コマンドで -a n 引数を使用して、そのボリュームグループを非アクティブとしてマークします。これによりボリュームグループがこれ以上活動しないようにします。
  3. vgexport コマンドを使用してボリュームグループをエクスポートします。これは、削除中のシステムからのボリュームグループへのアクセスを防止します。
    ボリュームグループをエクスポートした後に、pvscan コマンドを実行すると、以下の例のように物理ボリュームがエクスポート先のボリュームグループ内に表示されます。
    # pvscan
      PV /dev/sda1    is in exported VG myvg [17.15 GB / 7.15 GB free]
      PV /dev/sdc1    is in exported VG myvg [17.15 GB / 15.15 GB free]
      PV /dev/sdd1   is in exported VG myvg [17.15 GB / 15.15 GB free]
      ...
    
    Copy to Clipboard Toggle word wrap
    システムが次回シャットダウンされる時に、ボリュームグループを構成していたディスクを切断して、それらを新しいシステムに接続することができます。
  4. ディスクが新しいシステムに接続されると、vgimport コマンドを使用してボリュームグループをインポートし、新しいシステムにアクセスできるようにします。
  5. vgchange コマンドで -a y 引数を使用してボリュームグループをアクティブ化します。
  6. ファイルシステムをマウントして使用可能にします。

5.3.16. ボリュームグループディレクトリの再作成

ボリュームグループディレクトリと論理ボリューム特別ファイルを再作成するには、vgmknodes コマンドを使用します。このコマンドは、/dev ディレクトリ内の LVM2 特別ファイルをチェックします。このファイルはアクティブな論理ボリュームに必要です。このコマンドは不足している特別ファイルを作成し、未使用のファイルを削除します。
vgscan コマンドに mknodes 引数を指定することにより、vgmknodes コマンドを vgscan コマンドに統合することができます。

5.4. 論理ボリュームの管理

このセクションでは、論理ボリューム管理の各種事項を実行するコマンドを説明しています。

5.4.1. リニア論理ボリュームの作成

論理ボリュームを作成するには、lvcreate コマンドを使用します。論理ボリューム用に名前を指定しないと、デフォルトの名前 lvol# が使用されます (# の部分には論理ボリュームの内部番号が入ります)。
論理ボリュームを作成する場合、論理ボリュームはボリュームグループを構成する物理ボリューム上の空きエクステントを使用してボリュームグループから構築されます。通常は論理ボリュームは配下の物理ボリューム上で次に使用可能な空きを基準にして空き領域を占有します。論理ボリュームを変更することで、物理ボリューム内の領域の開放と再割り当てができます。
As of the Red Hat Enterprise Linux 6.3 release, you can use LVM to create, display, rename, use, and remove RAID logical volumes. For information on RAID logical volumes, see 「RAID 論理ボリューム」.
以下のコマンドは、ボリュームグループ vg1 内に 10 ギガバイトのサイズの論理ボリュームを作成します。
# lvcreate -L 10G vg1
Copy to Clipboard Toggle word wrap
The default unit for logical volume size is megabytes. The following command creates a 1500 MB linear logical volume named testlv in the volume group testvg, creating the block device /dev/testvg/testlv.
# lvcreate -L 1500 -n testlv testvg
Copy to Clipboard Toggle word wrap
次のコマンドは、ボリュームグループ vg0 内の空きエクステントから gfslv と言う 50 ギガバイトの論理ボリュームを作成します。
# lvcreate -L 50G -n gfslv vg0
Copy to Clipboard Toggle word wrap
lvcreate コマンドで -l 引数を使用すると、エクステント内の論理ボリュームのサイズを指定することができます。この引数を使用すると、論理ボリュームに使用するボリュームグループのパーセンテージも指定できます。以下のコマンドは、ボリュームグループ testvg 内で全体の 60% を使用する mylv と呼ばれる論理ボリュームを作成します。
# lvcreate -l 60%VG -n mylv testvg
Copy to Clipboard Toggle word wrap
lvcreate コマンドで -l 引数を使用すると、ボリュームグループ内で残っている空き領域のパーセンテージを、論理ボリュームのサイズとして指定することもできます。以下のコマンドは、ボリュームグループ testvol 内の未割り当て領域をすべて使用する yourlv と呼ばれる論理ボリュームを作成します。
# lvcreate -l 100%FREE -n yourlv testvg
Copy to Clipboard Toggle word wrap
lvcreate コマンドで、-l 引数を使用して、ボリュームグループ全域を使用する論理ボリュームを作成することができます。ボリュームグループ全域を使用する論理ボリュームを作成する別の方法としては、vgdisplay コマンドを使用して「合計 PE」サイズを確認し、その結果を lvcreate コマンドへのインプットとして使用することです。
以下のコマンドは、testvg と言うボリュームグループ全域を使用する mylv と言う論理ボリュームを作成します。
# vgdisplay testvg | grep "Total PE"
Total PE              10230
# lvcreate -l 10230 testvg -n mylv
Copy to Clipboard Toggle word wrap
論理ボリュームの作成に使用した、配下の物理ボリュームは、物理ボリュームを削除する必要がある場合に重要となる可能性があります。そのため、論理ボリュームを作成する時にはこの可能性を考慮する必要があります。ボリュームグループから物理ボリュームを削除する方法についての情報は、「ボリュームグループからの物理ボリュームの削除」 をご覧ください。
ボリュームグループ内の特定の物理ボリュームから割り当てる論理ボリュームを作成するには、lvcreate コマンドラインの末尾に物理ボリュームを指定する必要があります。以下のコマンドは、物理ボリューム /dev/sdg1 から割り当てられるボリュームグループ testvg 内に論理ボリューム testlv を作成します。
# lvcreate -L 1500 -ntestlv testvg /dev/sdg1
Copy to Clipboard Toggle word wrap
論理ボリュームに使用する物理ボリュームのエクステントを指定することができます。以下の例では、ボリュームグループ testvg 内にエクステントが 0 から 24 の物理ボリューム /dev/sda1 およびエクステントが 50 から 124 の物理ボリューム /dev/sdb1 のリニア論理ボリュームを作成します。
# lvcreate -l 100 -n testlv testvg /dev/sda1:0-24 /dev/sdb1:50-124
Copy to Clipboard Toggle word wrap
以下の例では、エクステントが 0 から 25 の物理ボリューム /dev/sda1 からリニア論理ボリュームを作成した後に、エクステントが 100 の論理ボリュームを配置しています。
# lvcreate -l 100 -n testlv testvg /dev/sda1:0-25:100-
Copy to Clipboard Toggle word wrap
論理ボリュームのエクステントが割り当てられる方法についてのデフォルトポリシーは、inherit であり、ボリュームグループ用の同じポリシーに適用されます。これらのポリシーは lvchange コマンドを使用して変更できます。割り当てポリシーの詳細については、「ボリュームグループの作成」 をご覧ください。

5.4.2. ストライプ化ボリュームの作成

大量の連続的な読み取りと書き込みを行う場合、ストライプ化論理ボリュームを作成すると、データ I/O が効率化されます。ストライプ化ボリュームに関する一般情報は、「ストライプ化論理ボリューム」 をご覧ください。
ストライプ化論理ボリュームを作成する時には、lvcreate コマンドで -i 引数を使用してストライプの数を指定します。これは、論理ボリュームがストライプ化される物理ボリュームの数を決定します。ストライプ数は、ボリュームグループ内の物理ボリュームの数よりも多くすることはできません (--alloc anywhere 引数が使用される場合は例外)。
ストライプ化論理ボリュームを構成する配下の物理デバイスのサイズが異なる場合、ストライブ化ボリュームの最大サイズはその配下の最小デバイスで決定されます。例えば、2 レッグのストライプがある場合、最大サイズは小さいデバイスの 2 倍になります。3 レッグのストライプの場合、最大サイズは最小デバイスの 3 倍になります。
以下のコマンドは、64KB のストライプを持つ 2 つの物理ボリュームに渡ってストライプ化論理ボリュームを作成します。論理ボリュームのサイズは 50 ギガバイトで、gfslv と呼ばれ、ボリュームグループ vg0 から作り出されます。
# lvcreate -L 50G -i2 -I64 -n gfslv vg0
Copy to Clipboard Toggle word wrap
リニアボリュームと同じく、ストライプに使用する物理ボリュームのエクステントを指定することができます。以下のコマンドは、2 つの物理ボリュームに渡ってストライプ化する、stripelv と呼ばれる 100 エクステントのストライプ化ボリュームを testvg のボリュームグループ内に作成します。ストライプは /dev/sda1 のセクター 0-49 と /dev/sdb1 のセクター 50-99 を使用します。
# lvcreate -l 100 -i2 -nstripelv testvg /dev/sda1:0-49 /dev/sdb1:50-99
  Using default stripesize 64.00 KB
  Logical volume "stripelv" created
Copy to Clipboard Toggle word wrap

5.4.3. ミラー化ボリュームの作成

注記

As of the Red Hat Enterprise Linux 6.3 release, LVM supports RAID4/5/6 and a new implementation of mirroring. For information on this new implementation, see 「RAID 論理ボリューム」.

注記

ミラー化された LVM 論理ボリュームをクラスター内に作成するには、単一ノード上でミラー化論理ボリュームを作成するのと同じコマンドと手順が必要です。しかし、クラスター内にミラー化 LVM ボリュームを作成するには、クラスターとクラスターミラーインフラストラクチャーが稼動中であり、クラスターが定足数を満たしており、かつクラスターロッキングを有効化するように lvm.conf ファイル内のロッキングタイプが正しく設定されている必要があります。クラスター内におけるミラー化ボリューム作成の例については、「クラスター内でのミラー化 LVM 論理ボリュームの作成」 をご覧ください。
単一のクラスター内の複数のノードから短時間に連続して複数の LVM ミラー作成および変換コマンドを実行しようとすると、これらのコマンドのバックログが生じる場合があります。これによって、要求した動作がタイムアウトとなった後で失敗となる可能性があります。この問題を回避するために、クラスターミラー作成コマンドは、そのクラスターの単一ノードから実行することを推奨します。
ミラー化ボリュームを作成する場合、lvcreate コマンドの -m 引数を使用して、データのコピー数を指定します。-m1 と指定すると、1 つのミラーが作成され、ファイルシステムのコピーが合計 2 つとなります (1 つのリニア論理ボリュームと 1 つのコピー)。同じように -m2 と指定すると、2 つのミラーが作成され、ファイルシステムのコピーが合計 3 つとなります。
以下のコマンドは、単一のミラーを持つミラー化論理ボリュームを作成します。ボリュームのサイズは 50 ギガバイトで、mirrorlv と呼ばれ、ボリュームグループ vg0 から作り出されます。
# lvcreate -L 50G -m1 -n mirrorlv vg0
Copy to Clipboard Toggle word wrap
デフォルトでは、LVM ミラーデバイスは、複製されるデバイスをサイズが 512KB のリージョンに分割します。lvcreate コマンドで -R 引数を使用して、リージョンサイズをメガバイト単位で指定できます。また、lvm.conf ファイル内の mirror_region_size 設定を変更して、デフォルトのリージョンサイズを変更することも可能です。

注記

クラスターインフラストラクチャーの制限により、デフォルトのリージョンサイズが 512KB では、1.5TB を超えるクラスターミラーは作成できません。1.5TB よりも大きなミラーを必要とするユーザーは、リージョンサイズをデフォルトよりも大きくする必要があります。リージョンサイズを大きくしておかないと、LVM の作成がハングしてしまい、またその他の LVM コマンドもハングしてしまう可能性もあります。
1.5TB を超えるミラー用のリージョンサイズを指定するための一般的なガイドラインとして、ミラーサイズをテラバイト単位で考えて、2 の次の累乗に切り上げ、その数を lvcreate コマンドの -R 引数として使用することができます。例えば、ミラーサイズが 1.5TB の場合、-R 2 と指定することができます。また、ミラーサイズが 3TB の場合は -R 4、5TB の場合は -R 8と指定することができます。
以下のコマンドは、リージョンサイズが 2MB のミラー化論理ボリュームを作成します。
# lvcreate -m1 -L 2T -R 2 -n mirror vol_group
Copy to Clipboard Toggle word wrap
ミラーが作成されると、ミラーのリージョンは同期されます。大きなミラーコンポーネントの場合は、同期プロセスに長時間かかる可能性があります。Red Hat Enterprise Linux 6.3 では、再開が不要な新規のミラーを作成している場合は、--nosync 引数を指定して、最初のデバイスからの初期同期化は不要であることを示すことができます。
LVM maintains a small log which it uses to keep track of which regions are in sync with the mirror or mirrors. By default, this log is kept on disk, which keeps it persistent across reboots and ensures that the mirror does not need to be resynced every time a machine reboots or crashes. You can specify instead that this log be kept in memory with the --mirrorlog core argument; this eliminates the need for an extra log device, but it requires that the entire mirror be resynchronized at every reboot.
以下のコマンドは、ボリュームグループ bigvg からミラー化論理ボリュームを作成します。論理ボリュームは、ondiskmirvol と呼ばれ、単一のミラーがあります。ボリュームのサイズは 12MB で、ミラーログをメモリーに保存します。
# lvcreate -L 12MB -m1 --mirrorlog core -n ondiskmirvol bigvg
  Logical volume "ondiskmirvol" created
Copy to Clipboard Toggle word wrap
このミラーログは、いずれかのミラーレッグが作成されるデバイスとは異なるデバイス上で作成されます。しかし、vgcreate コマンドに --alloc anywhere 引数を使用することにより、ミラーレッグの 1 つと同じデバイス上にミラーログを作成することが可能です。これはパフォーマンスを低下させる可能性がありますが、配下のデバイスが 2 つしかない場合でもミラーを作成できます。
以下のコマンドは、単一のミラーを持つミラー化論理ボリュームを作成します。このミラーログはミラーレッグの 1 つと同じデバイス上にあります。この例では、ボリュームグループ vg0 は 2 つのデバイスのみで構成されています。このコマンドによって、ボリュームグループ vg0 内に mirrorlv という名前で、サイズが 500 MB のボリュームが作成されます。
# lvcreate -L 500M -m1 -n mirrorlv -alloc anywhere vg0
Copy to Clipboard Toggle word wrap

注記

クラスター化されたミラーでは、ミラーログ管理は、その時点でクラスター ID が最も低いクラスターノードの完全な責任です。そのため、クラスターミラーログを保持するデバイスがクラスターのサブセット上で利用できない場合、最も低い ID のクラスターノードがミラーログへのアクセスを維持している限りは、クラスター化されたミラーは影響を受けることなく、操作を持続することができます。ミラーは影響を受けないため、自動修正アクション (修復) も生じません。ただし、最も低い ID のクラスターノードがミラーログにアクセスできなくなると、(他のノードからログへのアクセスが可能か否かにかかわらず) 自動アクションが作動します。
自動的にミラー化されるミラーログを作成するために、--mirrorlog mirrored 引数を指定することができます。以下のコマンドはボリュームグループ bigvg からミラー化論理ボリュームを作成します。論理ボリュームは twologvol と言う名前で、単一のミラーを持ちます。このボリュームのサイズは 12MB で、ミラーログがミラー化され、各ログは別個のデバイス上に保管されます。
# lvcreate -L 12MB -m1 --mirrorlog mirrored -n twologvol bigvg
  Logical volume "twologvol" created
Copy to Clipboard Toggle word wrap
標準ミラーログと同様に、vgcreate コマンドの --alloc anywhere 引数を使用してミラーレッグと同じデバイス上に冗長ミラーログを作成することが可能です。これによってパフォーマンスが低下する可能性がありますが、各ログを別個のデバイス上に保管するための配下のデバイス数がミラーレッグに対して十分でない場合でも、冗長ミラーログの作成が可能となります。
ミラーが作成されると、ミラーのリージョンは同期されます。大きなミラーコンポーネントの場合は、同期プロセスに長時間かかる可能性があります。再開が不要な新規のミラーを作成している場合は、--nosync 引数を指定して、最初のデバイスからの初期同期化は不要であることを示すことができます。
ミラーレッグとログ用に使用するデバイス、およびそのデバイスで使用するエクステントを指定することができます。ログを特定のディスクに強制するには、それが配置されるディスク上のエクステントを正確に 1 つ指定します。LVM は、コマンドラインでデバイスが一覧表示される順序を必ずしも優先しません。物理ボリュームが一覧にあれば、それが割り当てを実行する唯一のスペースです。既に割り当て済みの物理エクステントが一覧にあれば、それは無視されます。
以下のコマンドは、単一のミラーを持つミラー化論理ボリュームを作成します。このボリュームのサイズは 500 MB で、mirrorlv と呼ばれ、ボリュームグループ vg0 から作り出されます。第 1 のミラーレッグはデバイス /dev/sda1 上、第 2 のミラーレッグはデバイス /dev/sdb1 上、そのミラーログは /dev/sdc1 上にあります。
# lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1 /dev/sdb1 /dev/sdc1
Copy to Clipboard Toggle word wrap
以下のコマンドは、単一のミラーを持つミラー化論理ボリュームを作成します。このボリュームサイズは 500 MB で、mirrorlv と呼ばれ、ボリュームグループ vg0 から作り出されます。第 1 のミラーレッグは、エクステントが 0 から 499 のデバイス /dev/sda1 にあり、第 2 のミラーレッグはエクステントが 0 から 499 のデバイス /dev/sdb1 にあります。ミラーログは、エクステントが 0 のデバイス /dev/sdc1 から始まります。これらは 1MB のエクステントです。指定されたエクステントのいずれかが既に割り当て済みの場合は、それらは無視されます。
# lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1:0-499 /dev/sdb1:0-499 /dev/sdc1:0
Copy to Clipboard Toggle word wrap

注記

Red Hat Enterprise Linux 6.1 リリースでは、単一の論理ボリューム内でストライピングとミラーリングを併用することが可能です。論理ボリュームの作成と同時にミラーの数 (--mirrors X) とストライプの数 (--stripes Y) を指定すると、ミラーデバイスの構成デバイスがストライプ化されます。
5.4.3.1. ミラー化論理ボリュームの障害ポリシー
lvm.conf ファイルの activation セクション内の mirror_image_fault_policymirror_log_fault_policy のパラメーターを使用すると、デバイスの障害が発生した場合にミラー化論理ボリュームがどのような動作をするかを定義することができます。これらのパラメーターが remove に設定されると、システムは障害のあるデバイスを削除して、そのデバイスなしで稼働を試みます。このパラメーター allocate に設定されていると、システムは障害のあるデバイスを削除して、そのデバイスの代わりとなる新たなデバイス上でのスペースの割り当てを試みます。代わりに割り当てることができる適切なデバイスとスペースがない場合、このポリシーは remove ポリシーと同様に機能します。
By default, the mirror_log_fault_policy parameter is set to allocate. Using this policy for the log is fast and maintains the ability to remember the sync state through crashes and reboots. If you set this policy to remove, when a log device fails the mirror converts to using an in-memory log and the mirror will not remember its sync status across crashes and reboots and the entire mirror will be resynced.
デフォルトでは、mirror_image_fault_policy パラメーターは remove に設定されています。このポリシーでは、ミラーイメージに障害が発生すると、良好なコピーが1つしか残っていない場合は、ミラーが非ミラー化デバイスに変換されます。ミラーデバイスに対してこのポリシーをallocate に設定すると、ミラーはデバイスを再同期する必要があるため、処理に時間がかかりますが、これによってデバイスのミラー特性を保持することができます。

注記

LVM ミラーにデバイス障害が発生すると、2 段階のリカバリが実行されます。第 1 段階では、障害が発生したデバイスの削除が行われます。これによってミラーは、単一のリニアデバイスに縮小されます。第 2 段階では、mirror_log_fault_policy パラメーターが allocate に設定されている場合、障害の発生したデバイスの置き換えを試みます。ただし、第 2 段階で、ミラーが以前使用していたデバイスの中で、障害の要因となったデバイスが利用可能な場合には、障害とは関係のないデバイスが選択されるという保証はない点に注意してください。
For information on manually recovering from an LVM mirror failure, see 「LVM ミラー障害からの回復」.
5.4.3.2. ミラー化論理ボリュームの冗長イメージの分割
ミラー化論理ボリュームの冗長イメージを分割して、新たな論理ボリュームを形成することが可能です。イメージを分割するには、lvconvert コマンドの --splitmirrors 引数を使用して、分割する冗長イメージの数を指定します。新たに分割する論理ボリュームの名前を指定するには、このコマンドの --name 引数を使用する必要があります。
以下のコマンドは、ミラー化論理ボリューム vg/lv から、copy という名前の新たな論理ボリュームを分割します。新しい論理ボリュームには 2 つのミラーレッグが含まれます。この例では、LVM は分割するデバイスを選択しています。
# lvconvert --splitmirrors 2 --name copy vg/lv
Copy to Clipboard Toggle word wrap
分割するデバイスを指定することが可能です。以下のコマンドは、ミラー化論理ボリューム vg/lv から copy という名前の新たな論理ボリュームを分割します。新しい論理ボリュームには、/dev/sdc1/dev/sde1 のデバイスで構成される、2 つのミラーレッグが含まれます。
# lvconvert --splitmirrors 2 --name copy vg/lv /dev/sd[ce]1
Copy to Clipboard Toggle word wrap
5.4.3.3. ミラー化論理ボリュームの修復
lvconvert --repair コマンドを使用すると、ディスク障害後にミラーを修復することができます。これによって、ミラーは整合性のある状態に戻ります。lvconvert --repair コマンドは、インタラクティブなコマンドで、障害のあるデバイスの置き換えをシステムが試みるようにしたいかどうかのプロンプトを表示します。
  • プロンプトをスキップして障害の発生したデバイスをすべて置き換えるには、コマンドライン上で -y オプションを指定します。
  • プロンプトをスキップして、障害の発生したデバイスを一切置き換えないようにするには、コマンドライン上で -f オプションを指定します。
  • プロンプトをスキップしつつ、ミラーイメージとミラーログを対象とする異なる置き換えポリシーを示すには、--use-policies 引数を指定して、lvm.conf ファイル内の mirror_log_fault_policymirror_device_fault_policy のパラメーターによって指定されているデバイス置き換えポリシーを使用することができます。
5.4.3.4. ミラー化ボリューム設定の変更
lvconvert コマンドを使用して論理ボリュームが含むミラーの数の増減を行うことができます。これにより、論理ボリュームをミラー化ボリュームからリニアボリュームに、またはリニアボリュームからミラー化ボリュームに変換できます。また、このコマンドを使用して、corelog などの既存の論理ボリュームの他のミラーパラメーターも再設定できます。
When you convert a linear volume to a mirrored volume, you are creating mirror legs for an existing volume. This means that your volume group must contain the devices and space for the mirror legs and for the mirror log.
ミラーレッグを 1 つ失うと、LVM はそのボリュームをリニアボリュームに変換して、ミラー冗長なしでもボリュームへのアクセスを可能にします。そのレッグを置き換えた後は、lvconvert コマンドを使用して、ミラーを復元できます。この手順は 「LVM ミラー障害からの回復」 で説明してあります。
以下のコマンドは、リニア論理ボリューム vg00/lvol1 をミラー化論理ボリュームに変換します。
# lvconvert -m1 vg00/lvol1
Copy to Clipboard Toggle word wrap
以下のコマンドは、ミラー化論理ボリューム vg00/lvol1 をリニア論理ボリュームに変換して、ミラーレッグを削除します。
# lvconvert -m0 vg00/lvol1
Copy to Clipboard Toggle word wrap
以下のコマンドは、既存の論理ボリューム vg00/lvol1 にミラーレッグを追加します。この例は、lvconvert コマンドがそのボリュームを 2 つのミラーレッグがあるボリュームに変更する前と後のボリュームの設定を示しています。
# lvs -a -o name,copy_percent,devices vg00
  LV                  Copy%  Devices
  lvol1               100.00 lvol1_mimage_0(0),lvol1_mimage_1(0)
  [lvol1_mimage_0]        /dev/sda1(0)
  [lvol1_mimage_1]        /dev/sdb1(0)
  [lvol1_mlog]            /dev/sdd1(0)
# lvconvert -m 2 vg00/lvol1
  vg00/lvol1: Converted: 13.0%
  vg00/lvol1: Converted: 100.0%
  Logical volume lvol1 converted.
# lvs -a -o name,copy_percent,devices vg00
  LV                  Copy%  Devices
  lvol1               100.00 lvol1_mimage_0(0),lvol1_mimage_1(0),lvol1_mimage_2(0)
  [lvol1_mimage_0]        /dev/sda1(0)
  [lvol1_mimage_1]        /dev/sdb1(0)
  [lvol1_mimage_2]        /dev/sdc1(0)
  [lvol1_mlog]            /dev/sdd1(0)
Copy to Clipboard Toggle word wrap

5.4.4. シンプロビジョニングされた論理ボリュームの作成

As of the Red Hat Enterprise Linux 6.4 release, logical volumes can be thinly provisioned. This allows you to create logical volumes that are larger than the available extents. Using thin provisioning, you can manage a storage pool of free space, known as a thin pool, which can be allocated to an arbitrary number of devices when needed by applications. You can then create devices that can be bound to the thin pool for later allocation when an application actually writes to the logical volume. The thin pool can be expanded dynamically when needed for cost-effective allocation of storage space.

注記

This section provides an overview of the basic commands you use to create and grow thinly-provisioned logical volumes. For detailed information on LVM thin provisioning as well as information on using the LVM commands and utilities with thinly-provisioned logical volumes, see the lvmthin(7) man page.

注記

シンボリュームはクラスターのノード間ではサポートされません。シンプールとそのすべてのシンボリュームは、1 つのクラスターノードでのみ排他的にアクティブ化する必要があります。
シンプロビジョニングされたボリュームを作成するには、以下のタスクを実行してください。
  1. vgcreate コマンドを使用して、ボリュームグループを作成します。
  2. lvcreate コマンドを使用して、シンプールを作成します。
  3. lvcreate コマンドを使用して、シンプール内にシンプロビジョニングされたボリュームを作成します。
lvcreate コマンドに -T (または --thin) オプションを使用して、シンプールまたはシンプロビジョニングされたボリュームを作成します。また、lvcreate コマンドの -T オプションを使用して、1 つのコマンドで同時にプール内にシンプールとシンプロビジョニングされたボリュームの両方を作成することも可能です。
以下のコマンドは、lvcreate コマンドに -T オプションを使用して、mythinpool と呼ばれるシンプールを作成します。これは、ボリュームグループ vg001 内にあり、サイズは 100M です。物理領域のプールを作成しているため、プールのサイズを指定する必要があります。lvcreate コマンドの -T オプションは引数を取りません。コマンドが指定する他のオプションから作成されるデバイスのタイプを推定します。
# lvcreate -L 100M -T vg001/mythinpool
  Rounding up size to full physical extent 4.00 MiB
  Logical volume "mythinpool" created
# lvs
  LV            VG     Attr     LSize   Pool Origin Data%  Move Log Copy% Convert
  my mythinpool vg001  twi-a-tz 100.00m               0.00
Copy to Clipboard Toggle word wrap
以下のコマンドは、lvcreate コマンドに -T オプションを使用して、シンプール vg001/mythinpoolthinvolume と呼ばれるシンプロビジョニングされたボリュームを作成します。ここでは、仮想サイズを指定して、ボリュームを含むプールよりも大きなボリュームの仮想サイズを指定している点に注意してください。
# lvcreate -V1G -T vg001/mythinpool -n thinvolume
  Logical volume "thinvolume" created
# lvs
  LV          VG       Attr     LSize   Pool       Origin Data%  Move Log Copy%  Convert
  mythinpool  vg001    twi-a-tz 100.00m                     0.00                        
  thinvolume  vg001    Vwi-a-tz   1.00g mythinpool          0.00
Copy to Clipboard Toggle word wrap
以下のコマンドは、lvcreate コマンドに -T オプションを使用して、プール内にシンプールとシンプロビジョニングされたボリュームを作成します。その際、lvcreate コマンドでサイズと仮想サイズの引数を指定します。また、このコマンドは、ボリュームグループ vg001 内に mythinpool と呼ばれるシンプールを作成し、そのプール内に thinvolume と呼ばれるシンプロビジョニングされたボリュームも作成します。
# lvcreate -L 100M -T vg001/mythinpool -V1G -n thinvolume
  Rounding up size to full physical extent 4.00 MiB
  Logical volume "thinvolume" created
# lvs
  LV           VG       Attr     LSize   Pool     Origin Data%  Move Log Copy%  Convert
  mythinpool   vg001    twi-a-tz 100.00m                   0.00                        
  thinvolume   vg001    Vwi-a-tz   1.00g mythinpool        0.00
Copy to Clipboard Toggle word wrap
また、lvcreate コマンドの --thinpool パラメーターを指定して、シンプールを作成することも可能です。-T オプションとは異なり、--thinpool パラメーターには作成しているシンプール論理ボリューム名の引数が必要です。以下の例は、lvcreate コマンドで --thinpool パラメーターを指定して、mythinpool と呼ばれるシンプールを作成します。これは、ボリュームグループ vg001 内にあり、サイズは 100M です。
# lvcreate -L 100M --thinpool mythinpool vg001
  Rounding up size to full physical extent 4.00 MiB
  Logical volume "mythinpool" created
# lvs
  LV          VG     Attr     LSize   Pool Origin Data%  Move Log Copy% Convert
  mythinpool  vg001  twi-a-tz 100.00m               0.00
Copy to Clipboard Toggle word wrap
プール作成用に、ストライピングはサポートされています。以下のコマンドは、2 つの 64 kB のストライプと 256 kB のチャンクサイズがあるボリュームグループ vg001 内に pool と呼ばれる 100M のシンプールを作成します。また、1T のシンプロビジョニングされたボリューム vg00/thin_lv も作成します。
# lvcreate -i 2 -I 64 -c 256 -L100M -T vg00/pool -V 1T --name thin_lv
Copy to Clipboard Toggle word wrap
lvextend コマンドを使用してシンプロビジョニングされたボリュームのサイズを拡張できます。ただし、シンプールのサイズを縮小することはできません。
以下のコマンドは、既存のシンプールのサイズ (100M) を変更し、100M 拡張します。
# lvextend -L+100M vg001/mythinpool
  Extending logical volume mythinpool to 200.00 MiB
  Logical volume mythinpool successfully resized
# lvs
  LV           VG       Attr     LSize   Pool     Origin Data%  Move Log Copy%  Convert
  mythinpool   vg001    twi-a-tz 200.00m                   0.00                        
  thinvolume   vg001    Vwi-a-tz   1.00g mythinpool          0.00
Copy to Clipboard Toggle word wrap
他の論理ボリュームのタイプと同様に、lvrename を使用してボリューム名の変更、lvremove を使用してボリュームの削除、lvslvdisplay のコマンドを使用してボリュームの情報の表示を行うことができます。
By default, the lvcreate command sets the size of the thin pool's metadata logical volume according to the formula (Pool_LV_size / Pool_LV_chunk_size * 64). You cannot currently resize the metadata volume, however, so if you expect significant growth of the size of thin pool at a later time you should increase this value with the --poolmetadatasize parameter of the lvcreate command. The supported value for the thin pool's metadata logical volume is in the range between 2MiB and 16GiB.
You can use the --thinpool parameter of the lvconvert command to convert an existing logical volume to a thin pool volume. When you convert an existing logical volume to a thin pool volume, you must use the --poolmetadata parameter in conjunction with the --thinpool parameter of the lvconvert to convert an existing logical volume to the thin pool volume's metadata volume.

注記

Converting a logical volume to a thin pool volume or a thin pool metadata volume destroys the content of the logical volume, since in this case the lvconvert does not preserve the content of the devices but instead overwrites the content.
The following example converts the existing logical volume lv1 in volume group vg001 to a thin pool volume and converts the existing logical volume lv2 in volume group vg001 to the metadata volume for that thin pool volume.
# lvconvert --thinpool vg001/lv1 --poolmetadata vg001/lv2
  Converted vg001/lv1 to thin pool.
Copy to Clipboard Toggle word wrap

5.4.5. スナップショットボリュームの作成

注記

As of the Red Hat Enterprise Linux 6.4 release, LVM supports thinly-provisioned snapshots. For information on creating thinly provisioned snapshot volumes, see 「シンプロビジョニングされたスナップショットボリュームの作成」.
スナップショットボリュームを作成するには、lvcreate コマンドで -s 引数を使用します。スナップショットボリュームは書き込み可能です。

注記

LVM スナップショットは、クラスター内のノード間ではサポートされていません。クラスター化されたボリュームグループ内にスナップショットボリュームは作成できません。ただし、Red Hat Enterprise Linux 6.1 リリースでは、クラスター化論理ボリューム上で恒常的なデータのバックアップ作成が必要な場合、ボリュームを排他的にアクティブ化した上で、スナップショットを作成することができます。ノード上における論理ボリュームの排他的なアクティブ化についての情報については、「クラスター内の個別ノード上の論理ボリュームのアクティブ化」 をご覧ください。

注記

Red Hat Enterprise Linux 6.1 リリースでは、ミラー化論理ボリュームを対象とした LVM スナップショットがサポートされています。
As of the Red Hat Enterprise Linux 6.3 release, snapshots are supported for RAID logical volumes. For information on RAID logical volumes, see 「RAID 論理ボリューム」.
As of the Red Hat Enterprise Linux 6.5 release, LVM does not allow you to create a snapshot volume that is larger than the size of the origin volume plus needed metadata for the volume. If you specify a snapshot volume that is larger than this, the system will create a snapshot volume that is only as large as will be needed for the size of the origin.
By default, a snapshot volume is skipped during normal activation commands. For information on controlling the activation of a snapshot volume, see 「Controlling Logical Volume Activation」.
以下のコマンドは、/dev/vg00/snap と言う名前の 100 MB のスナップショット論理ボリュームを作成します。これは、/dev/vg00/lvol1 と呼ばれる複製元となる論理ボリュームのスナップショットを作成します。複製元となる論理ボリュームに、ファイルシステムが含まれている場合、任意のディレクトリ上でスナップショット論理ボリュームをマウントして、そのファイルシステムのコンテンツにアクセスして、複製元のファイルシステムが更新を継続している間にバックアップを実行することができます。
# lvcreate --size 100M --snapshot --name snap /dev/vg00/lvol1
Copy to Clipboard Toggle word wrap
スナップショット論理ボリュームを作成した後に、lvdisplay コマンドで、複製元のボリュームを指定すると、すべてのスナップショット論理ボリュームとそのステータス (アクティブまたは非アクティブ) の一覧が出力されます。
以下の例は、論理ボリューム /dev/new_vg/lvol0 のステータスを示しています。これに対して、スナップショットボリューム /dev/new_vg/newvgsnap が作成されています。
# lvdisplay /dev/new_vg/lvol0
  --- Logical volume ---
  LV Name                /dev/new_vg/lvol0
  VG Name                new_vg
  LV UUID                LBy1Tz-sr23-OjsI-LT03-nHLC-y8XW-EhCl78
  LV Write Access        read/write
  LV snapshot status     source of
                         /dev/new_vg/newvgsnap1 [active]
  LV Status              available
  # open                 0
  LV Size                52.00 MB
  Current LE             13
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:2
Copy to Clipboard Toggle word wrap
デフォルトでは lvs コマンドは、元のボリュームと、各スナップショットボリューム用に使用されているスナップショットボリュームの現在のパーセンテージを表示します。以下の例は、論理ボリューム /dev/new_vg/lvol0 を含むシステム用の lvs コマンドのデフォルト出力を示しています。スナップショットボリューム /dev/new_vg/newvgsnap はこの論理ボリューム用に作成されています。
# lvs
  LV         VG     Attr   LSize  Origin Snap%  Move Log Copy%
  lvol0      new_vg owi-a- 52.00M
  newvgsnap1 new_vg swi-a-  8.00M lvol0    0.20
Copy to Clipboard Toggle word wrap

警告

複製元ボリュームが変更されると、スナップショットのサイズが拡大されるため、lvs コマンドを使用して、スナップショットボリュームのパーセンテージを定期的に監視して、満杯にならないように確認することが重要です。100% 満杯のスナップショットは、完全に消失します。これは、複製元ボリュームの無変更部分への書き込みが、スナップショットを破損せずには成功させることができないためです。
Red Hat Enterprise Linux 6.2 リリースでは、スナップショット関連の新機能が 2 つあります。1 つ目は、スナップショットが満杯になったときに無効になるスナップショットに加えて、そのスナップショットデバイスにマウントされているすべてのファイルシステムは強制的にマウント解除されます。これにより、マウントポイントへのアクセス時に必ず発生するファイルシステムエラーを防止しようとします。2 つ目は、lvm.conf ファイル内で snapshot_autoextend_threshold オプションを指定できるようになりました。このオプションによって、スナップショットの残りの領域がセットした閾値よりも小さくなると、常にスナップショットを自動的に拡張できるようになりました。これが機能するには、ボリュームグループ内に未割り当ての領域がなければなりません。
As of the Red Hat Enterprise Linux 6.5 release, LVM does not allow you to create a snapshot volume that is larger than the size of the origin volume plus needed metadata for the volume. Similarly, automatic extension of a snapshot will not increase the size of a snapshot volume beyond the maximum calculated size that is necessary for the snapshot. Once a snapshot has grown large enough to cover the origin, it is no longer monitored for automatic extension.
Information on setting snapshot_autoextend_threshold and snapshot_autoextend_percent is provided in the lvm.conf file itself. For information about the lvm.conf file, see 付録B LVM 設定ファイル.

5.4.6. シンプロビジョニングされたスナップショットボリュームの作成

The Red Hat Enterprise Linux release 6.4 version of LVM provides support for thinly-provisioned snapshot volumes. For information on the benefits and limitations of thin snapshot volumes, see 「シンプロビジョニングされたスナップショットボリューム」.

注記

This section provides an overview of the basic commands you use to create and grow thinly-provisioned snapshot volumes. For detailed information on LVM thin provisioning as well as information on using the LVM commands and utilities with thinly-provisioned logical volumes, see the lvmthin(7) man page.

重要

シンプロビジョニングされたスナップショットボリュームを作成する場合、ボリュームのサイズは指定しません。サイズのパラメーターを指定すると、作成されるスナップショットはシンプロビジョニングされたスナップショットボリュームにはならず、データ保管用にシンプールを使用することもありません。例えば、lvcreate -s vg/thinvolume -L10M のコマンドは、複製元ボリュームがシンボリュームであっても、シンスナップショットを作成しません。
Thin snapshots can be created for thinly-provisioned origin volumes. As of the Red Hat Enterprise Linux 6.5 release, thin snapshots can also be created for origin volumes that are not thinly-provisioned.
You can specify a name for the snapshot volume with the --name option of the lvcreate command. It is recommended that you use this option when creating a logical volume so that you can more easily see the volume you have created when you display logical volumes with the lvs command.
The following command creates a thinly-provisioned snapshot volume of the thinly-provisioned logical volume vg001/thinvolume that is named mysnapshot1.
# lvcreate -s --name mysnapshot1 vg001/thinvolume
  Logical volume "mysnapshot1" created
# lvs
  LV          VG       Attr     LSize   Pool       Origin     Data%  Move Log Copy%  Convert
  mysnapshot1 vg001    Vwi-a-tz   1.00g mythinpool thinvolume   0.00                        
  mythinpool  vg001    twi-a-tz 100.00m                         0.00                        
  thinvolume  vg001    Vwi-a-tz   1.00g mythinpool              0.00
Copy to Clipboard Toggle word wrap
シンプロビジョニングされたスナップショットボリュームには、他のシンボリュームと同じ特徴があります。ボリュームのアクティブ化、拡張、名前変更、削除、さらにはスナップショット作成も個別に行うことができます。
By default, a snapshot volume is skipped during normal activation commands. For information on controlling the activation of a snapshot volume, see 「Controlling Logical Volume Activation」.
As of the Red Hat Enterprise Linux 6.5 release, you can create a thinly-provisioned snapshot of a non-thinly-provisioned logical volume. Since the non-thinly-provisioned logical volume is not contained within a thinpool, it is referred to as an external origin. External origin volumes can be used and shared by many thinly-provisioned snapshot volumes, even from different thin pools. The external origin must be inactive and read-only at the time the thinly-provisioned snapshot is created.
To create a thinly-provisioned snapshot of an external origin, you must specify the --thinpool option. The following command creates a thin snapshot volume of the read-only inactive volume origin_volume. The thin snapshot volume is named mythinsnap. The logical volume origin_volume then becomes the thin external origin for the thin shapshot volume mythinsnap in volume group vg001 that will use the existing thin pool vg001/pool. Because the origin volume must be in the same volume group as the snapshot volume, you do not need to specify the volume group when specifying the origin logical volume.
# lvcreate -s --thinpool vg001/pool origin_volume --name mythinsnap
Copy to Clipboard Toggle word wrap
You can create a second thinly-provisioned snapshot volume of the first snapshot volume, as in the following command.
# lvcreate -s vg001/mythinsnap --name my2ndthinsnap
Copy to Clipboard Toggle word wrap

5.4.7. Creating LVM Cache Logical Volumes

As of the Red Hat Enterprise Linux 6.7 release, LVM provides full support for LVM cache logical volumes. A cache logical volume uses a small logical volume consisting of fast block devices (such as SSD drives) to improve the performance of a larger and slower logical volume by storing the frequently used blocks on the smaller, faster logical volume.
LVM caching uses the following LVM logical volume types. All of these associated logical volumes must be in the same volume group.
  • Origin logical volume — the large, slow logical volume
  • Cache pool logical volume — the small, fast logical volume, which is composed of two devices: the cache data logical volume, and the cache metadata logical volume
  • Cache data logical volume — the logical volume containing the data blocks for the cache pool logical volume
  • Cache metadata logical volume — the logical volume containing the metadata for the cache pool logical volume, which holds the accounting information that specifies where data blocks are stored (for example, on the origin logical volume or the cache data logical volume).
  • Cache logical volume — the logical volume containing the origin logical volume and the cache pool logical volume. This is the resultant usable device which encapsulates the various cache volume components.
The following procedure creates an LVM cache logical volume.
  1. Create a volume group that contains a slow physical volume and a fast physical volume. In this example. /dev/sde1 is a slow device and /dev/sdf1 is a fast device and both devices are contained in volume group VG.
    # pvcreate /dev/sde1
    # pvcreate /dev/sdf1
    # vgcreate VG /dev/sde1 /dev/sdf1
    Copy to Clipboard Toggle word wrap
  2. Create the origin volume. This example creates an origin volume named lv that is 4G in size and that consists of /dev/sde1, the slow physical volume.
    # lvcreate -L 4G -n lv VG /dev/sde1
    Copy to Clipboard Toggle word wrap
  3. Create the cache data logical volume. This logical volume will hold data blocks from the origin volume. The size of this logical volume is the size of the cache and will be reported as the size of the cache pool logical volume. This example creates the cache data volume named lv_cache. It is 2G in size and is contained on the fast device /dev/sdf1, which is part of the volume group VG.
    # lvcreate -L 2G -n lv_cache VG /dev/sdf1
    Copy to Clipboard Toggle word wrap
  4. Create the cache metadata logical volume. This logical volume will hold cache pool metadata. The ratio of the size of the cache data logical volume to the size of the cache metadata logical volume should be about 1000:1, with a minimum size of 8MiB for the cache metadata logical volume. This example creates the cache metadata volume named lv_cache_meta. It is 12M in size and is also contained on the fast device /dev/sdf1, which is part of the volume group VG.
    # lvcreate -L 12M -n lv_cache_meta VG /dev/sdf1
    Copy to Clipboard Toggle word wrap
  5. Create the cache pool logical volume by combining the cache data and the cache metadata logical volumes into a logical volume of type cache-pool. You can set the behavior of the cache pool in this step; in this example the cachemode argument is set to writethrough, which indicates that a write is considered complete only when it has been stored in both the cache pool logical volume and on the origin logical volume.
    When you execute this command, the cache data logical volume is renamed with _cdata appended to the original name of the cache data logical volume, and the cache metadata logical volume is renamed with _cmeta appended to the original name of the cache data logical volume; both of these volumes become hidden.
    # lvconvert --type cache-pool --cachemode writethrough --poolmetadata VG/lv_cache_meta VG/lv_cache
      WARNING: Converting logical volume VG/lv_cache and VG/lv_cache_meta to pool's data and metadata volumes.
      THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
      Converted VG/lv_cache to cache pool.
    # lvs -a -o +devices
      LV               VG  Attr       LSize   Pool Origin Data%  Meta% Cpy%Sync Devices
      lv               VG  -wi-a-----   4.00g                                   /dev/sde1(0)
      lv_cache         VG  Cwi---C---   2.00g                                   lv_cache_cdata(0)
      [lv_cache_cdata] VG  Cwi-------   2.00g                                   /dev/sdf1(0)
      [lv_cache_cmeta] VG  ewi-------  12.00m                                   /dev/sdf1(512)
      [lvol0_pmspare]  VG  ewi-------  12.00m                                   /dev/sde1(1024)
    
    Copy to Clipboard Toggle word wrap
  6. Create the cache logical volume by combining the cache pool logical volume with the origin logical volume. The user-accessible cache logical volume takes the name of the origin logical volume. The origin logical volume becomes a hidden logical volume with _corig appended to the original name. You can execute this command when the origin logical volume is in use.
    # lvconvert --type cache --cachepool VG/lv_cache VG/lv
      Logical volume VG/lv is now cached.
    # lvs -a -o +devices
      LV                VG  Attr       LSize   Pool       Origin            Data%  Meta% Cpy%Sync Devices
      lv                VG  Cwi-a-C---   4.00g [lv_cache] [lv_corig] 0.02   2.31  0.00            lv_corig(0)
      [lv_corig]        VG  owi-aoC---   4.00g                                                    /dev/sde1(0)
      [lv_cache]        VG  Cwi---C---   2.00g                              0.02   2.31  0.00     lv_cache_cdata(0)
      [lv_cache_cdata]  VG  Cwi-ao----   2.00g                                                    /dev/sdf1(0)
      [lv_cache_cmeta]  VG  ewi-ao----  12.00m                                                    /dev/sdf1(512)
      [lvol0_pmspare]   VG  ewi-------  12.00m                                                    /dev/sde1(1024)
    
    Copy to Clipboard Toggle word wrap
For further information on LVM cache volumes, including additional administrative examples, see the lvmcache(7) man page.

5.4.8. スナップショットボリュームのマージ

Red Hat Enterprise Linux 6 リリースでは、lvconvert コマンドの --merge オプションを使用して、スナップショットを複製元のボリュームにマージすることができます。複製元とスナップショットボリュームの両方が開いている状態でなければ、マージは直ちに開始します。そうでない場合は、複製元もしくはスナップショットのいずれかがアクティブ化されており、かつ両方が閉じた状態で初めてマージが開始します。root ファイルシステムのように、閉じることができない複製元へのスナップショットのマージは、次回複製元ボリュームがアクティブ化されるまで先延ばしされます。マージが開始すると、結果として作成される論理ボリュームには、複製元の名前、マイナーナンバー、UUID が付けられます。マージの進行中は、複製元の読み取りまたは書き込みはマージ中のスナップショットにダイレクトされているように見えます。マージが完了すると、マージされたスナップショットは削除されます。
以下のコマンドは、スナップショットボリューム vg00/lvol1_snap をその複製元にマージします。
# lvconvert --merge vg00/lvol1_snap
Copy to Clipboard Toggle word wrap
コマンドライン上で複数のスナップショットを指定したり、LVM オブジェクトタグを使用して複数のスナップショットをそれぞれの複製元にマージしたりすることが可能です。以下の例では、論理ボリューム vg00/lvol1vg00/lvol2 および vg00/lvol3 はすべて、@some_tag でタグ付けされます。以下のコマンドは、3 つすべてのボリュームのスナップショット論理ボリュームを連続的にマージします。vg00/lvol1vg00/lvol2vg00/lvol3 の順で行われます。--background オプションを使用している場合は、すべてのスナップショット論理ボリュームのマージが並行して開始されます。
# lvconvert --merge @some_tag
Copy to Clipboard Toggle word wrap
LVM オブジェクトのタグ付けに関する情報は、付録D LVM オブジェクトタグ をご覧ください。lvconvert --merge コマンドについては、lvconvert(8) の man ページをご覧ください。

5.4.9. 永続的なデバイス番号

メジャーデバイス番号とマイナーデバイス番号はモジュールのロード時に動的に割り当てられます。一部のアプリケーションは、ブロックデバイスが常に同じデバイス (メジャーとマイナー) 番号でアクティブ化されている場合に、最も良く機能します。これらは lvcreatelvchange コマンドで、以下の引数を使用することによって指定できます。
--persistent y --major major --minor minor
Copy to Clipboard Toggle word wrap
大きなマイナー番号を使用して、その番号が既に別のデバイスに動的に割り当てられていないようにします。
NFS を使用してファイルシステムをエクスポートする場合は、そのエクスポートファイルで fsid パラメーターを指定すると、LVM 内で永続的なデバイス番号をセットする必要がなくなります。

5.4.10. 論理ボリュームグループのパラメーター変更

論理ボリュームのパラメーターを変更するには、lvchange コマンドを使用します。変更可能なパラメーターの一覧は、lvchange(8) の man ページを参照してください。
lvchange コマンドを使用して論理ボリュームのアクティブ化と非アクティブ化ができます。ボリュームグループ内のすべての論理ボリュームのアクティブ化と非アクティブ化を同時に行うには、「ボリュームグループのパラメーター変更」 で説明してあるように vgchange コマンドを使用します。
以下のコマンドは、ボリュームグループ vg00 内のボリューム lvol1 のパーミッションを読み取り専用に変更します。
# lvchange -pr vg00/lvol1
Copy to Clipboard Toggle word wrap

5.4.11. 論理ボリュームの名前変更

既存の論理ボリューム名を変更するには、lvrename コマンドを使用します。
以下のいずれかのコマンドも、ボリュームグループ vg02 内の論理ボリューム lvold の名前を lvnew に変更します。
# lvrename /dev/vg02/lvold /dev/vg02/lvnew
Copy to Clipboard Toggle word wrap
# lvrename vg02 lvold lvnew
Copy to Clipboard Toggle word wrap
Renaming the root logical volume requires additional reconfiguration. For information on renaming a root volume, see How to rename root volume group or logical volume in Red Hat Enterprise Linux.
クラスター内の個別ノード上での論理ボリュームのアクティブ化に関する情報は 「クラスター内の個別ノード上の論理ボリュームのアクティブ化」 をご覧ください。

5.4.12. 論理ボリュームの削除

アクティブでない論理ボリュームを削除するには、lvremove コマンドを使用します。論理ボリュームが現在マウントされている場合は、削除する前にボリュームをアンマウントしてください。また、クラスター化環境では削除前に論理ボリュームを非アクティブ化しておく必要があります。
以下のコマンドは、論理ボリューム /dev/testvg/testlv をボリュームグループ testvg から削除します。このケースでは、論理ボリュームは非アクティブ化されていないことに注意してください。
# lvremove /dev/testvg/testlv
Do you really want to remove active logical volume "testlv"? [y/n]: y
  Logical volume "testlv" successfully removed
Copy to Clipboard Toggle word wrap
lvchange -an コマンドの使用で、削除する前に明示的に論理ボリュームを非アクティブ化することができます。この場合、アクティブな論理ボリュームを削除したいかどうかを確認するプロンプトは表示されません。

5.4.13. 論理ボリュームの表示

LVM 論理ボリュームのプロパティを表示するのに使用できるコマンドは 3 つあります。lvslvdisplay、および lvscan です。
lvs コマンドは、論理ボリューム情報を設定可能な形式で提供して、1 つの論理ボリュームにつき 1 行ずつ表示します。lvs コマンドは豊富な書式制御を提供するため、スクリプティングに役立ちます。出力をカスタマイズするための lvs コマンドの使用に関する情報は 「LVM 用のカスタム報告」 をご覧ください。
lvdisplay コマンドは、固定した形式で、論理ボリュームのプロパティ (サイズ、レイアウト、マッピングなど) を表示します。
以下のコマンドは、vg00 内にある lvol2 の属性を示しています。スナップショット論理ボリュームがこのオリジナル論理ボリューム用に作成されている場合、このコマンドはすべてのスナップショット論理ボリュームとそのステータス (アクティブまたは非アクティブ) の一覧も表示します。
# lvdisplay -v /dev/vg00/lvol2
Copy to Clipboard Toggle word wrap
lvscan コマンドは、システム内のすべての論理ボリュームをスキャンし、以下の例のように一覧表示します。
# lvscan
 ACTIVE                   '/dev/vg0/gfslv' [1.46 GB] inherit
Copy to Clipboard Toggle word wrap

5.4.14. 論理ボリュームの拡張

論理ボリュームのサイズを拡張するには、lvextend コマンドを使用します。
論理ボリュームを拡張する場合、そのボリュームの追加容量もしくは拡張後のサイズを指定することができます。
以下のコマンドは、論理ボリューム /dev/myvg/homevol を 12 ギガバイトに拡張します。
# lvextend -L12G /dev/myvg/homevol 
lvextend -- extending logical volume "/dev/myvg/homevol" to 12 GB
lvextend -- doing automatic backup of volume group "myvg"
lvextend -- logical volume "/dev/myvg/homevol" successfully extended
Copy to Clipboard Toggle word wrap
以下のコマンドは、論理ボリューム /dev/myvg/homevol にさらに 1 ギガバイトを追加します。
# lvextend -L+1G /dev/myvg/homevol
lvextend -- extending logical volume "/dev/myvg/homevol" to 13 GB
lvextend -- doing automatic backup of volume group "myvg"
lvextend -- logical volume "/dev/myvg/homevol" successfully extended
Copy to Clipboard Toggle word wrap
lvcreate コマンドと同様に、lvextend コマンドで -l 引数を使用すると、論理ボリュームの拡張サイズをエクステント数で指定することができます。また、この引数を使用してボリュームグループのパーセンテージ、またはボリュームグループ内の残りの空き領域をパーセンテージで指定することもできます。以下のコマンドは、testlv と言う論理ボリュームを拡張して、ボリュームグループ myvg 内の未割り当て領域をすべて満たすようにします。
# lvextend -l +100%FREE /dev/myvg/testlv
  Extending logical volume testlv to 68.59 GB
  Logical volume testlv successfully resized
Copy to Clipboard Toggle word wrap
論理ボリュームを拡張した後は、それに適合するようにファイルシステムのサイズも拡張する必要があります。
デフォルトでは、ほとんどのファイルシステムサイズ変更ツールは、ファイルシステムのサイズを配下の論理ボリュームのサイズに拡大するので、2 つのコマンドそれぞれで同じサイズを指定する必要はありません。
5.4.14.1. ストライプ化ボリュームの拡張
ストライプ化論理ボリュームのサイズを拡大するには、ボリュームグループを構成している配下の物理ボリュームに、ストライプをサポートするための十分な空き領域がなければなりません。例えば、ボリュームグループ全域を使用してしまう 2 方向ストライプがある場合、ボリュームグループに 1 つの物理ボリュームを追加しただけでは、ストライプの拡張ができるようにはなりません。そのためには、少なくとも 2 つの物理ボリュームをボリュームグループに追加する必要があります。
例えば、以下の vgs コマンドで表示された、2 つの配下の物理ボリュームで構成されるボリュームグループ vg について考えてみましょう。
# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg     2   0   0 wz--n- 271.31G 271.31G
Copy to Clipboard Toggle word wrap
ボリュームグループのすべての領域を使用してストライプを作成することができます。
# lvcreate -n stripe1 -L 271.31G -i 2 vg
  Using default stripesize 64.00 KB
  Rounding up size to full physical extent 271.31 GB
  Logical volume "stripe1" created
# lvs -a -o +devices
  LV      VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  stripe1 vg   -wi-a- 271.31G                               /dev/sda1(0),/dev/sdb1(0)
Copy to Clipboard Toggle word wrap
ボリュームグループには、空き領域がなくなったことに注意してください。
# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg     2   1   0 wz--n- 271.31G    0
Copy to Clipboard Toggle word wrap
以下のコマンドにより、ボリュームグループにもう1つの物理ボリュームが追加されて、135G の追加領域が提供されます。
# vgextend vg /dev/sdc1
  Volume group "vg" successfully extended
# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg     3   1   0 wz--n- 406.97G 135.66G
Copy to Clipboard Toggle word wrap
この時点では、ストライプ化論理ボリュームをボリュームグループの最大サイズまで拡大することはできません。データをストライプ化するのには配下のデバイスが 2 つ必要です。
# lvextend vg/stripe1 -L 406G
  Using stripesize of last segment 64.00 KB
  Extending logical volume stripe1 to 406.00 GB
  Insufficient suitable allocatable extents for logical volume stripe1: 34480 
more required
Copy to Clipboard Toggle word wrap
ストライプ化論理ボリュームを拡張するには、もう 1 つの物理ボリュームを追加してから、論理ボリュームを拡張します。この例では、ボリュームグループに 2 つの物理ボリュームを追加することにより、論理ボリュームをボリュームグループの最大サイズまで拡張できるようになっています。
# vgextend vg /dev/sdd1
  Volume group "vg" successfully extended
# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg     4   1   0 wz--n- 542.62G 271.31G
# lvextend vg/stripe1 -L 542G
  Using stripesize of last segment 64.00 KB
  Extending logical volume stripe1 to 542.00 GB
  Logical volume stripe1 successfully resized
Copy to Clipboard Toggle word wrap
ストライプ化論理ボリュームを拡張するのに十分な配下の物理デバイスがない場合でも、その拡張部分がストライプ化されなくても問題がないならば、ボリュームの拡張は可能です。ただし、これによってパフォーマンスにむらがでる可能性があります。論理ボリュームに領域を追加する場合、デフォルトの動作では、既存論理ボリュームの最後のセグメントと同じストライプパラメーターを使用するようになっていますが、これらのパラメーターはオーバーライドすることができます。以下の例では、初回の lvextend コマンドが失敗した後に、既存のストライプ化論理ボリュームを拡張して残りの空き領域を使用するようにしています。
# lvextend vg/stripe1 -L 406G
  Using stripesize of last segment 64.00 KB
  Extending logical volume stripe1 to 406.00 GB
  Insufficient suitable allocatable extents for logical volume stripe1: 34480 
more required
# lvextend -i1 -l+100%FREE vg/stripe1
Copy to Clipboard Toggle word wrap
5.4.14.2. ミラー化ボリュームの拡張
Red Hat Enterprise Linux 6.3 リリースでは、新しいミラーリージョンの同期を実行しなくても lvextend コマンドでミラー化論理ボリュームを拡張することができます。
lvcreate コマンドでミラー化論理ボリュームを作成する場合、--nosync オプションを指定すると、ミラー作成時にミラーリージョンは同期されません。詳細は、「ミラー化ボリュームの作成」 を参照してください。後ほど --nosync オプションを使用して作成したミラーを拡張する場合も、ミラーの拡張部分は同期されません。
--nosync オプションを使用して既存の論理ボリュームが作成されたかどうかを決定するには、lvs コマンドを使用して論理ボリュームの属性を表示します。論理ボリュームが初期同期を行わずに作成されたミラー化ボリュームの場合、その論理ボリュームには「M」の属性ビット 1 が設定されます。論理ボリュームが初期同期により作成された場合は、「m」の属性ビット 1 が設定されます。
The following command displays the attributes of a mirrored logical volume named lv that was created without initial synchronization, showing attribute bit 1 as "M". Attribute bit 7 is "m", indicating a target type of mirror. For information on the meaning of the attribute bits, see 表5.4「lvs 表示フィールド」.
# lvs vg
  LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   Mwi-a-m- 5.00g                         lv_mlog 100.00
Copy to Clipboard Toggle word wrap
このミラー化論理ボリュームを lvextend コマンドで拡張する場合、ミラーの拡張部分は再同期されません。
lvcreate コマンドで --nosync オプションを指定せずにミラー化論理ボリュームを作成した場合、lvextend コマンドで --nosync オプションを指定することでミラーを再同期することなく論理ボリュームを拡張することができます。
以下の例では、--nosync オプションなしに作成された論理ボリュームを拡張し、ミラーの作成時にそれが同期されたことを示しています。ただし、この例では、ボリュームの拡張時にミラーが同期されていないことを示しています。ボリュームには「m」の属性が設定されていますが、lvextend コマンドに --nosync オプションを付けて実行すると、ボリュームには「M」の属性が設定されることに注意してください。
# lvs vg
  LV   VG   Attr     LSize  Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   mwi-a-m- 20.00m                         lv_mlog 100.00        
# lvextend -L +5G vg/lv --nosync
  Extending 2 mirror images.
  Extending logical volume lv to 5.02 GiB
  Logical volume lv successfully resized
# lvs vg
  LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   Mwi-a-m- 5.02g                         lv_mlog 100.00
Copy to Clipboard Toggle word wrap
ミラーが非アクティブの場合、ミラーの拡張時に同期はが自動的に省略されます。これは、--nosync オプションを指定してミラーを作成する場合でも当てはまります。その代わりに、論理ボリュームの拡張部分を完全に再同期するかどうかがプロンプトされます。

注記

ミラーがリカバリを行う場合、--nosync オプションを指定してボリュームの作成/拡張を行うと、ミラー化論理ボリュームを拡張することはできません。ただし、--nosync オプションを指定しないと、リカバリ中にミラーを拡張できます。
5.4.14.3. cling 割り当てポリシーを使用した論理ボリュームの拡張
LVM ボリュームを拡張する際には、lvextend コマンドの --alloc cling オプションを使用して、cling 割り当てポリシーを指定することができます。このポリシーによって、同一の物理ボリューム上のスペースが、既存の論理ボリュームの最終セグメントとして選択されます。物理ボリューム上に十分なスペースがなく、タグの一覧が lvm.conf ファイル内で定義されている場合には、LVM は、その物理ボリュームにいずれかのタグが付けられているかを確認し、既存エクステントと新規エクステント間で、物理ボリュームのタグを適合させようとします。
例えば、ご使用の論理ボリュームが、単一のボリュームグループ内の 2 サイト間でミラーリングされている場合、それらの場所に応じて、物理ボリュームにタグ付けすることができます。これには、物理ボリュームに @site1 や @site2 というタグを付けて、lvm.conf ファイル内に以下の行を指定します:
cling_tag_list = [ "@site1", "@site2" ]
Copy to Clipboard Toggle word wrap
物理ボリュームのタグ付けに関する情報は、付録D LVM オブジェクトタグ をご覧ください。
以下の例では、lvm.conf ファイルが変更されて、次のような行が追加されています。
cling_tag_list = [ "@A", "@B" ]
Copy to Clipboard Toggle word wrap
また、この例では、/dev/sdb1/dev/sdc1/dev/sdd1/dev/sde1/dev/sdf1/dev/sdg1、および /dev/sdh1 の物理ボリュームで構成されるボリュームグループ taft が作成されています。これらの物理ボリュームは、AB、および C のタグが付けられています。この例では、C のタグは使用されていませんが、LVM がタグを使用して、ミラーレッグに使用する物理ボリュームを選択することを示しています。
# pvs -a -o +pv_tags /dev/sd[bcdefgh]1
  PV         VG   Fmt  Attr PSize   PFree   PV Tags
  /dev/sdb1  taft lvm2 a-   135.66g 135.66g A
  /dev/sdc1  taft lvm2 a-   135.66g 135.66g B
  /dev/sdd1  taft lvm2 a-   135.66g 135.66g B
  /dev/sde1  taft lvm2 a-   135.66g 135.66g C
  /dev/sdf1  taft lvm2 a-   135.66g 135.66g C
  /dev/sdg1  taft lvm2 a-   135.66g 135.66g A
  /dev/sdh1  taft lvm2 a-   135.66g 135.66g A
Copy to Clipboard Toggle word wrap
以下のコマンドは、ボリュームグループ taft から 100GB のミラー化ボリュームを作成します。
# lvcreate -m 1 -n mirror --nosync -L 100G taft
Copy to Clipboard Toggle word wrap
以下のコマンドは、ミラーレッグおよびミラーログに使用されるデバイスを表示します。
# lvs -a -o +devices
  LV                VG        Attr   LSize   Log         Copy%  Devices
  mirror            taft      Mwi-a- 100.00g mirror_mlog 100.00
mirror_mimage_0(0),mirror_mimage_1(0)
  [mirror_mimage_0] taft      iwi-ao 100.00g                    /dev/sdb1(0)
  [mirror_mimage_1] taft      iwi-ao 100.00g                    /dev/sdc1(0)
  [mirror_mlog]     taft      lwi-ao   4.00m                    /dev/sdh1(0)
Copy to Clipboard Toggle word wrap
以下のコマンドは、ミラー化ボリュームのサイズを拡張します。cling 割り当てポリシーを使用して、同じタグが付いた物理ボリュームを使用してミラーレッグが拡張される必要があることを示します。
# lvextend --alloc cling -L +100G taft/mirror
  Extending 2 mirror images.
  Extending logical volume mirror to 200.00 GiB
  Logical volume mirror successfully resized
Copy to Clipboard Toggle word wrap
以下に表示したコマンドは、レッグとして同一のタグが付いた物理ボリュームを使用してミラーレッグが拡張されているのを示しています。C のタグが付いた物理ボリュームは無視される点に注意してください。
# lvs -a -o +devices
  LV                VG        Attr   LSize   Log         Copy%  Devices
  mirror            taft      Mwi-a- 200.00g mirror_mlog  50.16
mirror_mimage_0(0),mirror_mimage_1(0)
  [mirror_mimage_0] taft      Iwi-ao 200.00g                    /dev/sdb1(0)
  [mirror_mimage_0] taft      Iwi-ao 200.00g                    /dev/sdg1(0)
  [mirror_mimage_1] taft      Iwi-ao 200.00g                    /dev/sdc1(0)
  [mirror_mimage_1] taft      Iwi-ao 200.00g                    /dev/sdd1(0)
  [mirror_mlog]     taft      lwi-ao   4.00m                    /dev/sdh1(0)
Copy to Clipboard Toggle word wrap

5.4.15. 論理ボリュームの縮小

You can reduce the size of a logical volume with the lvreduce command.

注記

Shrinking is not supported on a GFS2 or XFS file system, so you cannot reduce the size of a logical volume that contains a GFS2 or XFS file system.
If the logical volume you are reducing contains a file system, to prevent data loss you must ensure that the file system is not using the space in the logical volume that is being reduced. For this reason, it is recommended that you use the --resizefs option of the lvreduce command when the logical volume contains a file system. When you use this option, the lvreduce command attempts to reduce the file system before shrinking the logical volume. If shrinking the file sytem fails, as can occur if the file system is full or the file system does not support shrinking, then the lvreduce command will fail and not attempt to shrink the logical volume.

警告

In most cases, the lvreduce command warns about possible data loss and asks for a confirmation. However, you should not rely on these confirmation prompts to prevent data loss because in some cases you will not see these prompts, such as when the logical volume is inactive or the --resizefs option is not used.
Note that using the --test option of the lvreduce command does not indicate where the operation is safe, as this option does not check the file system or test the file system resize.
The following command shrinks the logical volume lvol1 in volume group vg00 to be 64 megabytes. In this example, lvol1 contains a file system, which this command resizes together with the logical volume. This example shows the output to the command.
# lvreduce --resizefs -L 64M vg00/lvol1
fsck from util-linux 2.23.2
/dev/mapper/vg00-lvol1: clean, 11/25688 files, 8896/102400 blocks
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/mapper/vg00-lvol1 to 65536 (1k) blocks.
The filesystem on /dev/mapper/vg00-lvol1 is now 65536 blocks long.

  Size of logical volume vg00/lvol1 changed from 100.00 MiB (25 extents) to 64.00 MiB (16 extents).
  Logical volume vg00/lvol1 successfully resized.
Copy to Clipboard Toggle word wrap
Specifying the - sign before the resize value indicates that the value will be subtracted from the logical volume's actual size. The following example shows the command you would use if, instead of shrinking a logical volume to an absolute size of 64 megabytes, you wanted to shrink the volume by a value 64 megabytes.
# lvreduce --resizefs -L -64M vg00/lvol1
Copy to Clipboard Toggle word wrap

5.4.16. RAID 論理ボリューム

Red Hat Enterprise Linux 6.3 リリースでは、LVM は RAID4/5/6 およびミラーリングの新実装をサポートしています。最新のミラーリングの実装と以前のミラーリングの実装 (「ミラー化ボリュームの作成」 で説明) が異なる点は以下のとおりです。
  • ミラーリングの新実装でのセグメントタイプは raid1 です。以前の実装でのセグメントタイプは mirror です。
  • RAID 4/5/6 実装のように、ミラーリングの新実装は MD ソフトウェア RAID を活用します。
  • ミラーリングの新実装は、各ミラーイメージの完全な冗長性を備えたビットマップ領域を管理することで、そのフォルト処理機能を拡大します。これは、このセグメントタイプで作成されるミラーには --mirrorlog--corelog オプションはないことを意味しています。
  • ミラーリングの新実装は、一時的な障害を処理することができます。
  • ミラーイメージはアレイから一時的に離して、後ほどそれとマージしなおすことができます。
  • ミラーリングの新実装はスナップショットをサポートします (レベルの高い RAID の新実装も同様)。
  • RAID の新実装はクラスター対応ではありません。クラスター化ボリュームグループ内で LVM RAID 論理ボリュームを作成することはできません。
For information on how failures are handled by the RAID logical volumes, see 「RAID フォルトポリシーの設定」.
このセクションの残りでは、LVM RAID デバイスで実行できる以下の管理タスクについて説明しています。
5.4.16.1. RAID 論理ボリュームの作成
RAID 論理ボリュームを作成するには、lvcreate コマンドの --type 引数として raid タイプを指定します。通常、lvcreate コマンドを使用して論理ボリュームを作成する場合、--type 引数は暗黙的です。例えば、-i stripes 引数を指定する場合、lvcreate コマンドは --type stripe オプションを想定します。-m mirrors 引数を指定する場合は、lvcreate コマンドは --type mirror オプションを想定します。ただし、RAID 論理ボリュームを作成する場合は、任意のセグメントタイプを明示的に指定する必要があります。可能な RAID のセグメントタイプは 表5.1「RAID のセグメントタイプ」 に記載されています。
Expand
表5.1 RAID のセグメントタイプ
セグメントタイプ説明
raid1RAID1 ミラーリング
raid4RAID4 専用のパリティディスク
raid5raid5_ls と同様
raid5_la
RAID5 左非対称
パリティ 0 をローテートしてデータを継続
raid5_ra
RAID5 右非対称
パリティ N をローテートしてデータを継続
raid5_ls
RAID5 左対称
パリティ 0 をローテートしてデータを再起動
raid5_rs
RAID5 右対称
パリティ N をローテートしてデータを再起動
raid6raid6_zr と同様
raid6_zr
RAID6 ゼロの再起動
パリティゼロを (左から右に) ローテートしてデータを再起動
raid6_nr
RAID6 N 再起動
パリティ N を (左から右に) ローテートしてデータを再起動
raid6_nc
RAID6 N 継続
パリティ N を (左から右に) ローテートしてデータを継続
raid10 (Red Hat Enterprise Linux 6.4 以降)
ストライプ化ミラー
ミラーセットのストライピング
For most users, specifying one of the five available primary types (raid1, raid4, raid5, raid6, raid10) should be sufficient. For more information on the different algorithms used by RAID 5/6, see chapter four of the 『Common RAID Disk Data Format Specification』 at http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf.
RAID 論理ボリュームを作成する場合、LVM は、各データまたはアレイ内のパリティサブボリュームごとに、サイズが 1 エクステントのメタデータサブボリュームを作成します。例えば、2 方向の RAID1 アレイを作成すると、2 つのメタデータサブボリューム (lv_rmeta_0 および lv_rmeta_1) と 2 つのデータサブボリューム (lv_rimage_0 および lv_rimage_1) が生じます。同様に、3 方向のストライプ (プラス、1 つの暗黙的なパリティデバイス) RAID4 を作成すると、4 つのメタデータサブボリューム (lv_rmeta_0lv_rmeta_1lv_rmeta_2、および lv_rmeta_3) と 4 つのデータサブボリューム (lv_rimage_0lv_rimage_1lv_rimage_2、および lv_rimage_3) が生じます。
以下のコマンドは、ボリュームグループ my_vg 内にサイズが 1G の my_lv と呼ばれる 2 方向の RAID1 アレイを作成します。
# lvcreate --type raid1 -m 1 -L 1G -n my_lv my_vg
Copy to Clipboard Toggle word wrap
-m 引数に指定する値に沿って、異なる数のコピーで RAID1 アレイを作成することができます。-m 引数は、以前のミラー実装用のコピー数を指定するために使用される同じ引数ですが、この場合はセグメントタイプを raid1 と明示的に指定することで、デフォルトのセグメントタイプ mirror を上書きします。同様に、-i argument を使用して RAID 4/5/6 論理ボリュームのストライプ数を指定して、デフォルトのセグメントタイプを任意の RAID タイプで上書きします。また、ストライプサイズも -I 引数で指定できます。

注記

デフォルトのミラーセグメントタイプを raid1 にセットするには、lvm.conf ファイルの mirror_segtype_default を変更します。
以下のコマンドは、ボリュームグループ my_vg 内のサイズが 1G の my_lv と呼ばれる RAID5 アレイ (3 つのストライプ + 1 つの暗黙的なパリティドライブ) を作成します。ストライプ数の指定は、LVM ストライプ化ボリュームに対して指定するのと同じように行います。パリティドライブの正確な数は自動的に追加されます。
# lvcreate --type raid5 -i 3 -L 1G -n my_lv my_vg
Copy to Clipboard Toggle word wrap
以下のコマンドは、ボリュームグループ my_vg 内にサイズが 1G の my_lv と呼ばれる RAID6 アレイ (3 つのストライプ + 2 つの暗黙的なパリティドライブ) を作成します。
# lvcreate --type raid6 -i 3 -L 1G -n my_lv my_vg
Copy to Clipboard Toggle word wrap
LVM によって RAID 論理ボリュームを作成した後には、ボリュームのアクティブ化、変更、削除、表示、使用を他の LVM 論理ボリュームと同じように行うことができます。
When you create RAID10 logical volumes, the background I/O required to initialize the logical volumes with a sync operation can crowd out other I/O operations to LVM devices, such as updates to volume group metadata, particularly when you are creating many RAID logical volumes. This can cause the other LVM operations to slow down.
As of Red Hat Enterprise Linux 6.5, you can control the rate at which a RAID logical volume is initialized by implementing recovery throttling. You control the rate at which sync operations are performed by setting the minimum and maximum I/O rate for those operations with the --minrecoveryrate and --maxrecoveryrate options of the lvcreate command. You specify these options as follows.
  • --maxrecoveryrate Rate[bBsSkKmMgG]
    Sets the maximum recovery rate for a RAID logical volume so that it will not crowd out nominal I/O operations. The Rate is specified as an amount per second for each device in the array. If no suffix is given, then kiB/sec/device is assumed. Setting the recovery rate to 0 means it will be unbounded.
  • --minrecoveryrate Rate[bBsSkKmMgG]
    Sets the minimum recovery rate for a RAID logical volume to ensure that I/O for sync operations achieves a minimum throughput, even when heavy nominal I/O is present. The Rate is specified as an amount per second for each device in the array. If no suffix is given, then kiB/sec/device is assumed.
The following command creates a 2-way RAID10 array with 3 stripes that is 10G is size with a maximum recovery rate of 128 kiB/sec/device. The array is named my_lv and is in the volume group my_vg.
lvcreate --type raid10 -i 2 -m 1 -L 10G --maxrecoveryrate 128 -n my_lv my_vg
Copy to Clipboard Toggle word wrap
You can also specify minimum and maximum recovery rates for a RAID scrubbing operation. For information on RAID scrubbing, see 「Scrubbing a RAID Logical Volume」.
5.4.16.2. リニアデバイスの RAID デバイスへの変換
既存のリニア論理ボリュームを RAID デバイスに変換するには、lvconvert コマンドの --type 引数を使用します。
以下のコマンドは、ボリュームグループ my_vg 内のリニア論理ボリューム my_lv を 2 方向の RAID1 アレイに変換します。
# lvconvert --type raid1 -m 1 my_vg/my_lv
Copy to Clipboard Toggle word wrap
RAID 論理ボリュームはメタデータとデータサブボリュームのペアで構成されているため、リニアデバイスを RAID1 アレイに変換すると、新しいメタデータサブボリュームが作成され、リニアボリュームが存在する同じ物理ボリューム上の複製元の論理ボリュームに関連付けられます。メタデータ/データサブボリュームのペアにイメージが追加されます。例えば、複製元のデバイスは以下のとおりです。
# lvs -a -o name,copy_percent,devices my_vg
  LV     Copy%  Devices     
  my_lv         /dev/sde1(0)
Copy to Clipboard Toggle word wrap
2 方向の RAID1 アレイへの変換後、デバイスには以下のデータとメタデータサブボリュームのペアが含まれます。
# lvconvert --type raid1 -m 1 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            6.25   my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(0)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(256)               
  [my_lv_rmeta_1]         /dev/sdf1(0)
Copy to Clipboard Toggle word wrap
複製元の論理ボリュームとペアのメタデータイメージを同じ物理ボリュームに配置できない場合、lvconvert は失敗します。
5.4.16.3. LVM RAID1 論理ボリュームの LVM リニア論理ボリュームへの変換
lvconvert コマンドを使用して、既存の RAID1 LVM 論理ボリュームを LVM リニア論理ボリュームに変換するには -m0 引数を指定します。これにより、すべての RAID データサブボリュームおよび RAID アレイを構成するすべての RAID メタデータサブボリュームを削除し、最高レベルの RAID1 イメージをリニア論理ボリュームとして残します。
以下の例は、既存の LVM RAID1 論理ボリュームを表示しています。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(1)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(0)                 
  [my_lv_rmeta_1]         /dev/sdf1(0)
Copy to Clipboard Toggle word wrap
以下のコマンドは、LVM RAID1 論理ボリューム my_vg/my_lv を LVM リニアデバイスに変換します。
# lvconvert -m0 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV      Copy%  Devices     
  my_lv          /dev/sde1(1)
Copy to Clipboard Toggle word wrap
When you convert an LVM RAID1 logical volume to an LVM linear volume, you can specify which physical volumes to remove. The following example shows the layout of an LVM RAID1 logical volume made up of two images: /dev/sda1 and /dev/sdb1. In this example, the lvconvert command specifies that you want to remove /dev/sda1, leaving /dev/sdb1 as the physical volume that makes up the linear device.
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdb1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdb1(0)
# lvconvert -m0 my_vg/my_lv /dev/sda1
# lvs -a -o name,copy_percent,devices my_vg
  LV    Copy%  Devices
  my_lv        /dev/sdb1(1)
Copy to Clipboard Toggle word wrap
5.4.16.4. ミラー化 LVM デバイスの RAID1 デバイスへの変換
lvconvert コマンドを使用して、既存のミラー化 LVM デバイスを RAID1 LVM デバイスに変換するには、--type raid1 引数を指定します。これにより、ミラーサブボリューム (*_mimage_*) の名前を RAID サブボリューム (*_rimage_*) に変更します。また、ミラーログは削除され、対応するデータサブボリュームと同じ物理ボリューム上のデータサブボリューム用にメタデータサブボリューム (*_rmeta_*) が作成されます。
以下の例は、ミラー化論理ボリューム my_vg/my_lv のレイアウトを表示しています。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv             15.20 my_lv_mimage_0(0),my_lv_mimage_1(0)
  [my_lv_mimage_0]        /dev/sde1(0)                 
  [my_lv_mimage_1]        /dev/sdf1(0)                 
  [my_lv_mlog]            /dev/sdd1(0)
Copy to Clipboard Toggle word wrap
以下のコマンドは、ミラー化論理ボリューム my_vg/my_lv を RAID1 論理ボリュームに変換します。
# lvconvert --type raid1 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(0)                 
  [my_lv_rimage_1]        /dev/sdf1(0)                 
  [my_lv_rmeta_0]         /dev/sde1(125)               
  [my_lv_rmeta_1]         /dev/sdf1(125)
Copy to Clipboard Toggle word wrap
5.4.16.5. 既存の RAID1 デバイス内のイメージ数の変更
You can change the number of images in an existing RAID1 array just as you can change the number of images in the earlier implementation of LVM mirroring, by using the lvconvert command to specify the number of additional metadata/data subvolume pairs to add or remove. For information on changing the volume configuration in the earlier implementation of LVM mirroring, see 「ミラー化ボリューム設定の変更」.
lvconvert コマンドを使用して RAID1 デバイスにイメージを追加する場合、結果として生じるデバイス用のイメージの合計数を指定できます。または、デバイスに追加するイメージ数を指定することも可能です。また、オプションとして新しいメタデータ/データイメージのペアが存在する物理ボリュームを指定することもできます。
メタデータサブボリューム (*_rmeta_* と呼ばれる) は、対応するデータサブボリューム (*_rimage_*) と同じ物理デバイス上に常に存在します。メタデータ/データのサブボリュームのペアは、(--alloc anywhere を指定しない限り) RAID アレイ内の別のメタデータ/データのサブボリュームのペアと同じ物理ボリューム上には作成されません。
RAID1 ボリュームにイメージを追加するコマンドの形式は、以下のとおりです。
lvconvert -m new_absolute_count vg/lv [removable_PVs]
lvconvert -m +num_additional_images vg/lv [removable_PVs]
Copy to Clipboard Toggle word wrap
例えば、以下は 2 方向 RAID1 アレイの LVM デバイス my_vg/my_lv を示しています。
# lvs -a -o name,copy_percent,devices my_vg
  LV            Copy%  Devices                      
  my_lv                 6.25 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(0)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(256)               
  [my_lv_rmeta_1]         /dev/sdf1(0)
Copy to Clipboard Toggle word wrap
以下のコマンドは、2 方向の RAID1 デバイス my_vg/my_lv を 3 方向の RAID1 デバイスに変換します。
# lvconvert -m 2 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv              6.25 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sde1(0)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(256)                              
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)
Copy to Clipboard Toggle word wrap
イメージを RAID1 アレイに追加する場合、イメージに使用する物理ボリュームを指定できます。以下のコマンドは、2 方向の RAID1 デバイス my_vg/my_lv を 3 方向の RAID1 デバイスに変換して、物理ボリューム /dev/sdd1 がアレイに使用されることを指定します。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv             56.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdb1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdb1(0)
# lvconvert -m 2 my_vg/my_lv /dev/sdd1
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv             28.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdb1(1)
  [my_lv_rimage_2]        /dev/sdd1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdb1(0)
  [my_lv_rmeta_2]         /dev/sdd1(0)
Copy to Clipboard Toggle word wrap
RAID1 アレイからイメージを削除するには、以下のコマンドを使用します。lvconvert コマンドを使用して RAID1 デバイスからイメージを削除する場合、結果として生じるデバイス用のイメージの合計数を指定できます。または、デバイスから削除するイメージ数を指定することも可能です。また、オプションとしてデバイスを削除する物理ボリュームを指定することもできます。
lvconvert -m new_absolute_count vg/lv [removable_PVs]
lvconvert -m -num_fewer_images vg/lv [removable_PVs]
Copy to Clipboard Toggle word wrap
また、イメージとその関連付けされたメタデータのサブボリュームが削除されると、それより数が大きいイメージはスロットを埋めるために小さくなります。lv_rimage_0lv_rimage_1、および lv_rimage_2 で構成される 3 方向の RAID1 アレイから lv_rimage_1 を削除する場合、lv_rimage_0lv_rimage_1 で構成される RAID1 アレイが生じます。サブボリューム lv_rimage_2 の名前は変更され、空のスロットを引き継ぎ、lv_rimage_1 となります。
以下の例は、3 方向の RAID1 論理ボリューム my_vg/my_lv のレイアウトを示しています。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sde1(1)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(0)                                
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)
Copy to Clipboard Toggle word wrap
以下のコマンドは、3 方向の RAID1 論理ボリュームを 2 方向の RAID1 論理ボリュームに変換します。
# lvconvert -m1 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(1)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(0)                 
  [my_lv_rmeta_1]         /dev/sdf1(0)
Copy to Clipboard Toggle word wrap
以下のコマンドは、3 方向の RAID1 論理ボリュームを 2 方向の RAID1 論理ボリュームに変換して、削除するイメージを含む物理ボリュームを /dev/sde1 として指定します。
# lvconvert -m1 my_vg/my_lv /dev/sde1
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sdf1(1)                 
  [my_lv_rimage_1]        /dev/sdg1(1)                 
  [my_lv_rmeta_0]         /dev/sdf1(0)                 
  [my_lv_rmeta_1]         /dev/sdg1(0)
Copy to Clipboard Toggle word wrap
5.4.16.6. 別々の論理ボリュームとしての RAID イメージの分割
RAID 論理ボリュームのイメージを分割して、新しい論理ボリュームを形成します。RAID イメージを分割する手順は、「ミラー化論理ボリュームの冗長イメージの分割」 で説明されている、ミラー化論理ボリュームの冗長イメージを分割する手順と同じです。
RAID イメージを分割するコマンドの形式は、以下のとおりです。
lvconvert --splitmirrors count -n splitname vg/lv [removable_PVs]
Copy to Clipboard Toggle word wrap
既存の RAID1 論理ボリュームから RAID イメージを削除する場合と同様に (「既存の RAID1 デバイス内のイメージ数の変更」 で説明)、RAID データのサブボリューム (およびその関連付けされたメタデータのサブボリューム) をデバイスの中心から削除する場合、それより数が大きいイメージはスロットを埋めるために小さくなります。そのため、RAID アレイを構成する論理ボリューム上のインデックス番号は連続する整数となります。

注記

RAID1 アレイがまだ同期していない場合は、RAID イメージを分割できません。
以下の例は、2 方向の RAID1 論理ボリューム my_lvmy_lvnew の 2 つのリニア論理ボリュームに分割します。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv             12.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(1)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(0)                 
  [my_lv_rmeta_1]         /dev/sdf1(0)                 
# lvconvert --splitmirror 1 -n new my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV      Copy%  Devices     
  my_lv          /dev/sde1(1)
  new            /dev/sdf1(1)
Copy to Clipboard Toggle word wrap
以下の例は、3 方向の RAID1 論理ボリューム my_lv を、2 方向の RAID1 論理ボリューム my_lv とリニア論理ボリューム new に分割します。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sde1(1)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(0)                                
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)                                
# lvconvert --splitmirror 1 -n new my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV            Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sde1(1)                 
  [my_lv_rimage_1]        /dev/sdf1(1)                 
  [my_lv_rmeta_0]         /dev/sde1(0)                 
  [my_lv_rmeta_1]         /dev/sdf1(0)                 
  new                     /dev/sdg1(1)
Copy to Clipboard Toggle word wrap
5.4.16.7. RAID イメージの分割とマージ
lvconvert コマンドで --splitmirrors 引数とともに --trackchanges 引数を使用することにより、すべての変更を追跡しながら、読み取り専用に RAID1 アレイのイメージを一時的に分割することができます。これにより、イメージの分割後に変更になったアレイの部分のみを再同期する一方で、後ほどそのイメージをアレイにマージしなおすことができます。
RAID イメージを分割する lvconvert コマンドの形式は、以下のとおりです。
lvconvert --splitmirrors count --trackchanges vg/lv [removable_PVs]
Copy to Clipboard Toggle word wrap
--trackchanges 引数を使用して RAID イメージを分割する場合、分割するイメージを指定することはできますが、分割されるボリューム名を変更することはできません。また、結果として生じるボリュームには以下の制限があります。
  • 作成する新規ボリュームは読み取り専用です。
  • 新規ボリュームのサイズは変更できません。
  • 残っているアレイの名前は変更できません。
  • 残っているアレイのサイズは変更できません。
  • 新規のボリュームおよび残っているアレイを個別にアクティブ化することはできません。
--trackchanges 引数を使用して分割したイメージをマージするには、その後の lvconvert コマンドで --merge 引数を指定して実行します。イメージをマージする場合、イメージが分割されてから変更になったアレイの部分のみが再同期されます。
RAID イメージをマージする lvconvert コマンドの形式は、以下のとおりです。
lvconvert --merge raid_image
Copy to Clipboard Toggle word wrap
以下の例は、残りのアレイへの変更を追跡する一方で、RAID1 論理ボリュームを作成し、そのボリュームからイメージを分割しています。
# lvcreate --type raid1 -m2 -L1G -n my_lv .vg
  Logical volume "my_lv" created
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sdb1(1)                                
  [my_lv_rimage_1]        /dev/sdc1(1)                                
  [my_lv_rimage_2]        /dev/sdd1(1)                                
  [my_lv_rmeta_0]         /dev/sdb1(0)                                
  [my_lv_rmeta_1]         /dev/sdc1(0)                                
  [my_lv_rmeta_2]         /dev/sdd1(0)                                
# lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv
  my_lv_rimage_2 split from my_lv for read-only purposes.
  Use 'lvconvert --merge my_vg/my_lv_rimage_2' to merge back into my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sdb1(1)                                
  [my_lv_rimage_1]        /dev/sdc1(1)                                
  my_lv_rimage_2         /dev/sdd1(1)                                
  [my_lv_rmeta_0]         /dev/sdb1(0)                                
  [my_lv_rmeta_1]         /dev/sdc1(0)                                
  [my_lv_rmeta_2]         /dev/sdd1(0)
Copy to Clipboard Toggle word wrap
以下の例は、残りのアレイへの変更を追跡する一方で、RAID1 ボリュームからイメージを分割しています。その後、ボリュームをアレイにマージしなおしています。
# lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv
  lv_rimage_1 split from my_lv for read-only purposes.
  Use 'lvconvert --merge my_vg/my_lv_rimage_1' to merge back into my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sdc1(1)                 
  my_lv_rimage_1          /dev/sdd1(1)                 
  [my_lv_rmeta_0]         /dev/sdc1(0)                 
  [my_lv_rmeta_1]         /dev/sdd1(0)                 
# lvconvert --merge my_vg/my_lv_rimage_1
  my_vg/my_lv_rimage_1 successfully merged back into my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sdc1(1)                 
  [my_lv_rimage_1]        /dev/sdd1(1)                 
  [my_lv_rmeta_0]         /dev/sdc1(0)                 
  [my_lv_rmeta_1]         /dev/sdd1(0)
Copy to Clipboard Toggle word wrap
RAID1 ボリュームからイメージを分割したら、その分割を永続的にするためには第 2 のコマンド lvconvert --splitmirrors を発行し、--trackchanges 引数を指定せずに、イメージを分割する最初の lvconvert コマンドを繰り返します。これで --trackchanges 引数が作成したリンクが機能しなくなります。
--trackchanges 引数を使用してイメージを分割した後は、アレイ上でその後に lvconvert --splitmirrors コマンドを発行することはできません。ただし、追跡されるイメージを永久に分割する場合は例外です。
以下の一連のコマンドは、イメージを分割して追跡し、追跡されるイメージを永久に分割します。
# lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv
  my_lv_rimage_1 split from my_lv for read-only purposes.
  Use 'lvconvert --merge my_vg/my_lv_rimage_1' to merge back into my_lv
# lvconvert --splitmirrors 1 -n new my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV   Copy%  Devices     
  my_lv          /dev/sdc1(1)
  new            /dev/sdd1(1)
Copy to Clipboard Toggle word wrap
ただし、以下の一連のコマンドは失敗する点に注意してください。
# lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv
  my_lv_rimage_1 split from my_lv for read-only purposes.
  Use 'lvconvert --merge my_vg/my_lv_rimage_1' to merge back into my_lv
# lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv
  Cannot track more than one split image at a time
Copy to Clipboard Toggle word wrap
同様に、以下の一連のコマンドも失敗します。分割されたイメージが追跡されていないためです。
# lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv
  my_lv_rimage_1 split from my_lv for read-only purposes.
  Use 'lvconvert --merge my_vg/my_lv_rimage_1' to merge back into my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                      
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sdc1(1)                 
  my_lv_rimage_1          /dev/sdd1(1)                 
  [my_lv_rmeta_0]         /dev/sdc1(0)                 
  [my_lv_rmeta_1]         /dev/sdd1(0)                 
# lvconvert --splitmirrors 1 -n new my_vg/my_lv /dev/sdc1
  Unable to split additional image from my_lv while tracking changes for my_lv_rimage_1
Copy to Clipboard Toggle word wrap
5.4.16.8. RAID フォルトポリシーの設定
LVM RAID は、lvm.conf ファイルの raid_fault_policy フィールドで定義されている詳細設定に基づいて、デバイス障害を自動で処理します。
  • raid_fault_policy フィールドが allocate にセットされている場合、システムは障害が発生したデバイスをボリュームグループの予備のデバイスと置き換えようとします。予備のデバイスがない場合、これはシステムログにレポートされます。
  • raid_fault_policy フィールドが warn にセットされている場合、システムは警告を発して、ログはデバイスが失敗したことを示します。これにより、ユーザーは一連の動作を決定することができます。
そのポリシーを使用するデバイスが残っている限り、RAID 論理ボリュームは操作を続行します。
5.4.16.8.1. RAID の割り当てフォルトポリシー
以下の例では、raid_fault_policy フィールドは lvm.conf ファイルで allocate にセットされています。RAID 論理ボリュームは、以下のように配置されます。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sde1(1)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(0)                                
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)
Copy to Clipboard Toggle word wrap
/dev/sde デバイスが失敗した場合は、システムログはエラーメッセージを表示します。
# grep lvm /var/log/messages 
Jan 17 15:57:18 bp-01 lvm[8599]: Device #0 of raid1 array, my_vg-my_lv, has failed.
Jan 17 15:57:18 bp-01 lvm[8599]: /dev/sde1: read failed after 0 of 2048 at
250994294784: Input/output error
Jan 17 15:57:18 bp-01 lvm[8599]: /dev/sde1: read failed after 0 of 2048 at
250994376704: Input/output error
Jan 17 15:57:18 bp-01 lvm[8599]: /dev/sde1: read failed after 0 of 2048 at 0:
Input/output error
Jan 17 15:57:18 bp-01 lvm[8599]: /dev/sde1: read failed after 0 of 2048 at
4096: Input/output error
Jan 17 15:57:19 bp-01 lvm[8599]: Couldn't find device with uuid
3lugiV-3eSP-AFAR-sdrP-H20O-wM2M-qdMANy.
Jan 17 15:57:27 bp-01 lvm[8599]: raid1 array, my_vg-my_lv, is not in-sync.
Jan 17 15:57:36 bp-01 lvm[8599]: raid1 array, my_vg-my_lv, is now in-sync.
Copy to Clipboard Toggle word wrap
raid_fault_policy フィールドは allocate にセットされているため、障害が発生したデバイスはボリュームグループの新しいデバイスと置き換わります。
# lvs -a -o name,copy_percent,devices vg
  Couldn't find device with uuid 3lugiV-3eSP-AFAR-sdrP-H20O-wM2M-qdMANy.
  LV            Copy%  Devices                                     
  lv            100.00 lv_rimage_0(0),lv_rimage_1(0),lv_rimage_2(0)
  [lv_rimage_0]        /dev/sdh1(1)                                
  [lv_rimage_1]        /dev/sdf1(1)                                
  [lv_rimage_2]        /dev/sdg1(1)                                
  [lv_rmeta_0]         /dev/sdh1(0)                                
  [lv_rmeta_1]         /dev/sdf1(0)                                
  [lv_rmeta_2]         /dev/sdg1(0)
Copy to Clipboard Toggle word wrap
障害が発生したデバイスが置き換わっても、LVM は障害が発生したデバイスを見つけることができなかったことを引き続き表示する点に注意してください。これは、障害が発生したデバイスは RAID 論理ボリュームから削除されていますが、ボリュームグループからはまだ削除されていないためです。障害が発生したデバイスをボリュームグループから削除するには、vgreduce --removemissing VG を実行できます。
raid_fault_policyallocate にセットされているが予備のデバイスがない場合、割り当ては失敗し、論理ボリュームはそのまま残ります。割り当てが失敗した場合は、「warn の RAID フォルトポリシー」 の説明のとおり、オプションとしてドライブを修正することができ、論理ボリュームを非アクティブ化/アクティブ化します。別の方法として、「RAID デバイスの置き換え」 で説明しているように、障害が発生したデバイスを置き換えることも可能です。
5.4.16.8.2. warn の RAID フォルトポリシー
以下の例では、raid_fault_policy フィールドは lvm.conf ファイル内で warn にセットされています。RAID 論理ボリュームは以下のように配置されます。
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sdh1(1)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sdh1(0)                                
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)
Copy to Clipboard Toggle word wrap
/dev/sdh デバイスに障害が発生すると、システムログはエラーメッセージを表示します。ただし、この場合、LVM はイメージの 1 つを置き換えて、RAID デバイスを自動的に修復しようとはしません。代わりに、デバイスに障害が発生したら、以下のように lvconvert コマンドの --repair 引数を使用してデバイスを置き換えることができます。
# lvconvert --repair my_vg/my_lv
  /dev/sdh1: read failed after 0 of 2048 at 250994294784: Input/output error
  /dev/sdh1: read failed after 0 of 2048 at 250994376704: Input/output error
  /dev/sdh1: read failed after 0 of 2048 at 0: Input/output error
  /dev/sdh1: read failed after 0 of 2048 at 4096: Input/output error
  Couldn't find device with uuid fbI0YO-GX7x-firU-Vy5o-vzwx-vAKZ-feRxfF.
Attempt to replace failed RAID images (requires full device resync)? [y/n]: y

# lvs -a -o name,copy_percent,devices my_vg
  Couldn't find device with uuid fbI0YO-GX7x-firU-Vy5o-vzwx-vAKZ-feRxfF.
  LV               Copy%  Devices                                     
  my_lv             64.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sde1(1)                                
  [my_lv_rimage_1]        /dev/sdf1(1)                                
  [my_lv_rimage_2]        /dev/sdg1(1)                                
  [my_lv_rmeta_0]         /dev/sde1(0)                                
  [my_lv_rmeta_1]         /dev/sdf1(0)                                
  [my_lv_rmeta_2]         /dev/sdg1(0)
Copy to Clipboard Toggle word wrap
障害が発生したデバイスが置き換わっても、LVM は障害が発生したデバイスを見つけることができなかったことを引き続き表示する点に注意してください。これは、障害が発生したデバイスは RAID 論理ボリュームから削除されていますが、ボリュームグループからはまだ削除されていないためです。障害が発生したデバイスをボリュームグループから削除するには、vgreduce --removemissing VG を実行できます。
If the device failure is a transient failure or you are able to repair the device that failed, as of Red Hat Enterprise Linux release 6.5 you can initiate recovery of the failed device with the --refresh option of the lvchange command. Previously it was necessary to deactivate and then activate the logical volume.
The following command refreshes a logical volume.
# lvchange --refresh my_vg/my_lv
Copy to Clipboard Toggle word wrap
5.4.16.9. RAID デバイスの置き換え
RAID は従来の LVM ミラーリングのようなものではありません。LVM ミラーリングでは、障害が発生したデバイスは削除する必要がありました。そうしないと、ミラー化論理ボリュームはハングしていました。RAID アレイは、障害があるデバイスがあっても稼働し続けることが可能です。RAID1 以外の RAID タイプの場合、デバイスを削除することはレベルが下の RAID に変換することを意味します (例えば、RAID6 から RAID5、または RAID4 もしくは RAID5 から RAID0)。そのため、無条件に障害のあるデバイスを削除してから置き換えを行うのではなく、LVM により、lvconvert コマンドに --replace 引数を使用することで RAID ボリューム内のデバイスをワンステップで置き換えることができます。
lvconvert --replace の形式は、以下のとおりです。
lvconvert --replace dev_to_remove vg/lv [possible_replacements]
Copy to Clipboard Toggle word wrap
以下の例は、RAID1 論理ボリュームを作成した後、そのボリューム内のデバイスを置き換えます。
# lvcreate --type raid1 -m2 -L 1G -n my_lv my_vg
  Logical volume "my_lv" created
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sdb1(1)                                
  [my_lv_rimage_1]        /dev/sdb2(1)                                
  [my_lv_rimage_2]        /dev/sdc1(1)                                
  [my_lv_rmeta_0]         /dev/sdb1(0)                                
  [my_lv_rmeta_1]         /dev/sdb2(0)                                
  [my_lv_rmeta_2]         /dev/sdc1(0)                                
# lvconvert --replace /dev/sdb2 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices                                     
  my_lv             37.50 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sdb1(1)                                
  [my_lv_rimage_1]        /dev/sdc2(1)                                
  [my_lv_rimage_2]        /dev/sdc1(1)                                
  [my_lv_rmeta_0]         /dev/sdb1(0)                                
  [my_lv_rmeta_1]         /dev/sdc2(0)                                
  [my_lv_rmeta_2]         /dev/sdc1(0)
Copy to Clipboard Toggle word wrap
以下の例は、RAID1 論理ボリュームを作成した後、そのボリューム内のデバイスを置き換えます。また、置き換える物理ボリュームを指定します。
# lvcreate --type raid1 -m1 -L 100 -n my_lv my_vg
  Logical volume "my_lv" created
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdb1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdb1(0)
# pvs
  PV          VG       Fmt  Attr PSize    PFree
  /dev/sda1   my_vg    lvm2 a--  1020.00m  916.00m
  /dev/sdb1   my_vg    lvm2 a--  1020.00m  916.00m
  /dev/sdc1   my_vg    lvm2 a--  1020.00m 1020.00m
  /dev/sdd1   my_vg    lvm2 a--  1020.00m 1020.00m
# lvconvert --replace /dev/sdb1 my_vg/my_lv /dev/sdd1
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv             28.00 my_lv_rimage_0(0),my_lv_rimage_1(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdd1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdd1(0)
Copy to Clipboard Toggle word wrap
1 度に 1 つ以上の RAID デバイスを置き換えるには、以下の例のように複数の replace 引数を指定します。
# lvcreate --type raid1 -m 2 -L 100 -n my_lv my_vg
  Logical volume "my_lv" created
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv            100.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdb1(1)
  [my_lv_rimage_2]        /dev/sdc1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdb1(0)
  [my_lv_rmeta_2]         /dev/sdc1(0)
# lvconvert --replace /dev/sdb1 --replace /dev/sdc1 my_vg/my_lv
# lvs -a -o name,copy_percent,devices my_vg
  LV               Copy%  Devices
  my_lv             60.00 my_lv_rimage_0(0),my_lv_rimage_1(0),my_lv_rimage_2(0)
  [my_lv_rimage_0]        /dev/sda1(1)
  [my_lv_rimage_1]        /dev/sdd1(1)
  [my_lv_rimage_2]        /dev/sde1(1)
  [my_lv_rmeta_0]         /dev/sda1(0)
  [my_lv_rmeta_1]         /dev/sdd1(0)
  [my_lv_rmeta_2]         /dev/sde1(0)
Copy to Clipboard Toggle word wrap

注記

lvconvert --replace コマンドを使用して置き換えるドライブを指定する場合、置き換えるドライブはアレイ内ですでに使用されている予備のドライブ領域から割り当てないようにしてください。例えば、lv_rimage_0lv_rimage_1 は同じ物理ボリューム上に存在しないようにしてください。
5.4.16.10. Scrubbing a RAID Logical Volume
As of the Red Hat Enterprise Linux 6.5 release, LVM provides scrubbing support for RAID logical volumes. RAID scrubbing is the process of reading all the data and parity blocks in an array and checking to see whether they are coherent.
You initiate a RAID scrubbing operation with the --syncaction option of the lvchange command. You specify either a check or repair operation. A check operation goes over the array and records the number of discrepancies in the array but does not repair them. A repair operation corrects the discrepancies as it finds them.
The format of the command to scrub a RAID logical volume is as follows:
lvchange --syncaction {check|repair} vg/raid_lv
Copy to Clipboard Toggle word wrap

注記

The lvchange --syncaction repair vg/raid_lv operation does not perform the same function as the lvconvert --repair vg/raid_lv operation. The lvchange --syncaction repair operation initiates a background synchronization operation on the array, while the lvconvert --repair operation is designed to repair/replace failed devices in a mirror or RAID logical volume.
In support of the new RAID scrubbing operation, the lvs command now supports two new printable fields: raid_sync_action and raid_mismatch_count. These fields are not printed by default. To display these fields you specify them with the -o parameter of the lvs, as follows.
lvs -o +raid_sync_action,raid_mismatch_count vg/lv
Copy to Clipboard Toggle word wrap
The raid_sync_action field displays the current synchronization operation that the raid volume is performing. It can be one of the following values:
  • idle: All sync operations complete (doing nothing)
  • resync: Initializing an array or recovering after a machine failure
  • recover: Replacing a device in the array
  • check: Looking for array inconsistencies
  • repair: Looking for and repairing inconsistencies
The raid_mismatch_count field displays the number of discrepancies found during a check operation.
The Cpy%Sync field of the lvs command now prints the progress of any of the raid_sync_action operations, including check and repair.
The lv_attr field of the lvs display now provides additional indicators in support of the RAID scrubbing operation. Bit 9 of this field displays the health of the logical volume, and it now supports the following indicators.
  • (m)ismatches indicates that there are discrepancies in a RAID logical volume. This character is shown after a scrubbing operation has detected that portions of the RAID are not coherent.
  • (r)efresh indicates that a device in a RAID array has suffered a failure and the kernel regards it as failed, even though LVM can read the device label and considers the device to be operational. The logical should be (r)efreshed to notify the kernel that the device is now available, or the device should be (r)eplaced if it is suspected of having failed.
For information on the lvs command, see 「オブジェクトの選択」.
When you perform a RAID scrubbing operation, the background I/O required by the sync operations can crowd out other I/O operations to LVM devices, such as updates to volume group metadata. This can cause the other LVM operations to slow down. You can control the rate at which the RAID logical volume is scrubbed by implementing recovery throttling.
You control the rate at which sync operations are performed by setting the minimum and maximum I/O rate for those operations with the --minrecoveryrate and --maxrecoveryrate options of the lvchange command. You specify these options as follows.
  • --maxrecoveryrate Rate[bBsSkKmMgG]
    Sets the maximum recovery rate for a RAID logical volume so that it will not crowd out nominal I/O operations. The Rate is specified as an amount per second for each device in the array. If no suffix is given, then kiB/sec/device is assumed. Setting the recovery rate to 0 means it will be unbounded.
  • --minrecoveryrate Rate[bBsSkKmMgG]
    Sets the minimum recovery rate for a RAID logical volume to ensure that I/O for sync operations achieves a minimum throughput, even when heavy nominal I/O is present. The Rate is specified as an amount per second for each device in the array. If no suffix is given, then kiB/sec/device is assumed.
5.4.16.11. Controlling I/O Operations on a RAID1 Logical Volume
As of the Red Hat Enterprise Linux release 6.5, you can control the I/O operations for a device in a RAID1 logical volume by using the --writemostly and --writebehind parameters of the lvchange command. The format for using these parameters is as follows.
  • --[raid]writemostly PhysicalVolume[:{t|y|n}]
    Marks a device in a RAID1 logical volume as write-mostly. All reads to these drives will be avoided unless necessary. Setting this parameter keeps the number of I/O operations to the drive to a minimum. The default behavior is to set the write-mostly attribute for the specified physical volume in the logical volume. It is possible to remove the write-mostly flag by appending :n to the physical volume or to toggle the value by specifying :t. The --writemostly argument can be specified more than one time in a single command, making it possible to toggle the write-mostly attributes for all the physical volumes in a logical volume at once.
  • --[raid]writebehind IOCount
    Specifies the maximum number of outstanding writes that are allowed to devices in a RAID1 logical volume that are marked as write-mostly. Once this value is exceeded, writes become synchronous, causing all writes to the constituent devices to complete before the array signals the write has completed. Setting the value to zero clears the preference and allows the system to choose the value arbitrarily.

5.4.17. Controlling Logical Volume Activation

You can flag a logical volume to be skipped during normal activation commands with the -k or --setactivationskip {y|n} option of the lvcreate or lvchange command. This flag is not applied during deactivation.
You can determine whether this flag is set for a logical volume with the lvs command, which displays the k attribute as in the following example.
# lvs vg/thin1s1
LV         VG  Attr       LSize Pool  Origin
thin1s1    vg  Vwi---tz-k 1.00t pool0 thin1
Copy to Clipboard Toggle word wrap
By default, thin snapshot volumes are flagged for activation skip. You can activate a logical volume with the k attribute set by using the -K or --ignoreactivationskip option in addition to the standard -ay or --activate y option.
The following command activates a thin snapshot logical volume.
# lvchange -ay -K VG/SnapLV
Copy to Clipboard Toggle word wrap
The persistent "activation skip" flag can be turned off when the logical volume is created by specifying the -kn or --setactivationskip n option of the lvcreate command. You can turn the flag off for an existing logical volume by specifying the -kn or --setactivationskip n option of the lvchange command. You can turn the flag on again with the -ky or --setactivationskip y option.
The following command creates a snapshot logical volume without the activation skip flag
# lvcreate --type thin -n SnapLV -kn -s ThinLV --thinpool VG/ThinPoolLV
Copy to Clipboard Toggle word wrap
The following command removes the activation skip flag from a snapshot logical volume.
# lvchange -kn VG/SnapLV
Copy to Clipboard Toggle word wrap
You can control the default activation skip setting with the auto_set_activation_skip setting in the /etc/lvm/lvm.conf file.

5.5. フィルターを使用した LVM デバイススキャンの制御

At startup, the vgscan command is run to scan the block devices on the system looking for LVM labels, to determine which of them are physical volumes and to read the metadata and build up a list of volume groups. The names of the physical volumes are stored in the LVM cache file of each node in the system, /etc/lvm/cache/.cache. Subsequent commands may read that file to avoiding rescanning.
lvm.conf 設定ファイル内にフィルターを設定することにより、LVM がスキャンするデバイスを制御することができます。lvm.conf ファイル内のフィルターは、一連の簡単な正規表現で構成されており、/dev ディレクトリ内のデバイス名に適用されて、各ブロックデバイスを受理するか、拒否するかの決定をします。
以下の例では、LVM がスキャンするデバイスを制御するフィルターの使用を示しています。正規表現は完全なパス名に対して自由にマッチングされるため、これらの例の一部は、必ずしもベストプラクティスを示すものではないことに注意してください。例えば、a/loop/a/.*loop.*/ と同等であり、/dev/solooperation/lvol1 と適合します。
以下のフィルターは、検出されたすべてのデバイスを追加します。設定ファイル内で設定されているフィルターはないため、これがデフォルトの動作です。
filter = [ "a/.*/" ]
Copy to Clipboard Toggle word wrap
以下のフィルターは、ドライブにメディアが入っていない場合の遅延を回避するために cdrom デバイスを削除します。
filter = [ "r|/dev/cdrom|" ]
Copy to Clipboard Toggle word wrap
以下のフィルターはすべてのループを追加して、すべての他のブロックデバイスを削除します。
filter = [ "a/loop.*/", "r/.*/" ]
Copy to Clipboard Toggle word wrap
以下のフィルターはすべてのループと IDE を追加して、すべての他のブロックデバイスを削除します。
filter =[ "a|loop.*|", "a|/dev/hd.*|", "r|.*|" ]
Copy to Clipboard Toggle word wrap
以下のフィルターは 1 番目の IDE ドライブ上にパーティション 8 のみを追加して、他のすべてのブロックデバイスを削除します。
filter = [ "a|^/dev/hda8$|", "r/.*/" ]
Copy to Clipboard Toggle word wrap

注記

When the lvmetad daemon is running, the filter = setting in the /etc/lvm/lvm.conf file does not apply when you execute the pvscan --cache device command. To filter devices, you need to use the global_filter = setting. Devices that fail the global filter are not opened by LVM and are never scanned. You may need to use a global filter, for example, when you use LVM devices in VMs and you do not want the contents of the devices in the VMs to be scanned by the physical host.
lvm.conf ファイルの詳細情報は、付録B LVM 設定ファイル および lvm.conf(5) の man ページをご覧ください。

5.6. オンラインデータ移動

pvmove コマンドを使用すると、システムの使用中にデータを移動することができます。
pvmove コマンドは、データを分割してセクションに移動して、各セクションを移動する一時的なミラーを作成します。pvmove コマンドの操作に関する情報は、pvmove(8) の man ページをご覧ください。

注記

In order to perform a pvmove operation in a cluster, you should ensure that the cmirror package is installed and the cmirrord service is running.
以下のコマンドはすべての割り当て領域を、物理ボリューム /dev/sdc1 からボリュームグループ内の他の空き物理ボリュームへ移動します:
# pvmove /dev/sdc1
Copy to Clipboard Toggle word wrap
以下のコマンドは、論理ボリューム MyLV のエクステントのみを移動します。
# pvmove -n MyLV /dev/sdc1
Copy to Clipboard Toggle word wrap
pvmove コマンドは、その実行に長時間を要するため、バックグラウンドでコマンドを実行して、フォアグラウンドでの進捗状況表示を回避した方が良いでしょう。以下のコマンドは、物理ボリューム /dev/sdc1 に割り当てられているすべてのエクステントを、バックグラウンドで /dev/sdf1 に移動します。
# pvmove -b /dev/sdc1 /dev/sdf1
Copy to Clipboard Toggle word wrap
以下のコマンドは、移動の進捗状況を 5 秒間隔でパーセンテージで報告します。
# pvmove -i5 /dev/sdd1
Copy to Clipboard Toggle word wrap

5.7. クラスター内の個別ノード上の論理ボリュームのアクティブ化

クラスター環境に LVM をインストールしている場合は、単一のノード上で論理ボリュームを排他的にアクティブ化しなければならない可能性があります。
論理ボリュームを単一のノード上で排他的にアクティブ化するには、lvchange -aey コマンドを使用します。また、lvchange -aly コマンドを使用すると、論理ボリュームを排他的にではなくローカルノード上のみでアクティブ化することもできます。これらの論理ボリュームは、後で、追加のノード上で同時にアクティブ化することができます。
また、付録D LVM オブジェクトタグ で説明してあるように、LVM タグを使用した個別ノード上での論理ボリュームのアクティブ化も可能です。また、設定ファイル内でノードのアクティブ化を指定することもできます。これについては、付録B LVM 設定ファイル で説明しています。

5.8. LVM 用のカスタム報告

pvslvs、および vgs コマンドを使用して、LVM オブジェクトについての簡潔でカスタマイズ可能なレポートを作成することができます。これらのコマンドが生成するレポートには、オブジェクトごとに 1 行の出力が含まれます。各行には、オブジェクトに関連するプロパティのフィールドの順序付けられた一覧が含まれます。レポートするオブジェクトを選択する方法は 5 つあります。物理ボリューム、ボリュームグループ、論理ボリューム、物理ボリュームセグメント、論理ボリュームセグメントです。
以下のセクションでは、次のような内容を説明します。
  • 生成されたレポートの形式を制御するために使用できるコマンド引数の概要
  • 各 LVM オブジェクト用に選択できるフィールドの一覧
  • 生成されたレポートをソートするために使用できるコマンド引数の概要
  • レポート出力の単位を指定する手順

5.8.1. 形式の制御

pvslvs、または vgs コマンドのどれを使用するかによって、表示されるデフォルトのフィールドセットとソート順序が決定します。これらのコマンドの出力は、以下の引数を使用することによって制御できます。
  • -o 引数を使用すると、表示するフィールドをデフォルト以外に変更することができます。例えば、以下の出力は pvs コマンドのデフォルト表示です (物理ボリュームに関する情報を表示)。
    # pvs
      PV         VG     Fmt  Attr PSize  PFree
      /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G
      /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G
      /dev/sdd1  new_vg lvm2 a-   17.14G 17.14G
    
    Copy to Clipboard Toggle word wrap
    以下のコマンドは物理ボリュームの名前とサイズだけを表示します。
    # pvs -o pv_name,pv_size
      PV         PSize
      /dev/sdb1  17.14G
      /dev/sdc1  17.14G
      /dev/sdd1  17.14G
    
    Copy to Clipboard Toggle word wrap
  • -o 引数との組み合わせで使用するプラスサイン (+) を使って、出力にフィールドを追加することができます。
    以下の例では、デフォルトフィールドに加えて、物理ボリュームの UUID を表示しています。
    # pvs -o +pv_uuid
      PV         VG     Fmt  Attr PSize  PFree  PV UUID
      /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G onFF2w-1fLC-ughJ-D9eB-M7iv-6XqA-dqGeXY
      /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G Joqlch-yWSj-kuEn-IdwM-01S9-X08M-mcpsVe
      /dev/sdd1  new_vg lvm2 a-   17.14G 17.14G yvfvZK-Cf31-j75k-dECm-0RZ3-0dGW-UqkCS
    
    Copy to Clipboard Toggle word wrap
  • コマンドに -v 引数を追加すると、追加のフィールドが含まれます。例えば、pvs -v コマンドは、デフォルトフィールドに加えて、DevSizePV UUID のフィールドも表示します。
    # pvs -v
        Scanning for physical volume names
      PV         VG     Fmt  Attr PSize  PFree  DevSize PV UUID
      /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G  17.14G onFF2w-1fLC-ughJ-D9eB-M7iv-6XqA-dqGeXY
      /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G  17.14G Joqlch-yWSj-kuEn-IdwM-01S9-XO8M-mcpsVe
      /dev/sdd1  new_vg lvm2 a-   17.14G 17.14G  17.14G yvfvZK-Cf31-j75k-dECm-0RZ3-0dGW-tUqkCS
    
    Copy to Clipboard Toggle word wrap
  • --noheadings 引数は、見出し行を表示しません。これはスクリプトを書くときに便利です。
    以下の例は pv_name 引数と共に --noheadings 引数を使用して、すべての物理ボリュームの一覧を生成しています。
    # pvs --noheadings -o pv_name
      /dev/sdb1
      /dev/sdc1
      /dev/sdd1
    
    Copy to Clipboard Toggle word wrap
  • --separator separator 引数は separator を使用して、各フィールドを分離します。
    次の例では、pvs コマンドのデフォルト出力フィールドをイコールサイン (=) で分割しています。
    # pvs --separator =
      PV=VG=Fmt=Attr=PSize=PFree
      /dev/sdb1=new_vg=lvm2=a-=17.14G=17.14G
      /dev/sdc1=new_vg=lvm2=a-=17.14G=17.09G
      /dev/sdd1=new_vg=lvm2=a-=17.14G=17.14G
    
    Copy to Clipboard Toggle word wrap
    separator 引数の使用時にフィールドを整列させるには、--aligned 引数と共に separator 引数を使用します。
    # pvs --separator = --aligned
      PV        =VG    =Fmt =Attr=PSize =PFree
      /dev/sdb1 =new_vg=lvm2=a-  =17.14G=17.14G
      /dev/sdc1 =new_vg=lvm2=a-  =17.14G=17.09G
      /dev/sdd1 =new_vg=lvm2=a-  =17.14G=17.14G
    
    Copy to Clipboard Toggle word wrap
lvs または vgs コマンドで -P 引数を使用して、障害が発生したボリュームについて、出力では表示されないような情報を表示することができます。この引数によって得られる出力に関する情報は、「障害の発生したデバイスの情報表示」 をご覧ください。
表示に関する引数の完全な一覧は、pvs(8), vgs(8)、および lvs(8) の man ページをご覧ください。
ボリュームグループフィールドは、物理ボリューム (および物理ボリュームセグメント) フィールド、または論理ボリューム (および論理ボリュームセグメント) フィールドと混在させることができますが、物理ボリュームフィールドと論理ボリュームフィールドは混在させることはできません。例えば、以下のコマンドは、1 つの物理ボリュームつき 1 行の出力を表示します。
# vgs -o +pv_name
  VG     #PV #LV #SN Attr   VSize  VFree  PV
  new_vg   3   1   0 wz--n- 51.42G 51.37G /dev/sdc1
  new_vg   3   1   0 wz--n- 51.42G 51.37G /dev/sdd1
  new_vg   3   1   0 wz--n- 51.42G 51.37G /dev/sdb1
Copy to Clipboard Toggle word wrap

5.8.2. オブジェクトの選択

このセクションでは、pvsvgs、および lvs コマンドを使って LVM オブジェクトについて表示できる情報を一覧表示する一連の表を提供します。
便宜上、フィールド名の接頭辞は、コマンドのデフォルトと一致する場合は省略できます。例えば、pvs コマンドでは、namepv_namevgs コマンドでは、namevg_name と解釈されます。
以下のコマンドの実行は、pvs -o pv_free の実行に相当します。
# pvs -o free
  PFree
  17.14G
  17.09G
  17.14G
Copy to Clipboard Toggle word wrap

注記

The number of characters in the attribute fields in pvs, vgs, and lvs output may increase in later releases. The existing character fields will not change position, but new fields may be added to the end. You should take this into account when writing scripts that search for particular attribute characters, searching for the character based on its relative position to the beginning of the field, but not for its relative position to the end of the field. For example, to search for the character p in the ninth bit of the lv_attr field, you could search for the string "^/........p/", but you should not search for the string "/*p$/".
pvs コマンド
表5.2「pvs 表示フィールド」 は、pvs コマンドの表示引数、ヘッダーに表示されるフィールド名、フィールドの説明を一覧にまとめています。
Expand
表5.2 pvs 表示フィールド
引数ヘッダー説明
dev_sizeDevSize物理ボリュームを作成する基となる配下のデバイスのサイズ
pe_start1st PE配下のデバイス内の最初の物理エクステントの開始点までのオフセット
pv_attrAttr物理ボリュームのステータス: (a)llocatable または e(x)ported
pv_fmtFmt物理ボリュームのメタデータ形式 (lvm2 または lvm1)
pv_freePFree物理ボリュームにある残りの空き領域
pv_namePV物理ボリュームの名前
pv_pe_alloc_countAlloc使用される物理エクステントの数
pv_pe_countPE物理エクステントの数
pvseg_sizeSSize物理ボリュームのセグメントサイズ
pvseg_startStart物理ボリュームセグメントのうち最初の物理エクステント
pv_sizePSize物理ボリュームのサイズ
pv_tagsPV Tags物理ボリュームにアタッチされた LVM タグ
pv_usedUsed物理ボリューム上で現在使用中の領域の量
pv_uuidPV UUID物理ボリュームの UUID
デフォルトで pvs コマンドが表示するフィールドは、pv_namevg_namepv_fmtpv_attrpv_sizepv_free です。表示は pv_name でソートされます。
# pvs
  PV         VG     Fmt  Attr PSize  PFree
  /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G
  /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G
  /dev/sdd1  new_vg lvm2 a-   17.14G 17.13G
Copy to Clipboard Toggle word wrap
pvs コマンドに -v 引数を使用すると、デフォルトの表示に dev_size および pv_uuid のフィールドが追加されます。
# pvs -v
    Scanning for physical volume names
  PV         VG     Fmt  Attr PSize  PFree  DevSize PV UUID
  /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G  17.14G onFF2w-1fLC-ughJ-D9eB-M7iv-6XqA-dqGeXY
  /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G  17.14G Joqlch-yWSj-kuEn-IdwM-01S9-XO8M-mcpsVe
  /dev/sdd1  new_vg lvm2 a-   17.14G 17.13G  17.14G yvfvZK-Cf31-j75k-dECm-0RZ3-0dGW-tUqkCS
Copy to Clipboard Toggle word wrap
pvs コマンドに --segments 引数を使用すると、各物理ボリュームセグメントの情報を表示します。セグメントとは、エクステントの集合のことです。セグメントの表示は、論理ボリュームがフラグメント化 (断片化) しているかどうかを確認するのに役立ちます。
デフォルトで pvs --segments コマンドが表示するフィールドは、pv_name, vg_namepv_fmtpv_attrpv_sizepv_freepvseg_startpvseg_size です。この表示は、物理ボリューム内で pv_namepvseg_size でソートされます。
# pvs --segments
  PV         VG         Fmt  Attr PSize  PFree  Start SSize
  /dev/hda2  VolGroup00 lvm2 a-   37.16G 32.00M     0  1172
  /dev/hda2  VolGroup00 lvm2 a-   37.16G 32.00M  1172    16
  /dev/hda2  VolGroup00 lvm2 a-   37.16G 32.00M  1188     1
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G     0    26
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G    26    24
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G    50    26
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G    76    24
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   100    26
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   126    24
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   150    22
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   172  4217
  /dev/sdb1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdc1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdd1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sde1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdf1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdg1  vg         lvm2 a-   17.14G 17.14G     0  4389
Copy to Clipboard Toggle word wrap
pvs -a コマンドを使用して、LVM 物理ボリュームとして初期化されていなかった LVM が検出したデバイスを確認できます。
# pvs -a
  PV                             VG     Fmt  Attr PSize  PFree
  /dev/VolGroup00/LogVol01                   --       0      0
  /dev/new_vg/lvol0                          --       0      0
  /dev/ram                                   --       0      0
  /dev/ram0                                  --       0      0
  /dev/ram2                                  --       0      0
  /dev/ram3                                  --       0      0
  /dev/ram4                                  --       0      0
  /dev/ram5                                  --       0      0
  /dev/ram6                                  --       0      0
  /dev/root                                  --       0      0
  /dev/sda                                   --       0      0
  /dev/sdb                                   --       0      0
  /dev/sdb1                      new_vg lvm2 a-   17.14G 17.14G
  /dev/sdc                                   --       0      0
  /dev/sdc1                      new_vg lvm2 a-   17.14G 17.09G
  /dev/sdd                                   --       0      0
  /dev/sdd1                      new_vg lvm2 a-   17.14G 17.14G
Copy to Clipboard Toggle word wrap
vgs コマンド
表5.3「vgs 表示フィールド」 は、vgs コマンドの表示引数、ヘッダーに表示されるフィールド名、フィールドの説明を一覧にまとめています。
Expand
表5.3 vgs 表示フィールド
引数ヘッダー説明
lv_count#LVボリュームグループに含まれる論理ボリュームの数
max_lvMaxLVボリュームグループ内で許容される論理ボリュームの最大数 (無制限には 0)
max_pvMaxPVボリュームグループ内で許容される物理ボリュームの最大数 (無制限には 0)
pv_count#PVボリュームグループを定義する物理ボリューム数
snap_count#SNボリュームグループに含まれるスナップショット数
vg_attrAttrボリュームグループのステータス: (w)riteable、(r)eadonly、resi(z)eable、e(x)ported、(p)artial、および (c)lustered.
vg_extent_count#Extボリュームグループ内の物理エクステントの数
vg_extent_sizeExtボリュームグループ内の物理エクステントのサイズ
vg_fmtFmtボリュームグループのメタデータ形式 (lvm2 または lvm1)
vg_freeVFreeボリュームグループ内の残りの空き領域のサイズ
vg_free_countFreeボリュームグループ内の空き物理エクステントの数
vg_nameVGボリュームグループ名
vg_seqnoSeqボリュームグループの改訂を示す番号
vg_sizeVSizeボリュームグループのサイズ
vg_sysidSYS IDLVM1 システム ID
vg_tagsVG Tagsボリュームグループにアタッチされた LVM タグ
vg_uuidVG UUIDボリュームグループの UUID
デフォルトで vgs コマンドが表示するフィールドは、vg_namepv_countlv_countsnap_countvg_attrvg_sizevg_free です。表示は vg_name でソートされます。
# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  new_vg   3   1   1 wz--n- 51.42G 51.36G
Copy to Clipboard Toggle word wrap
vgs コマンドに -v 引数を使用すると、デフォルトの表示に vg_extent_size および vg_uuid のフィールドが追加されます。
# vgs -v
    Finding all volume groups
    Finding volume group "new_vg"
  VG     Attr   Ext   #PV #LV #SN VSize  VFree  VG UUID
  new_vg wz--n- 4.00M   3   1   1 51.42G 51.36G jxQJ0a-ZKk0-OpMO-0118-nlwO-wwqd-fD5D32
Copy to Clipboard Toggle word wrap
lvs コマンド
表5.4「lvs 表示フィールド」 は、lvs コマンドの表示引数、ヘッダーに表示されるフィールド名、フィールドの説明を一覧にまとめています。
Expand
表5.4 lvs 表示フィールド
引数ヘッダー説明
chunksize
chunk_size
Chunkスナップショットボリュームのユニットサイズ
copy_percentCopy%ミラー化論理ボリュームの同期のパーセンテージ。これは、また pv_move コマンドで物理エクステントを移動する時にも使用されます。
devicesDevices論理ボリュームを構成する配下のデバイス: 物理ボリューム、論理ボリューム、そして物理エクステントと論理エクステントの開始点
lv_attrAttr論理ボリュームのステータス。論理ボリュームの属性ビットは以下のようになります。
Bit 1: Volume type: (m)irrored, (M)irrored without initial sync, (o)rigin, (O)rigin with merging snapshot, (r)aid, (R)aid without initial sync, (s)napshot, merging (S)napshot, (p)vmove, (v)irtual, mirror or raid (i)mage, mirror or raid (I)mage out-of-sync, mirror (l)og device, under (c)onversion, thin (V)olume, (t)hin pool, (T)hin pool data, raid or thin pool m(e)tadata or pool metadata spare,
ビット 2: パーミッション: 書き込み可能 (w)、読み取り専用 (r)、読み取り専用でないボリュームを読み取り専用にアクティブ化 (R)
Bit 3: Allocation policy: (a)nywhere, (c)ontiguous, (i)nherited, c(l)ing, (n)ormal. This is capitalized if the volume is currently locked against allocation changes, for example while executing the pvmove command.
ビット 4: 固定されたマイナー番号
ビット 5: 状態: アクティブ(a)、サスペンド(s)、無効なスナップショット(I)、無効なサスペンドされたスナップショット(S)、スナップショットのマージが失敗(m)、サスペンドされたスナップショットのマージが失敗(M)、テーブルのないマッピングされたデバイス(d)、非アクティブのテーブルを持つマッピングされたデバイス(i)
ビット 6: デバイス開放(o)
ビット 7: ターゲットタイプ: ミラー(m)、RAID(r)、スナップショット(s)、シン(t)、不明(u)、仮想(v)。これは、同じターゲットのカーネルに関連する論理ボリュームをグループにまとめます。例えば、ミラーイメージ、ミラーログ、ミラー自体が元のデバイスマッパーのミラーカーネルドライバーを使用する場合、それらは (m) と表示されます。md raid カーネルドライバーを使用する同等の raid はすべて (r) と表示されます。元のデバイスマッパードライバーを使用するスナップショットは (s) と表示され、シンプロビジョニングドライバーを使用するシンボリュームのスナップショットは (t) と表示されます。
ビット 8: 新しく割り当てられたデータブロックは使用前にゼロ(z) のブロックで上書きされます。
Bit 9: Volume Health: (p)artial, (r)efresh needed, (m)ismatches exist, (w)ritemostly. (p)artial signifies that one or more of the Physical Volumes this Logical Volume uses is missing from the system. (r)efresh signifies that one or more of the Physical Volumes this RAID Logical Volume uses had suffered a write error. The write error could be due to a temporary failure of that Physical Volume or an indication that it is failing. The device should be refreshed or replaced. (m)ismatches signifies that the RAID logical volume has portions of the array that are not coherent. Inconsistencies are discovered by initiating a check operation on a RAID logical volume. (The scrubbing operations, check and repair, can be performed on a RAID Logical Volume by means of the lvchange command.) (w)ritemostly signifies the devices in a RAID 1 logical volume that have been marked write-mostly.
Bit 10: s(k)ip activation: this volume is flagged to be skipped during activation.
lv_kernel_majorKMaj論理ボリュームの実際のメジャーデバイス番号 (停止中の場合、-1)
lv_kernel_minorKMIN論理ボリュームの実際のマイナーデバイス番号 (停止中の場合、-1)
lv_majorMaj論理ボリュームの永続的なメジャーデバイス番号 (未指定の場合、-1)
lv_minorMin論理ボリュームの永続的なマイナーデバイス番号 (未指定の場合、-1)
lv_nameLV論理ボリュームの名前
lv_sizeLSize論理ボリュームのサイズ
lv_tagsLV Tags論理ボリュームにアタッチされた LVM タグ
lv_uuidLV UUID論理ボリュームの UUID
mirror_logLogミラーログが存在するデバイス
modulesModulesこの論理ボリュームを使用するのに必要な対応するカーネルデバイスマッパーターゲット
move_pvMovepvmove コマンドで作成された一時的な論理ボリュームの元となる物理ボリューム
originOriginスナップショットボリュームの複製元のデバイス
regionsize
region_size
Regionミラー化論理ボリュームのユニットサイズ
seg_count#Seg論理ボリューム内のセグメント数
seg_sizeSSize論理ボリューム内のセグメントサイズ
seg_startStart論理ボリューム内のセグメントのオフセット
seg_tagsSeg Tags論理ボリュームのセグメントにアタッチされている LVM タグ
segtypeType論理ボリュームのセグメントタイプ (例: ミラー、ストライプ、リニア)
snap_percentSnap%使用中スナップショットボリュームの現在のパーセンテージ
stripes#Str論理ボリューム内のストライプ、またはミラーの数
stripesize
stripe_size
Stripeストライプ化論理ボリューム内のストライプのユニットサイズ
デフォルトで lvs コマンドが表示するフィールドは、lv_namevg_namelv_attrlv_sizeoriginsnap_percentmove_pvmirror_logcopy_percentconvert_lv です。デフォルトの表示は、ボリュームグループ内で vg_namelv_name でソートされます。
# lvs
  LV         VG     Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  lvol0      new_vg owi-a- 52.00M
  newvgsnap1 new_vg swi-a-  8.00M lvol0    0.20
Copy to Clipboard Toggle word wrap
lvs コマンドで -v 引数を使用すると、デフォルトの表示に seg_countlv_majorlv_minorlv_kernel_majorlv_kernel_minorlv_uuid のフィールドが追加されます。
# lvs -v
    Finding all logical volumes
  LV         VG     #Seg Attr   LSize  Maj Min KMaj KMin Origin Snap%  Move Copy%  Log Convert LV UUID
  lvol0      new_vg    1 owi-a- 52.00M  -1  -1 253  3                                          LBy1Tz-sr23-OjsI-LT03-nHLC-y8XW-EhCl78
  newvgsnap1 new_vg    1 swi-a-  8.00M  -1  -1 253  5    lvol0    0.20                         1ye1OU-1cIu-o79k-20h2-ZGF0-qCJm-CfbsIx
Copy to Clipboard Toggle word wrap
lvs コマンドで --segments 引数を使用すると、セグメント情報を強調したデフォルトのコラムで情報を表示します。segments 引数を使用すると、seg 接頭辞はオプションとなります。デフォルトで lvs --segments コマンドが表示するフィールドは、lv_namevg_namelv_attrstripessegtypeseg_size です。デフォルトの表示は、ボリュームグループ内の vg_namelv_name でソートされ、論理ボリューム内では seg_start でソートされます。論理ボリュームがフラグメント化されている場合、このコマンドの出力は以下を表示します。
# lvs --segments
  LV       VG         Attr   #Str Type   SSize
  LogVol00 VolGroup00 -wi-ao    1 linear  36.62G
  LogVol01 VolGroup00 -wi-ao    1 linear 512.00M
  lv       vg         -wi-a-    1 linear 104.00M
  lv       vg         -wi-a-    1 linear 104.00M
  lv       vg         -wi-a-    1 linear 104.00M
  lv       vg         -wi-a-    1 linear  88.00M
Copy to Clipboard Toggle word wrap
lvs --segments コマンドで -v 引数を使用すると、デフォルトの表示に seg_startstripesizechunksize のフィールドが追加されます。
# lvs -v --segments
    Finding all logical volumes
  LV         VG     Attr   Start SSize  #Str Type   Stripe Chunk
  lvol0      new_vg owi-a-    0  52.00M    1 linear     0     0
  newvgsnap1 new_vg swi-a-    0   8.00M    1 linear     0  8.00K
Copy to Clipboard Toggle word wrap
以下の例は、1 つの設定された論理ボリュームを持つシステム上での lvs コマンドのデフォルト出力を示しています。その後に、segments 引数を指定した lvs コマンドのデフォルト出力を表示しています。
# lvs
  LV    VG     Attr   LSize  Origin Snap%  Move Log Copy%
  lvol0 new_vg -wi-a- 52.00M
# lvs --segments
  LV    VG     Attr   #Str Type   SSize
  lvol0 new_vg -wi-a-    1 linear 52.00M
Copy to Clipboard Toggle word wrap

5.8.3. LVM 報告のソート

通常、lvsvgs、または pvs のコマンドの全出力をソートして、コラムを正しく配置するには、まずそれを生成して内部に格納する必要があります。--unbuffered 引数を指定すると、生成直後にソートされていないままの出力で表示することができます。
別の順列でコラム一覧のソートを指定するには、報告コマンドのいずれかと一緒に -O 引数を使用します。出力自体の中にこれらのフィールドを含める必要はありません。
以下の例では、物理ボリュームの名前、サイズ、および空き領域を表示する pvs コマンドの出力を示しています。
# pvs -o pv_name,pv_size,pv_free
  PV         PSize  PFree
  /dev/sdb1  17.14G 17.14G
  /dev/sdc1  17.14G 17.09G
  /dev/sdd1  17.14G 17.14G
Copy to Clipboard Toggle word wrap
以下の例では、空き領域のフィールドでソートされた同じ出力を示しています。
# pvs -o pv_name,pv_size,pv_free -O pv_free
  PV         PSize  PFree
  /dev/sdc1  17.14G 17.09G
  /dev/sdd1  17.14G 17.14G
  /dev/sdb1  17.14G 17.14G
Copy to Clipboard Toggle word wrap
以下の例では、ソートするフィールドを表示する必要がないことを示しています。
# pvs -o pv_name,pv_size -O pv_free
  PV         PSize
  /dev/sdc1  17.14G
  /dev/sdd1  17.14G
  /dev/sdb1  17.14G
Copy to Clipboard Toggle word wrap
逆順でソートするには、-O 引数の後で指定するフィールドの先頭に - 印を付けます。
# pvs -o pv_name,pv_size,pv_free -O -pv_free
  PV         PSize  PFree
  /dev/sdd1  17.14G 17.14G
  /dev/sdb1  17.14G 17.14G
  /dev/sdc1  17.14G 17.09G
Copy to Clipboard Toggle word wrap

5.8.4. ユニットの指定

LVM 報告表示用の単位を指定するには、報告コマンドに --units 引数を使用します。バイト(b)、キロバイト(k)、メガバイト(m)、ギガバイト(g)、テラバイト(t)、エクサバイト(e)、ペタバイト(p)、および人間が読める表示(h) を指定できます。デフォルトは人間が読める表示です。このデフォルト設定を上書きするには、lvm.conf ファイルの global セクション内の units パラメーターを設定します。
以下の例では、pvs コマンドの出力をデフォルトのギガバイトでなく、メガバイトで指定しています。
# pvs --units m
  PV         VG     Fmt  Attr PSize     PFree
  /dev/sda1         lvm2 --   17555.40M 17555.40M
  /dev/sdb1  new_vg lvm2 a-   17552.00M 17552.00M
  /dev/sdc1  new_vg lvm2 a-   17552.00M 17500.00M
  /dev/sdd1  new_vg lvm2 a-   17552.00M 17552.00M
Copy to Clipboard Toggle word wrap
デフォルトでは、単位は 2 の累乗 (1024 の倍数) で表示されます。単位を 1000 の倍数で表示するには、大文字 (B、K、M、G、T、H) で指定することができます。
以下のコマンドは、デフォルト動作である 1024 の倍数として出力を表示します。
# pvs
  PV         VG     Fmt  Attr PSize  PFree
  /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G
  /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G
  /dev/sdd1  new_vg lvm2 a-   17.14G 17.14G
Copy to Clipboard Toggle word wrap
以下のコマンドは 1000 の倍数として出力を表示します。
#  pvs --units G
  PV         VG     Fmt  Attr PSize  PFree
  /dev/sdb1  new_vg lvm2 a-   18.40G 18.40G
  /dev/sdc1  new_vg lvm2 a-   18.40G 18.35G
  /dev/sdd1  new_vg lvm2 a-   18.40G 18.40G
Copy to Clipboard Toggle word wrap
セクター (512 バイトとして定義) またはカスタム単位も指定できます。
以下の例では、pvs コマンドの出力を、セクター数として表示します。
# pvs --units s
  PV         VG     Fmt  Attr PSize     PFree
  /dev/sdb1  new_vg lvm2 a-   35946496S 35946496S
  /dev/sdc1  new_vg lvm2 a-   35946496S 35840000S
  /dev/sdd1  new_vg lvm2 a-   35946496S 35946496S
Copy to Clipboard Toggle word wrap
以下の例では、pvs コマンドの出力を 4 MB 単位で表示しています。
# pvs --units 4m
  PV         VG     Fmt  Attr PSize    PFree
  /dev/sdb1  new_vg lvm2 a-   4388.00U 4388.00U
  /dev/sdc1  new_vg lvm2 a-   4388.00U 4375.00U
  /dev/sdd1  new_vg lvm2 a-   4388.00U 4388.00U
Copy to Clipboard Toggle word wrap

第6章 LVM 設定の例

この章では、基本的な LVM 設定の例をいくつか紹介します。

6.1. 3つのディスク上での LVM 論理ボリューム作成

この例では、new_logical_volume と言う LVM 論理ボリュームを作成しており、これは、/dev/sda1/dev/sdb1、および /dev/sdc1 で構成されています。

6.1.1. 物理ボリュームの作成

ボリュームグループ内のディスクを使用するには、それらにLVM 物理ボリュームとしてラベルを付けます。

警告

このコマンドは、/dev/sda1/dev/sdb1、および /dev/sdc1 上のデータを破棄します。
# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdc1" successfully created
Copy to Clipboard Toggle word wrap

6.1.2. ボリュームグループの作成

以下のコマンドはボリュームグループ new_vol_group を作成します。
# vgcreate new_vol_group /dev/sda1 /dev/sdb1 /dev/sdc1
  Volume group "new_vol_group" successfully created
Copy to Clipboard Toggle word wrap
vgs コマンドを使用すると、新規ボリュームグループの属性を表示することができます。
# vgs
  VG            #PV #LV #SN Attr   VSize  VFree
  new_vol_group   3   0   0 wz--n- 51.45G 51.45G
Copy to Clipboard Toggle word wrap

6.1.3. 論理ボリュームの作成

以下のコマンドは、ボリュームグループ new_vol_group から、論理ボリューム new_logical_volume を作成します。この例では、ボリュームグループの 2GB を使用する論理ボリュームを作成しています。
# lvcreate -L2G -n new_logical_volume new_vol_group
  Logical volume "new_logical_volume" created
Copy to Clipboard Toggle word wrap

6.1.4. ファイルシステムの作成

以下のコマンドは論理ボリューム上に GFS2 ファイルシステムを作成します。
# mkfs.gfs2 -plock_nolock -j 1 /dev/new_vol_group/new_logical_volume
This will destroy any data on /dev/new_vol_group/new_logical_volume.

Are you sure you want to proceed? [y/n] y

Device:                    /dev/new_vol_group/new_logical_volume
Blocksize:                 4096
Filesystem Size:           491460
Journals:                  1
Resource Groups:           8
Locking Protocol:          lock_nolock
Lock Table:

Syncing...
All Done
Copy to Clipboard Toggle word wrap
以下のコマンドは、論理ボリュームをマウントして、ファイルシステムディスクの領域使用率を報告します。
# mount /dev/new_vol_group/new_logical_volume /mnt
[root@tng3-1 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/new_vol_group/new_logical_volume
                       1965840        20   1965820   1% /mnt
Copy to Clipboard Toggle word wrap

6.2. ストライプ化論理ボリュームの作成

この例では、striped_logical_volume と言う LVM ストライプ化論理ボリュームを作成しており、これは /dev/sda1/dev/sdb1、および /dev/sdc1 のディスクに渡ってデータをストライプ化しています。

6.2.1. 物理ボリュームの作成

ボリュームグループ内で使用するディスクに LVM 物理ボリュームとしてラベルを付けます。

警告

このコマンドは、/dev/sda1/dev/sdb1、および /dev/sdc1 上のデータを破棄します。
# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdc1" successfully created
Copy to Clipboard Toggle word wrap

6.2.2. ボリュームグループの作成

以下のコマンドはボリュームグループ volgroup01 を作成します。
# vgcreate volgroup01 /dev/sda1 /dev/sdb1 /dev/sdc1
  Volume group "volgroup01" successfully created
Copy to Clipboard Toggle word wrap
vgs コマンドを使用すると、新規ボリュームグループの属性を表示することができます。
# vgs
  VG                #PV #LV #SN Attr   VSize  VFree
  volgroup01          3   0   0 wz--n- 51.45G 51.45G
Copy to Clipboard Toggle word wrap

6.2.3. 論理ボリュームの作成

以下のコマンドは、ボリュームグループ volgroup01 から ストライプ化論理ボリューム striped_logical_volume を作成します。この例では、2 ギガバイトサイズで、ストライプサイズが4キロバイトのストライプを3つを持つ論理ボリュームを作成します。
# lvcreate -i3 -I4 -L2G -nstriped_logical_volume volgroup01
  Rounding size (512 extents) up to stripe boundary size (513 extents)
  Logical volume "striped_logical_volume" created
Copy to Clipboard Toggle word wrap

6.2.4. ファイルシステムの作成

以下のコマンドは論理ボリューム上に GFS2 ファイルシステムを作成します。
# mkfs.gfs2 -plock_nolock -j 1 /dev/volgroup01/striped_logical_volume
This will destroy any data on /dev/volgroup01/striped_logical_volume.

Are you sure you want to proceed? [y/n] y

Device:                    /dev/volgroup01/striped_logical_volume
Blocksize:                 4096
Filesystem Size:           492484
Journals:                  1
Resource Groups:           8
Locking Protocol:          lock_nolock
Lock Table:

Syncing...
All Done
Copy to Clipboard Toggle word wrap
以下のコマンドは、論理ボリュームをマウントして、ファイルシステムディスクの領域使用率を報告します。
# mount /dev/volgroup01/striped_logical_volume /mnt
[root@tng3-1 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      13902624   1656776  11528232  13% /
/dev/hda1               101086     10787     85080  12% /boot
tmpfs                   127880         0    127880   0% /dev/shm
/dev/volgroup01/striped_logical_volume
                       1969936        20   1969916   1% /mnt
Copy to Clipboard Toggle word wrap

6.3. ボリュームグループの分割

この例では、既存ボリュームグループは3つの物理ボリュームから構成されています。これらの 物理ボリュームに十分な未使用領域があれば、新しくディスクを追加しないで新規のボリュームグループを作成することができます。
最初のセットアップでは、論理ボリューム mylv は、ボリュームグループ myvol から作成され、そのボリュームグループは、/dev/sda1/dev/sdb1、および /dev/sdc1 の3つの物理ボリュームで構成されます。
この手順を完了した後には、ボリュームグループ myvg/dev/sda1/dev/sdb1 で構成されます。2つ目のボリュームグループ yourvg/dev/sdc1 で構成されます。

6.3.1. 空き領域の測定

pvscan コマンドを使用すると、どの位の空き領域が現在ボリュームグループで利用可能かを測定することができます。
# pvscan
  PV /dev/sda1  VG myvg   lvm2 [17.15 GB / 0    free]
  PV /dev/sdb1  VG myvg   lvm2 [17.15 GB / 12.15 GB free]
  PV /dev/sdc1  VG myvg   lvm2 [17.15 GB / 15.80 GB free]
  Total: 3 [51.45 GB] / in use: 3 [51.45 GB] / in no VG: 0 [0   ]
Copy to Clipboard Toggle word wrap

6.3.2. データの移動

pvmove コマンドを使用して、/dev/sdc1 内の すべての使用中物理エクステントを /dev/sdb1 に移動することができます。pvmove コマンドはその実行に長時間を要します。
# pvmove /dev/sdc1 /dev/sdb1
  /dev/sdc1: Moved: 14.7%
  /dev/sdc1: Moved: 30.3%
  /dev/sdc1: Moved: 45.7%
  /dev/sdc1: Moved: 61.0%
  /dev/sdc1: Moved: 76.6%
  /dev/sdc1: Moved: 92.2%
  /dev/sdc1: Moved: 100.0%
Copy to Clipboard Toggle word wrap
データを移動した後は、/dev/sdc1 上のすべての領域が空きになっていることが分ります。
# pvscan
  PV /dev/sda1   VG myvg   lvm2 [17.15 GB / 0    free]
  PV /dev/sdb1   VG myvg   lvm2 [17.15 GB / 10.80 GB free]
  PV /dev/sdc1   VG myvg   lvm2 [17.15 GB / 17.15 GB free]
  Total: 3 [51.45 GB] / in use: 3 [51.45 GB] / in no VG: 0 [0   ]
Copy to Clipboard Toggle word wrap

6.3.3. ボリュームグループの分割

新規のボリュームグループ yourvg を作成するには、vgsplit コマンドを使用して、ボリュームグループ myvg を分割します。
ボリュームグループを分割する前に、論理ボリュームは停止している必要があります。ファイルシステムがマウントされている場合は、論理ボリュームを停止する前にそのファイルシステムをアンマウントしなければなりません。
ボリュームグループを停止するには lvchange コマンド、または、 vgchange コマンドを使用します。以下のコマンドは論理ボリューム mylv を非アクティブ化して、ボリュームグループ myvg から ボリュームグループ yourvg を分離させて、物理ボリューム /dev/sdc1 をその新規のボリュームグループ yourvg に移動させます。
# lvchange -a n /dev/myvg/mylv
# vgsplit myvg yourvg /dev/sdc1
  Volume group "yourvg" successfully split from "myvg"
Copy to Clipboard Toggle word wrap
vgs を使用すると、2つのボリュームグループの属性を確認できます。
# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  myvg     2   1   0 wz--n- 34.30G 10.80G
  yourvg   1   0   0 wz--n- 17.15G 17.15G
Copy to Clipboard Toggle word wrap

6.3.4. 新規論理ボリュームの作成

新規のボリュームグループを作成した後は、新規の論理ボリューム yourlv を作成することができます。
# lvcreate -L5G -n yourlv yourvg
  Logical volume "yourlv" created
Copy to Clipboard Toggle word wrap

6.3.5. ファイルシステムの作成と新規論理ボリュームのマウント

新しい論理ボリューム上にファイルシステムを作成して、それをマウントすることができます。
#  mkfs.gfs2 -plock_nolock -j 1 /dev/yourvg/yourlv
This will destroy any data on /dev/yourvg/yourlv.

Are you sure you want to proceed? [y/n] y

Device:                    /dev/yourvg/yourlv
Blocksize:                 4096
Filesystem Size:           1277816
Journals:                  1
Resource Groups:           20
Locking Protocol:          lock_nolock
Lock Table:

Syncing...
All Done

[root@tng3-1 ~]# mount /dev/yourvg/yourlv /mnt
Copy to Clipboard Toggle word wrap

6.3.6. オリジナル論理ボリュームのアクティブ化とマウント

論理ボリューム mylv を非アクティブ化しなければならなかったため、マウントできるようにする前に、それを再度アクティブ化する必要があります。
# lvchange -a y /dev/myvg/mylv

[root@tng3-1 ~]# mount /dev/myvg/mylv /mnt
[root@tng3-1 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/yourvg/yourlv    24507776        32  24507744   1% /mnt
/dev/myvg/mylv        24507776        32  24507744   1% /mnt
Copy to Clipboard Toggle word wrap

6.4. 論理ボリュームからのディスクの削除

この例では、ディスクを置き換えるために、あるいは異なるボリュームの一部としてディスクを使用するために、既存の論理ボリュームからディスクを削除する方法を示しています。ディスクを削除するには、まず、LVM 物理ボリューム上のエクステントを異なるディスク、またはディスクセットに移動しなければなりません。

6.4.1. 既存物理ボリュームへのエクステントの移動

この例では、論理ボリュームはボリュームグループ myvg の4つの物理ボリュームに渡って分配されています。
# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdb1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G 15.00G
Copy to Clipboard Toggle word wrap
/dev/sdb1 からエクステントを移動して、ボリュームグループから削除できるようにします。
ボリュームグループ内の他の物理ボリューム上に十分な空きのエクステントがある場合、その削除したいデバイス上でオプション無しで pvmove コマンドを実行すると、それらのエクステントは他のデバイスに分配されるようになります。
# pvmove /dev/sdb1
  /dev/sdb1: Moved: 2.0%
 ...
  /dev/sdb1: Moved: 79.2%
 ...
  /dev/sdb1: Moved: 100.0%
Copy to Clipboard Toggle word wrap
pvmove コマンドの実行が終了した後は、エクステントの分配は次のようになります:
# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1  myvg lvm2 a-   17.15G  7.15G 10.00G
  /dev/sdb1  myvg lvm2 a-   17.15G 17.15G     0
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G 15.00G
Copy to Clipboard Toggle word wrap
vgreduce コマンドを使用して、ボリュームグループから物理ボリューム /dev/sdb1 を削除することができます。
# vgreduce myvg /dev/sdb1
  Removed "/dev/sdb1" from volume group "myvg"
[root@tng3-1 ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/sda1  myvg lvm2 a-   17.15G  7.15G
  /dev/sdb1       lvm2 --   17.15G 17.15G
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G
Copy to Clipboard Toggle word wrap
これでディスクは物理的に削除可能となり、他のユーザーへの割り当ても可能になります。

6.4.2. 新規ディスクへのエクステントの移動

この例では、論理ボリュームは、以下のようにボリュームグループ myvg 内の3つの物理ボリュームに渡って分配されています。
# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1  myvg lvm2 a-   17.15G  7.15G 10.00G
  /dev/sdb1  myvg lvm2 a-   17.15G 15.15G  2.00G
  /dev/sdc1  myvg lvm2 a-   17.15G 15.15G  2.00G
Copy to Clipboard Toggle word wrap
/dev/sdb1 のエクステントを新しいデバイス /dev/sdd1 に移動してみましょう。
6.4.2.1. 新規物理ボリュームの作成
/dev/sdd1 から新規の物理ボリュームを作成します。
# pvcreate /dev/sdd1
  Physical volume "/dev/sdd1" successfully created
Copy to Clipboard Toggle word wrap
6.4.2.2. ボリュームグループへの新規物理ボリュームの追加
/dev/sdd1 を既存のボリュームグループ myvg に追加します。
# vgextend myvg /dev/sdd1
  Volume group "myvg" successfully extended
[root@tng3-1]# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1   myvg lvm2 a-   17.15G  7.15G 10.00G
  /dev/sdb1   myvg lvm2 a-   17.15G 15.15G  2.00G
  /dev/sdc1   myvg lvm2 a-   17.15G 15.15G  2.00G
  /dev/sdd1   myvg lvm2 a-   17.15G 17.15G     0
Copy to Clipboard Toggle word wrap
6.4.2.3. データの移動
pvmove を使用して、データを /dev/sdb1 から /dev/sdd1 へ移動します。
# pvmove /dev/sdb1 /dev/sdd1
  /dev/sdb1: Moved: 10.0%
...
  /dev/sdb1: Moved: 79.7%
...
  /dev/sdb1: Moved: 100.0%

[root@tng3-1]# pvs -o+pv_used
  PV          VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1   myvg lvm2 a-   17.15G  7.15G 10.00G
  /dev/sdb1   myvg lvm2 a-   17.15G 17.15G     0
  /dev/sdc1   myvg lvm2 a-   17.15G 15.15G  2.00G
  /dev/sdd1   myvg lvm2 a-   17.15G 15.15G  2.00G
Copy to Clipboard Toggle word wrap
6.4.2.4. ボリュームグループからの古い物理ボリュームの削除
データを /dev/sdb1 から移動したら、それをボリュームグループから削除することができます。
# vgreduce myvg /dev/sdb1
  Removed "/dev/sdb1" from volume group "myvg"
Copy to Clipboard Toggle word wrap
これで、このディスクを別のボリュームグループに再割り当てしたり、システムから削除することができるようになります。

6.5. クラスター内でのミラー化 LVM 論理ボリュームの作成

クラスター内にミラー化 LVM 論理ボリュームを作成するには、単一ノード上にミラー化 LVM 論理ボリュームを作成するのと同一のコマンドと手順が必要です。しかし、クラスター内にミラー化 LVM ボリュームを作成するには、クラスターとクラスターミラーインフラストラクチャーが稼働中で、クラスターが定足数を満たしており、かつクラスターのロッキングを有効にするように lvm.conf ファイル内のロッキングタイプが正しく設定されている必要があります。これは、「クラスター内での LVM ボリューム作成」 で説明しているように、直接もしくは lvmconf のコマンドを使用して行います。
クラスター内でミラー化された LVM ボリュームを作成するには、以下の手順で行います。この手順では、最初に、クラスターサービスがインストール済みで稼働しているかをチェックし、次にミラー化ボリュームを作成します。
  1. クラスター内のすべてのノードが共有するミラー化論理ボリュームを作成するには、クラスターの各ノード内の lvm.conf ファイル内でロッキングタイプを正しくセットする必要があります。デフォルトでは、ロッキングタイプは、ローカルに設定されます。これを変更するには、クラスターの各ノードで以下のコマンドを実行し、クラスター化したロッキングを有効にします。
    # /sbin/lvmconf --enable-cluster
    Copy to Clipboard Toggle word wrap

    注記

    As of Red Hat Enterprise Linux 6.7, the lvmconf command provides a --services option that will also enable the services required for LVM in a cluster, a --mirrorservice option that enables the cmirrord service, and a --startstopservices option that immediately starts or stops the services that have been enabled. For information on the lvmconf command, see the lvmconf man page.
  2. クラスター化論理ボリュームを作成するには、クラスター内のすべてのノード上でクラスターインフラストラクチャーが稼動中である必要があります。以下の例では clvmd デーモンが発行されたノード上で稼働中であることを検証します。
     ps auxw | grep clvmd
    root     17642  0.0  0.1 32164 1072 ?        Ssl  Apr06   0:00 clvmd -T20 -t 90
    
    Copy to Clipboard Toggle word wrap
    以下のコマンドは、クラスターステータスのローカルビューを表示します。
    # cman_tool services
    fence domain
    member count  3
    victim count  0
    victim now    0
    master nodeid 2
    wait state    none
    members       1 2 3
    
    dlm lockspaces
    name          clvmd
    id            0x4104eefa
    flags         0x00000000
    change        member 3 joined 1 remove 0 failed 0 seq 1,1
    members       1 2 3
    
    Copy to Clipboard Toggle word wrap
  3. cmirror パッケージがインストールされていることを確認します。
  4. cmirrord サービスを開始します。
    # service cmirrord start
    Starting cmirrord:                                         [  OK  ]
    
    Copy to Clipboard Toggle word wrap
  5. ミラーを作成します。最初のステップは、物理ボリュームの作成です。次のコマンドは、3つの物理ボリュームを作成します。そのうちの2つの物理ボリュームは、ミラーレッグとして使用され、3つめの物理ボリュームにはミラーログが格納されます。
    # pvcreate /dev/sdb1
      Physical volume "/dev/sdb1" successfully created
    [root@doc-07 ~]# pvcreate /dev/sdc1
      Physical volume "/dev/sdc1" successfully created
    [root@doc-07 ~]# pvcreate /dev/sdd1
      Physical volume "/dev/sdd1" successfully created
    
    Copy to Clipboard Toggle word wrap
  6. ボリュームグループを作成します。この例では、前のステップで作成された3つの物理ボリュームで構成される、ボリュームグループ vg001 を作成します。
    # vgcreate vg001 /dev/sdb1 /dev/sdc1 /dev/sdd1
      Clustered volume group "vg001" successfully created
    
    Copy to Clipboard Toggle word wrap
    vgcreate コマンドの出力に、ボリュームグループがクラスター化されていることが示されている点に注意してください。ボリュームグループの属性を表示する vgs コマンドを使用すると、ボリュームグループがクラスター化されていることを検証することができます。ボリュームグループがクラスター化されている場合は、c 属性が表示されます。
     vgs vg001
      VG       #PV #LV #SN Attr   VSize  VFree
      vg001      3   0   0 wz--nc 68.97G 68.97G
    
    Copy to Clipboard Toggle word wrap
  7. ミラー化論理ボリュームを作成します。この例では、ボリュームグループ vg001 から論理ボリューム mirrorlv を作成します。このボリュームのミラーレッグは1つです。この例では、物理ボリュームのどのエクステントが論理ボリュームに使用されるかを指定します。
    # lvcreate -l 1000 -m1 vg001 -n mirrorlv /dev/sdb1:1-1000 /dev/sdc1:1-1000 /dev/sdd1:0
      Logical volume "mirrorlv" created
    
    Copy to Clipboard Toggle word wrap
    lvs コマンドを使用すると、ミラー作成の進捗状況を表示することができます。以下の例では、ミラーの同期が、47%、91% と進み、ミラー完了時には 100% 同期したことを示しています。
    # lvs vg001/mirrorlv
      LV       VG       Attr   LSize Origin Snap%  Move Log           Copy%  Convert
      mirrorlv vg001    mwi-a- 3.91G                    vg001_mlog     47.00
    [root@doc-07 log]# lvs vg001/mirrorlv
      LV       VG       Attr   LSize Origin Snap%  Move Log           Copy%  Convert
      mirrorlv vg001    mwi-a- 3.91G                    vg001_mlog     91.00   
    [root@doc-07 ~]#  lvs vg001/mirrorlv
      LV       VG       Attr   LSize Origin Snap%  Move Log           Copy%  Convert
      mirrorlv vg001    mwi-a- 3.91G                    vg001_mlog    100.00
    
    Copy to Clipboard Toggle word wrap
    ミラー完了は、システムログに記録されます:
    May 10 14:52:52 doc-07 [19402]: Monitoring mirror device vg001-mirrorlv for events
    May 10 14:55:00 doc-07 lvm[19402]: vg001-mirrorlv is now in-sync
    
    Copy to Clipboard Toggle word wrap
  8. lvs-o +devices のオプションを併せてを使用すると、ミラーの設定を表示することができます。これには、どのデバイスがミラーレッグを構成しているかが含まれます。この例では、論理ボリュームが2つのリニアイメージと1つのログで構成されていることがわかります。
    # lvs -a -o +devices
      LV                  VG         Attr   LSize  Origin Snap%  Move Log           Copy%  Convert Devices                                  
      mirrorlv            vg001      mwi-a-  3.91G                    mirrorlv_mlog 100.00         mirrorlv_mimage_0(0),mirrorlv_mimage_1(0)
      [mirrorlv_mimage_0] vg001      iwi-ao  3.91G                                                 /dev/sdb1(1)                            
      [mirrorlv_mimage_1] vg001      iwi-ao  3.91G                                                 /dev/sdc1(1)                            
      [mirrorlv_mlog]     vg001      lwi-ao  4.00M                                                 /dev/sdd1(0)
    
    Copy to Clipboard Toggle word wrap
    lvsseg_pe_ranges オプションを使用すると、データレイアウトを表示することができます。このオプションを使用して、レイアウトに適切な冗長性があることを検証することが可能です。このコマンドのアウトプットは、lvcreate および lvresize のコマンドが入力として受け取るのと同一のフォーマットでPE 範囲を表示します。
    # lvs -a -o +seg_pe_ranges --segments
      PE Ranges                                      
      mirrorlv_mimage_0:0-999 mirrorlv_mimage_1:0-999
      /dev/sdb1:1-1000                              
      /dev/sdc1:1-1000                              
      /dev/sdd1:0-0
    
    Copy to Clipboard Toggle word wrap

注記

LVMミラー化ボリュームのいずれかのレッグに障害が発生した際の回復についての情報は、「LVM ミラー障害からの回復」 をご覧ください。

第7章 LVM トラブルシューティング

この章では、様々な LVM 問題のトラブルシューティングについて説明します。

7.1. トラブルシューティング診断

コマンドが期待通りに機能しない場合は、以下の方法で診断情報を収集できます:
  • 任意のコマンドに -v-vv-vvv-vvvv のいずれかの引数を使用して、出力の詳細レベルを徐々に高くしてゆくことができます
  • 問題が論理ボリュームのアクティブ化に関連している場合は、設定ファイルの「log」セクションで activation = 1 とセットして、-vvvv 引数を付けてコマンドを実行します。この出力を検証し終わった後には、このパラメーターを 0 にリセットして、低メモリー状況で起こり得るマシンのロッキング問題を回避します。
  • lvmdump コマンドを実行すると、診断目的の情報ダンプを提供します。詳細は lvmdump(8) man ページでご覧ください。
  • 追加のシステム情報を得るには、lvs -vpvs -a、または dmsetup info -c のコマンドを実行します。
  • /etc/lvm/backup ファイル内の最後のメタデータバックアップと /etc/lvm/archive ファイル内のアーカイブバージョンを検証します。
  • Check the current configuration information by running the lvmconfig command.
  • どのデバイスが物理ボリュームを持っているかの記録を調べるために /etc/lvm ディレクトリ内の .cache ファイルをチェックします。

7.2. 障害の発生したデバイスの情報表示

lvsvgs コマンドに -P 引数を使用すると、他の方法では出力に表示されないような障害ボリュームに関する情報を表示することができます。この引数は、メタデータが内部で完全に一貫していない場合でも、一部の操作を許可します。例えば、ボリュームグループ vg を構成するデバイスの1つに障害が発生した場合、vgs コマンドで以下のような出力が表示される場合があります。
# vgs -o +devices
  Volume group "vg" not found
Copy to Clipboard Toggle word wrap
vgs コマンドで -P オプションを指定すると、ボリュームグループはまだ使用不可ですが、障害のあるデバイスに関する、より多く情報を確認することができます。
# vgs -P -o +devices
  Partial mode. Incomplete volume groups will be activated read-only.
  VG   #PV #LV #SN Attr   VSize VFree Devices
  vg     9   2   0 rz-pn- 2.11T 2.07T unknown device(0)
  vg     9   2   0 rz-pn- 2.11T 2.07T unknown device(5120),/dev/sda1(0)
Copy to Clipboard Toggle word wrap
この例では、障害デバイスはボリュームグループ内のリニアとストライプの両方の論理ボリュームの障害の原因になっています。-P 引数を付けない lvs コマンドでは、以下のような出力が表示されます。
# lvs -a -o +devices
  Volume group "vg" not found
Copy to Clipboard Toggle word wrap
-P 引数を使用すると、障害の発生した論理ボリュームが表示されます。
# lvs -P -a -o +devices
  Partial mode. Incomplete volume groups will be activated read-only.
  LV     VG   Attr   LSize  Origin Snap%  Move Log Copy%  Devices
  linear vg   -wi-a- 20.00G                               unknown device(0)
  stripe vg   -wi-a- 20.00G                               unknown device(5120),/dev/sda1(0)
Copy to Clipboard Toggle word wrap
以下の例では、ミラー化論理ボリュームの1つのレッグに障害が発生した場合における、-P 引数を指定した pvslvs コマンドの出力を示しています。
#  vgs -a -o +devices -P
  Partial mode. Incomplete volume groups will be activated read-only.
  VG    #PV #LV #SN Attr   VSize VFree Devices
  corey   4   4   0 rz-pnc 1.58T 1.34T my_mirror_mimage_0(0),my_mirror_mimage_1(0)
  corey   4   4   0 rz-pnc 1.58T 1.34T /dev/sdd1(0)
  corey   4   4   0 rz-pnc 1.58T 1.34T unknown device(0)
  corey   4   4   0 rz-pnc 1.58T 1.34T /dev/sdb1(0)
Copy to Clipboard Toggle word wrap
# lvs -a -o +devices -P
  Partial mode. Incomplete volume groups will be activated read-only.
  LV                   VG    Attr   LSize   Origin Snap%  Move Log            Copy%  Devices
  my_mirror            corey mwi-a- 120.00G                    my_mirror_mlog   1.95 my_mirror_mimage_0(0),my_mirror_mimage_1(0)
  [my_mirror_mimage_0] corey iwi-ao 120.00G                                          unknown device(0)
  [my_mirror_mimage_1] corey iwi-ao 120.00G                                          /dev/sdb1(0)
  [my_mirror_mlog]     corey lwi-ao   4.00M                                          /dev/sdd1(0)
Copy to Clipboard Toggle word wrap

7.3. LVM ミラー障害からの回復

This section provides an example of recovering from a situation where one leg of an LVM mirrored volume fails because the underlying device for a physical volume goes down and the mirror_log_fault_policy parameter is set to remove, requiring that you manually rebuild the mirror. For information on setting the mirror_log_fault_policy parameter, see 「ミラー化論理ボリュームの障害ポリシー」.
ミラーレッグに障害が発生すると、LVM はミラー化ボリュームをリニアボリュームに変換します。このボリュームは、以前と同様に動作を継続しますが、ミラー化による冗長性はありません。この時点で、代替物理デバイスとして使用し、ミラーを再構築するために新たなディスクデバイスをシステムに追加することができます。
以下のコマンドは、ミラー用に使用される物理ボリューム群を作成します。
# pvcreate /dev/sd[abcdefgh][12]
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sda2" successfully created
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdb2" successfully created
  Physical volume "/dev/sdc1" successfully created
  Physical volume "/dev/sdc2" successfully created
  Physical volume "/dev/sdd1" successfully created
  Physical volume "/dev/sdd2" successfully created
  Physical volume "/dev/sde1" successfully created
  Physical volume "/dev/sde2" successfully created
  Physical volume "/dev/sdf1" successfully created
  Physical volume "/dev/sdf2" successfully created
  Physical volume "/dev/sdg1" successfully created
  Physical volume "/dev/sdg2" successfully created
  Physical volume "/dev/sdh1" successfully created
  Physical volume "/dev/sdh2" successfully created
Copy to Clipboard Toggle word wrap
以下のコマンドはボリュームグループ vg とミラー化ボリューム groupfs を作成します。
# vgcreate vg /dev/sd[abcdefgh][12]
  Volume group "vg" successfully created
[root@link-08 ~]# lvcreate -L 750M -n groupfs -m 1 vg /dev/sda1 /dev/sdb1 /dev/sdc1
  Rounding up size to full physical extent 752.00 MB
  Logical volume "groupfs" created
Copy to Clipboard Toggle word wrap
lvs コマンドを使用すると、ミラー化ボリュームのレイアウトとミラーレッグ用に配下のデバイスとミラーログを確認できます。最初の例ではミラーは完全には同期化されていないことに注意してください。Copy% フィールドが 100.00 に なるまで待ってから継続する必要があります。
# lvs -a -o +devices
  LV                 VG   Attr   LSize   Origin Snap%  Move Log          Copy% Devices
  groupfs            vg   mwi-a- 752.00M                    groupfs_mlog 21.28 groupfs_mimage_0(0),groupfs_mimage_1(0)
  [groupfs_mimage_0] vg   iwi-ao 752.00M                                       /dev/sda1(0)
  [groupfs_mimage_1] vg   iwi-ao 752.00M                                       /dev/sdb1(0)
  [groupfs_mlog]     vg   lwi-ao   4.00M                                       /dev/sdc1(0)

[root@link-08 ~]# lvs -a -o +devices
  LV                 VG   Attr   LSize   Origin Snap%  Move Log          Copy%  Devices
  groupfs            vg   mwi-a- 752.00M                    groupfs_mlog 100.00 groupfs_mimage_0(0),groupfs_mimage_1(0)
  [groupfs_mimage_0] vg   iwi-ao 752.00M                                        /dev/sda1(0)
  [groupfs_mimage_1] vg   iwi-ao 752.00M                                        /dev/sdb1(0)
  [groupfs_mlog]     vg   lwi-ao   4.00M     i                                  /dev/sdc1(0)
Copy to Clipboard Toggle word wrap
この例では、ミラーのプライマリレッグ /dev/sda1 に障害が発生しています。ミラー化 ボリュームへの書き込みアクティビティーはいずれも LVM がミラーの障害を検知する結果となります。 これが発生すると、LVM はミラーを単一のリニアボリュームに変換します。この場合は、この変換をトリガーするために、dd コマンドを実行します。
# dd if=/dev/zero of=/dev/vg/groupfs count=10
10+0 records in
10+0 records out
Copy to Clipboard Toggle word wrap
lvs コマンドを使用して、デバイスが現在リニアデバイスであることを確認することができます。障害が発生したディスクが原因で I/O エラーが発生します。
# lvs -a -o +devices
  /dev/sda1: read failed after 0 of 2048 at 0: Input/output error
  /dev/sda2: read failed after 0 of 2048 at 0: Input/output error
  LV      VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  groupfs vg   -wi-a- 752.00M                               /dev/sdb1(0)
Copy to Clipboard Toggle word wrap
この時点では、論理ボリュームは使用することができるはずですが、ミラーの冗長性がなくなります。
ミラー化ボリュームを再構築するには、破損したボリュームを交換して、物理ボリュームを再作成します。新規ディスクに交換せずに同じディスクを使用すると、pvcreate コマンドを実行した時に、"inconsistent" の警告が 表示されます。この警告が表示されないようにするには、vgreduce --removemissing のコマンドを実行してください。
# pvcreate /dev/sdi[12]
  Physical volume "/dev/sdi1" successfully created
  Physical volume "/dev/sdi2" successfully created

[root@link-08 ~]# pvscan
  PV /dev/sdb1   VG vg   lvm2 [67.83 GB / 67.10 GB free]
  PV /dev/sdb2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdg1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdg2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdh1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdh2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdi1           lvm2 [603.94 GB]
  PV /dev/sdi2           lvm2 [603.94 GB]
  Total: 16 [2.11 TB] / in use: 14 [949.65 GB] / in no VG: 2 [1.18 TB]
Copy to Clipboard Toggle word wrap
次に、新規物理ボリュームでオリジナルボリュームグループを拡張します。
# vgextend vg /dev/sdi[12]
  Volume group "vg" successfully extended

# pvscan
  PV /dev/sdb1   VG vg   lvm2 [67.83 GB / 67.10 GB free]
  PV /dev/sdb2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdg1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdg2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdh1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdh2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdi1   VG vg   lvm2 [603.93 GB / 603.93 GB free]
  PV /dev/sdi2   VG vg   lvm2 [603.93 GB / 603.93 GB free]
  Total: 16 [2.11 TB] / in use: 16 [2.11 TB] / in no VG: 0 [0   ]
Copy to Clipboard Toggle word wrap
リニアボリュームが元のミラー状態に戻るように変換します。
# lvconvert -m 1 /dev/vg/groupfs /dev/sdi1 /dev/sdb1 /dev/sdc1
  Logical volume mirror converted.
Copy to Clipboard Toggle word wrap
lvs コマンドを使用すると、ミラーが復元したことを確認できます。
# lvs -a -o +devices
  LV                 VG   Attr   LSize   Origin Snap%  Move Log          Copy% Devices
  groupfs            vg   mwi-a- 752.00M                    groupfs_mlog 68.62 groupfs_mimage_0(0),groupfs_mimage_1(0)
  [groupfs_mimage_0] vg   iwi-ao 752.00M                                       /dev/sdb1(0)
  [groupfs_mimage_1] vg   iwi-ao 752.00M                                       /dev/sdi1(0)
  [groupfs_mlog]     vg   lwi-ao   4.00M                                       /dev/sdc1(0)
Copy to Clipboard Toggle word wrap

7.4. 物理ボリュームメタデータの復元

物理ボリュームのボリュームグループメタデータが誤って上書きされたり、破棄されたりした場合は、メタデータエリアが正しくないこと、またはシステムが特定の UUID を持つ物理ボリュームを見つけることができないことを示すエラーメッセージが出ます。物理ボリュームのデータを復元するには、紛失したメタデータと同じ UUID を指定して、物理ボリューム上に新規のメタデータエリアを書き込みます。

警告

機能している LVM 論理ボリュームについては、この手順を試みないでください。間違った UUID を指定するとデータ損失の原因となります。
以下の例では、メタデータエリアが欠如していたり、破損している場合に表示される出力の種類を示しています。
# lvs -a -o +devices
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  Couldn't find all physical volumes for volume group VG.
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  Couldn't find all physical volumes for volume group VG.
  ...
Copy to Clipboard Toggle word wrap
上書きされている物理ボリュームの UUID は、/etc/lvm/archive ディレクトリを 開けば見つけることができます。そのボリュームの最後の有効なアーカイブ化した LVM メタデータの VolumeGroupName_xxxx.vg ファイルを確認します。
別の方法としては、そのボリュームを停止して、partial (-P) 引数をセットすると欠如/破損した物理ボリュームの UUID を見つけることができます。
# vgchange -an --partial
  Partial mode. Incomplete volume groups will be activated read-only.
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
  ...
Copy to Clipboard Toggle word wrap
pvcreate コマンドで、--uuid--restorefile 引数を使用して、物理ボリュームの復元をします。以下の例では、/dev/sdh1 デバイスを上記の UUID (FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk) を持つ物理ボリュームとしてラベルを付けます。このコマンドがボリュームグループ用の最も最近の正しいアーカイブのメタデータ VG_00050.vg に含まれているメタデータ情報で ボリュームグループラベルを復元します。restorefile 引数は、ボリュームグループ上の古いものと互換性のある新規物理ボリュームを作るように pvcreate コマンドに指示をして、新規のメタデータが古い物理ボリュームが含んでいたデータの場所に配置されないように確認します。(これは、例えば、複製元の pvcreate コマンドが、メタデータの配置を制御をするコマンドライン引数を使用していた場合や、物理ボリュームが当初、異なるデフォルトを使用するソフトウェアの異なるバージョンを使用して作成されていた場合などに発生する可能性があります)。pvcreate コマンドは LVM メタデータ領域のみを上書きし、既存のデータ領域には影響を与えません。
# pvcreate --uuid "FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk" --restorefile /etc/lvm/archive/VG_00050.vg /dev/sdh1
  Physical volume "/dev/sdh1" successfully created
Copy to Clipboard Toggle word wrap
その後に、vgcfgrestore コマンドを使用して、ボリュームグループのメタデータを復元することができます。
# vgcfgrestore VG
  Restored volume group VG
Copy to Clipboard Toggle word wrap
これで論理ボリュームが表示できるようになります。
# lvs -a -o +devices
  LV     VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  stripe VG   -wi--- 300.00G                               /dev/sdh1 (0),/dev/sda1(0)
  stripe VG   -wi--- 300.00G                               /dev/sdh1 (34728),/dev/sdb1(0)
Copy to Clipboard Toggle word wrap
以下のコマンドはボリュームをアクティブ化してそのアクティブになったボリュームを表示します。
# lvchange -ay /dev/VG/stripe
[root@link-07 backup]# lvs -a -o +devices
  LV     VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  stripe VG   -wi-a- 300.00G                               /dev/sdh1 (0),/dev/sda1(0)
  stripe VG   -wi-a- 300.00G                               /dev/sdh1 (34728),/dev/sdb1(0)
Copy to Clipboard Toggle word wrap
オンディスク LVM メタデータが、それを書き換えるデータと同じ容量である場合、このコマンドは物理ボリュームを復元できます。メタデータの書き換えがメタデータエリアを越えた場合、ボリューム上のデータは影響を受ける可能性があります。そのデータを復元するには、fsck コマンドを使用すると良いでしょう。

7.5. 紛失した物理ボリュームの入れ替え

物理ボリュームに障害が発生した場合、あるいは交換の必要がある場合、「物理ボリュームメタデータの復元」 で説明したように、物理ボリュームメタデータを復元するのと同じ手順に従って、既存ボリュームグループ内の紛失した物理ボリュームと交換する新しい物理ボリュームにラベルを付けることができます。vgdisplay コマンドで --partial--verbose 引数を使用すると、すでに存在しない物理ボリュームの UUID およびサイズを表示することができます。もう1つ同じサイズの物理ボリュームを置き換えたい場合は、pvcreate コマンドで --restorefile--uuid 引数を使用して、紛失した物理ボリュームと同じ UUID を持つ新規デバイスを初期化することができます。その後、vgcfgrestore コマンドを使用してボリュームグループのメタデータを復元します。

7.6. 紛失した物理ボリュームのボリュームグループからの削除

物理ボリュームが無くなった場合、ボリュームグループ内の残りの物理ボリュームをアクティブ化するには、vgchange コマンドで --partial 引数を使用します。その物理ボリュームを使用していた論理ボリュームのすべてをボリュームグループから取り除くには vgreduce コマンドで --removemissing 引数を使用します。
vgreduce コマンドで --test 引数を使用することで、何を破棄しようとしているのかを先に検証することを推奨します。
ほとんどの LVM 操作と同じく、vgcfgrestore コマンドを直後に使用して、ボリュームグループメタデータをその以前の状態に戻すならば、ある意味で、vgreduce コマンドは反転可能です。例えば、--test 引数なしで vgreduce コマンドで、--removemissing 引数を使用して、保存するつもりだった論理ボリュームを削除してしまった場合、まだその物理ボリュームの入れ替えは可能であり、vgcfgrestore コマンドを使用して、ボリュームグループを以前の状態に戻すことができます。

7.7. 論理ボリュームでの不十分な空きエクステント

論理ボリュームの作成時に、"Insufficient free extents" と言うエラーメッセージが表示されることがあります。これは vgdisplayvgs のコマンドの出力に基づき十分なエクステントがあると思っている時でも発生することがあります。その理由はこれらのコマンドが第 2 小数点まで四捨五入して人間に認識可能な出力を提供するからです。実際のサイズを指定するには、物理ボリュームのサイズ決定にバイトの倍数を使用せずに、空き物理エクステントカウントを使用します。
vgdisplay コマンドの出力には、デフォルトで、空き物理エクステントを示す以下のような行が含まれます。
# vgdisplay
  --- Volume group ---
  ...
  Free  PE / Size       8780 / 34.30 GB
Copy to Clipboard Toggle word wrap
別の方法として、vgs コマンドで vg_free_countvg_extent_count 引数を使用して、空きエクステントと合計エクステント数を表示します。
# vgs -o +vg_free_count,vg_extent_count
  VG     #PV #LV #SN Attr   VSize  VFree  Free #Ext
  testvg   2   0   0 wz--n- 34.30G 34.30G 8780 8780
Copy to Clipboard Toggle word wrap
With 8780 free physical extents, you can enter the following command, using the lower-case l argument to use extents instead of bytes:
# lvcreate -l8780 -n testlv testvg
Copy to Clipboard Toggle word wrap
これが、ボリュームグループ内のすべてのエクステントを使用します。
# vgs -o +vg_free_count,vg_extent_count
  VG     #PV #LV #SN Attr   VSize  VFree Free #Ext
  testvg   2   1   0 wz--n- 34.30G    0     0 8780
Copy to Clipboard Toggle word wrap
別の方法として、lvcreate コマンドで -l 引数を使用して、ボリュームグループ内の残りの空き領域のパーセント指定で使用できる論理ボリュームを拡大することができます。詳しくは、「リニア論理ボリュームの作成」 をご覧ください。

7.8. Duplicate PV Warnings for Multipathed Devices

When using LVM with multipathed storage, some LVM commands (such as vgs or lvchange) may display messages such as the following when listing a volume group or logical volume.
Found duplicate PV GDjTZf7Y03GJHjteqOwrye2dcSCjdaUi: using /dev/dm-5 not /dev/sdd
Found duplicate PV GDjTZf7Y03GJHjteqOwrye2dcSCjdaUi: using /dev/emcpowerb not /dev/sde
Found duplicate PV GDjTZf7Y03GJHjteqOwrye2dcSCjdaUi: using /dev/sddlmab not /dev/sdf
Copy to Clipboard Toggle word wrap
After providing information on the root cause for these warnings, this section describes how to address this issue in the following two cases.
  • The two devices displayed in the output are both single paths to the same device
  • The two devices displayed in the output are both multipath maps

7.8.1. Root Cause of Duplicate PV Warning

With a default configuration, LVM commands will scan for devices in /dev and check every resulting device for LVM metadata. This is caused by the default filter in the /etc/lvm/lvm.conf, which is as follows:
filter = [ "a/.*/" ]
Copy to Clipboard Toggle word wrap
When using Device Mapper Multipath or other multipath software such as EMC PowerPath or Hitachi Dynamic Link Manager (HDLM), each path to a particular logical unit number (LUN) is registered as a different SCSI device, such as /dev/sdb or /dev/sdc. The multipath software will then create a new device that maps to those individual paths, such as /dev/mapper/mpath1 or /dev/mapper/mpatha for Device Mapper Multipath, /dev/emcpowera for EMC PowerPath, or /dev/sddlmab for Hitachi HDLM. Since each LUN has multiple device nodes in /dev that point to the same underlying data, they all contain the same LVM metadata and thus LVM commands will find the same metadata multiple times and report them as duplicates.
These duplicate messages are only warnings and do not mean the LVM operation has failed. Rather, they are alerting the user that only one of the devices has been used as a physical volume and the others are being ignored. If the messages indicate the incorrect device is being chosen or if the warnings are disruptive to users, then a filter can be applied to search only the necessary devices for physical volumes, and to leave out any underlying paths to multipath devices.

7.8.2. Duplicate Warnings for Single Paths

The following example shows a duplicate PV warning in which the duplicate devices displayed are both single paths to the same device. In this case, both /dev/sdd and /dev/sdf can be found under the same multipath map in the output to the multipath -ll command.
Found duplicate PV GDjTZf7Y03GJHjteqOwrye2dcSCjdaUi: using **/dev/sdd** not **/dev/sdf**
Copy to Clipboard Toggle word wrap
To prevent this warning from appearing, you can configure a filter in the /etc/lvm/lvm.conf file to restrict the devices that LVM will search for metadata. The filter is a list of patterns that will be applied to each device found by a scan of /dev (or the directory specified by the dir keyword in the /etc/lvm/lvm.conf file). Patterns are regular expressions delimited by any character and preceded by a (for accept) or r (for reject). The list is traversed in order, and the first regex that matches a device determines if the device will be accepted or rejected (ignored). Devices that don’t match any patterns are accepted. For general information on LVM filters, see 「フィルターを使用した LVM デバイススキャンの制御」.
The filter you configure should include all devices that need to be checked for LVM metadata, such as the local hard drive with the root volume group on it and any multipathed devices. By rejecting the underlying paths to a multipath device (such as /dev/sdb, /dev/sdd, and so on) you can avoid these duplicate PV warnings, since each unique metadata area will only be found once on the multipath device itself.
The following examples show filters that will avoid duplicate PV warnings due to multiple storage paths being available.
  • This filter accepts the second partition on the first hard drive (/dev/sda and any device-mapper-multipath devices, while rejecting everything else.
    filter = [ "a|/dev/sda2$|", "a|/dev/mapper/mpath.*|", "r|.*|" ]
    
    Copy to Clipboard Toggle word wrap
  • This filter accepts all HP SmartArray controllers and any EMC PowerPath devices.
    filter = [ "a|/dev/cciss/.*|", "a|/dev/emcpower.*|", "r|.*|" ]
    
    Copy to Clipboard Toggle word wrap
  • This filter accepts any partitions on the first IDE drive and any multipath devices.
    filter = [ "a|/dev/hda.*|", "a|/dev/mapper/mpath.*|", "r|.*|" ]
    
    Copy to Clipboard Toggle word wrap

注記

When adding a new filter to the /etc/lvm/lvm.conf file, ensure that the original filter is either commented out with a # or is removed.
Once a filter has been configured and the /etc/lvm/lvm.conf file has been saved, check the output of these commands to ensure that no physical volumes or volume groups are missing.
# pvscan
# vgscan
Copy to Clipboard Toggle word wrap
You can also test a filter on the fly, without modifying the /etc/lvm/lvm.conf file, by adding the --config argument to the LVM command, as in the following example.
# lvs --config 'devices{ filter = [ "a|/dev/emcpower.*|", "r|.*|" ] }'
Copy to Clipboard Toggle word wrap

注記

Testing filters using the --config argument will not make permanent changes to the server's configuration. Make sure to include the working filter in the /etc/lvm/lvm.conf file after testing.
After configuring an LVM filter, it is recommended that you rebuild the initrd device with the dracut command so that only the necessary devices are scanned upon reboot.

7.8.3. Duplicate Warnings for Multipath Maps

The following examples show a duplicate PV warning for two devices that are both multipath maps. In these examples we are not looking at two different paths, but two different devices.
Found duplicate PV GDjTZf7Y03GJHjteqOwrye2dcSCjdaUi: using **/dev/mapper/mpatha** not **/dev/mapper/mpathc**
Copy to Clipboard Toggle word wrap
Found duplicate PV GDjTZf7Y03GJHjteqOwrye2dcSCjdaUi: using **/dev/emcpowera** not **/dev/emcpowerh**
Copy to Clipboard Toggle word wrap
This situation is more serious than duplicate warnings for devices that are both single paths to the same device, since these warnings often mean that the machine has been presented devices which it should not be seeing (for example, LUN clones or mirrors). In this case, unless you have a clear idea of what devices should be removed from the machine, the situation could be unrecoverable. It is recommended that you contact Red Hat Technical Support to address this issue.

第8章 LVM GUI での LVM 管理

In addition to the Command Line Interface (CLI), LVM provides a Graphical User Interface (GUI) which you can use to configure LVM logical volumes. You can open this utility by typing system-config-lvm. The LVM chapter of the Storage Administration Guide provides step-by-step instructions for configuring an LVM logical volume using this utility.

付録A デバイスマッパー

デバイスマッパーとは、ボリューム管理用のフレームワークを提供するカーネルドライバーです。これは論理ボリュームとして使用可能な、マップされたデバイスを作成する一般的な方法を提供します。ボリュームグループやメタデータ形式を具体的に認識するものではありません。
デバイスマッパーは多くの高度技術のための土台を提供します。LVM の他にも、デバイスマッパーマルチパスと dmraid コマンドがデバイスマッパーを使用します。デバイスマッパーに対するアプリケーションインターフェースは ioctl システムコールです。ユーザーインターフェースは dmsetup コマンドです。
LVM 論理ボリュームは、デバイスマッパーを使用してアクティブ化されます。それぞれの論理ボリュームは、マップされたデバイスに変換され、それぞれのセグメントが、そのデバイスを記述するマッピングテーブル内の行に変換されます。デバイスマッパーはリニアマッピング、ストライプ化マッピング、およびエラーマッピングを含む各種のマッピングターゲットをサポートします。ディスクがそれぞれ 1 つのリニアマッピングを持つような一対のリニアマッピングを維持する 2 つのディスクを、1 つの論理ボリュームとして連結することができます。LVM2 がボリュームを作成する場合、dmsetup コマンドでクエリ可能なデバイスマッパーデバイスを配下に作成します。マッピングテーブルのデバイスの形式に関する情報については、「デバイステーブルのマッピング」 をご覧ください。デバイスをクエリするための dmsetup コマンドの使用方法についての情報は、「dmsetup コマンド」 をご覧ください。

A.1. デバイステーブルのマッピング

マップ済デバイスは、サポートされているデバイステーブルのマッピングを使用するデバイスの論理セクターの各範囲をマッピングする方法を指定するテーブルによって定義されます。マッピング済みデバイス用のテーブルは以下の形式の行の一覧から構築されます:
start length mapping [mapping_parameters...]
Copy to Clipboard Toggle word wrap
デバイスマッパーテーブルの最初の行では、start パラメーターがゼロ (0) になる必要があります。1 行にある start + length のパラメーター群は、次の行の start と同じでなければなりません。マッピングテーブルの1行に指定されるマッピングパラメーターの種類は、その行に指定される mapping タイプによって決まります。
デバイスマッパー内のサイズは常にセクター内で指定されます (512 バイト)。
1 つのデバイスがデバイスマッパー内でマッピングパラメーターとして指定されている時、そのデバイスはファイルシステム内のデバイス名で参照されるか (例えば、/dev/hda)、あるいは、major:minor の形式でメジャー番号とマイナー番号で参照されます。major:minor の形式は、パス名ルックアップを回避するので推奨されます。
デバイスのマッピングテーブルの例を以下に示します。このテーブルには 4 つのリニアターゲットがあります。
0 35258368 linear 8:48 65920
35258368 35258368 linear 8:32 65920
70516736 17694720 linear 8:16 17694976
88211456 17694720 linear 8:16 256
Copy to Clipboard Toggle word wrap
各行の最初の 2 つのパラメーターはセグメントの始点ブロックとセグメントの長さです。次のキーワードはマッピングターゲットであり、この例内のすべてのケースで linear となります。行のその他の部分は linear ターゲットのパラメーターで構成されます。
The following subsections describe these mapping formats:
  • linear
  • striped
  • mirror
  • snapshot and snapshot-origin
  • error
  • zero
  • multipath
  • crypt
  • device-mapper RAID
  • thin
  • thin-pool

A.1.1. リニアマッピングターゲット

リニアマッピングターゲットは連続範囲のブロックを別のブロックデバイスにマップします。リニアターゲットの形式は以下のようになります:
start length linear device offset
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
device
ブロックデバイス。ファイルシステム内のデバイス名で参照、または major:minor の形式のメジャー番号とマイナー番号で参照されます。
offset
デバイス上のマッピングの始点オフセット
以下の例では、仮想デバイスの始点ブロックが 0 、セグメントの長さが 1638400、メジャー/ マイナー番号ペアが 8:2、デバイス用の始点オフセットが 41146992 であるリニアターゲットを示しています。
0 16384000 linear 8:2 41156992
Copy to Clipboard Toggle word wrap
以下の例では、デバイスパラメーターがデバイス /dev/hda として指定されたリニアターゲットを示しています。
0 20971520 linear /dev/hda 384
Copy to Clipboard Toggle word wrap

A.1.2. ストライプ化マッピングターゲット

ストライプ化マッピングターゲットは物理デバイス全域でストライプ化をサポートします。これは、ストライプの数、ストライプのチャンクサイズ、そしてデバイス名とセクターのペアのリストを引数として取ります。ストライプ化ターゲットの形式は以下のようになります:
start length striped #stripes chunk_size device1 offset1 ... deviceN offsetN
Copy to Clipboard Toggle word wrap
それぞれのストライプには、deviceoffset のパラメーターの 1 つのセットがあります。
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
#stripes
仮想デバイスのストライプの数
chunk_size
次にスイッチするまでに各ストライプに書き込まれるセクターの数。2 の累乗であり、最低でもカーネルページサイズの大きさでなければなりません。
device
ブロックデバイス。ファイルシステム内のデバイス名で参照、または major:minor の形式でメジャー番号とマイナーの番号で参照されます。
offset
デバイス上のマッピングの始点オフセット
以下の例では、3 つのストライプと、チャンクサイズ 128 を持つストライプ化ターゲットを示します。
0 73728 striped 3 128 8:9 384 8:8 384 8:7 9789824
Copy to Clipboard Toggle word wrap
0
仮想デバイス内の始点ブロック
73728
このセグメントの長さ
striped 3 128
チャンクサイズ 128 ブロックを持つ 3 つのデバイスに渡るストライプ
8:9
最初のデバイスのメジャー番号:マイナー番号
384
最初のデバイス上のマッピングの始点オフセット
8:8
2 つ目のデバイスのメジャー番号:マイナー番号
384
2 つ目のデバイスのマッピングの始点オフセット
8:7
3 つ目のデバイスのメジャー番号:マイナー番号
9789824
3 つ目のデバイス上のマッピングの始点オフセット
以下の例では、2 つのストライプ、256 KiB のチャンク、およびメジャー番号とマイナー番号の代わりにファイルシステム内のデバイス名で指定されたデバイスパラメーターを持つストライプ化ターゲットを示します。
0 65536 striped 2 512 /dev/hda 0 /dev/hdb 0
Copy to Clipboard Toggle word wrap

A.1.3. ミラーマッピングターゲット

ミラーマッピングターゲットはミラー化した論理デバイスのマッピングをサポートします。ミラー化ターゲットの形式は次のようになります:
start length mirror log_type #logargs logarg1 ... logargN #devs device1 offset1 ... deviceN offsetN
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
log_type
可能なログタイプとその引数は以下のようになります:
core
ミラーはローカルであり、ミラーログはコアメモリーに保管されます。このログ タイプは 1 - 3 の引数を取ります:
regionsize [[no]sync] [block_on_error]
disk
ミラーはローカルであり、ミラーログはディスクに保管されます。ログタイプは 2 - 4 の引数を取ります:
logdevice regionsize [[no]sync] [block_on_error]
clustered_core
ミラーはクラスター化されており、ミラーログはコアメモリーに保管されます。このログタイプは 2 - 4 の引数を取ります。
regionsize UUID [[no]sync] [block_on_error]
clustered_disk
ミラーはクラスター化されており、ミラーログはディスクに保管されます。このログタイプは 3 - 5 の引数を取ります。
logdevice regionsize UUID [[no]sync] [block_on_error]
LVM は、どのリージョンがミラー (ミラー群) と同期しているかを追跡記録するのに使用する小さなログを維持します。regionsize 引数は、それらのリージョンのサイズを指定します。
クラスター化環境では、UUID 引数はミラーログデバイスに関連付けされた一意識別子であるため、ログの状態はクラスター全域で維持できます。
オプションの [no]sync 引数を使用して、ミラーを "in-sync" か "out-of-sync" として指定することができます。block_on_error 引数はミラーに対して、エラーを無視するのではなくエラーに対応するように指示するために使用されます。
#log_args
マッピング内で指定されるログ引数の数
logargs
ミラー用のログ引数。提供されるログ引数の数は #log-args パラメーターで指定され、有効なログ引数は log_type パラメーターで決定されます。
#devs
ミラー内のレッグ数。デバイスとオフセットは各レッグ用に指定されます。
device
それぞれのレッグ用のブロックデバイス。ファイルシステム内のデバイス名で参照、または major:minor の形式でメジャーとマイナーの番号で参照。ブロックデバイスとオフセットは各ミラーレッグに対して指定されます。#devs パラメーターで示されます。
offset
デバイス上のマッピングの始点オフセット。ブロックデバイスとオフセットは #devs で示されるようにそれぞれのミラーレッグ用に指定されます。
以下の例では、ミラーログをディスク上に持つクラスター化ミラー用のミラーマッピングターゲットを示します。
0 52428800 mirror clustered_disk 4 253:2 1024 UUID block_on_error 3 253:3 0 253:4 0 253:5 0
Copy to Clipboard Toggle word wrap
0
仮想デバイス内の始点ブロック
52428800
このセグメントの長さ
mirror clustered_disk
ミラーがクラスター化されており、ディスク上でミラーログを管理することを指定するタイプのログを持つミラーターゲット
4
4 つのミラーログ引数が続きます
253:2
ログデバイスのメジャー番号:マイナー番号
1024
何が同期しているかを追跡記録するためにミラーログが使用するリージョンのサイズ
UUID
クラスター全域でログ情報を維持するためのミラーログデバイスの UUID
block_on_error
ミラーはエラーに対応する必要があります
3
ミラー内のレッグ数
253:3 0 253:4 0 253:5 0
ミラーの各レッグを構成しているデバイス用のメジャー番号:マイナー番号およびオフセット

A.1.4. スナップショットとスナップショット複製元のマッピングターゲット

ボリュームの最初の LVM スナップショットを作成する場合に、4つのデバイスマッパーデバイスが使用されます:
  1. linear マッピングを持つデバイスが1つ。ソースボリュームのオリジナルマッピングテーブルを持っています。
  2. ソースボリューム用の COW (copy-on-write) デバイスとして使用される linear マッピングを持つデバイスが1つ。書き込みを行う度に、オリジナルデータは各スナップショットの COW デバイス内に保存され、その可視コンテンツを不変のまま維持します (COW デバイスが満杯になるまで)。
  3. 上記の 1 と 2 を組み合わせた snapshot マッピングを持つ 1 つのデバイス。これは可視のスナップショットボリュームです。
  4. "複製元" のボリューム (これは、オリジナルソースボリュームで使用されるデバイス番号を使用します)。このテーブルはデバイス #1 からの "snapshot-origin" マッピングに置き換えられます。
これらのデバイスを作成には固定の命名スキームが使用されます。例えば以下のようなコマンドを使用して base と言う名前の LVM ボリュームを作成し、snap と言う名前のスナップショットをそのボリューム上に作成することができます。
# lvcreate -L 1G -n base volumeGroup
# lvcreate -L 100M --snapshot -n snap volumeGroup/base
Copy to Clipboard Toggle word wrap
これによって 4 つのデバイスが作成され、以下のコマンドで表示できます。
# dmsetup table|grep volumeGroup
volumeGroup-base-real: 0 2097152 linear 8:19 384
volumeGroup-snap-cow: 0 204800 linear 8:19 2097536
volumeGroup-snap: 0 2097152 snapshot 254:11 254:12 P 16
volumeGroup-base: 0 2097152 snapshot-origin 254:11

# ls -lL /dev/mapper/volumeGroup-*
brw-------  1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real
brw-------  1 root root 254, 12 29 ago 18:15 /dev/mapper/volumeGroup-snap-cow
brw-------  1 root root 254, 13 29 ago 18:15 /dev/mapper/volumeGroup-snap
brw-------  1 root root 254, 10 29 ago 18:14 /dev/mapper/volumeGroup-base
Copy to Clipboard Toggle word wrap
snapshot-origin ターゲットのフォーマットは以下のようになります:
start length snapshot-origin origin
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
origin
スナップショットのベースボリューム
snapshot-origin は通常、それをベースにした1つまたは複数のスナップショットを持っています。読み取りは直接バッキングデバイスにマップされます。それぞれの書き込みには、オリジナルデータが各スナップショットの COW デバイス内に保存されて、COW デバイスが満杯になるまでその可視コンテンツを不変のまま維持します。
snapshot ターゲットの形式は以下のようになります:
start length snapshot origin COW-device P|N chunksize
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
origin
スナップショットのベースボリューム
COW-device
変更されたデータチャンクが保存されるデバイス
P|N
P (Persistent) または N (Not persistent) は、スナップショットが再起動後に維持されるかどうかを示します。一時的なスナップショット (N) には、多くのメタデータをディスク上に保存できません。それはカーネルによってメモリー内に保存できます。
chunksize
COW デバイスに保存されるデータの変更したチャンクのセクターサイズ
次の例では、複製元デバイスが 254:11 の snapshot-origin ターゲットを示しています。
0 2097152 snapshot-origin 254:11
Copy to Clipboard Toggle word wrap
以下の例では、複製元デバイスが 254:11 で、COW デバイスが 254:12 の snapshot ターゲットを示しています。このスナップショットデバイスは再起動後にも永続し、COW デバイス上に保存されるデータのチャンクサイズは 16 セクターです。
0 2097152 snapshot 254:11 254:12 P 16
Copy to Clipboard Toggle word wrap

A.1.5. エラーマッピングターゲット

エラーマッピングターゲットを使用すると、マッピングされたセクターへの I/O オペレーションはいずれも失敗します。
エラーマッピングターゲットはテスト用に使用できます。障害時にデバイスがどのように動作するかをテストするには、1つのデバイスの中に不良セクターがあるデバイスマッピングを1つ作成するか、あるいは、ミラーレッグをスワップアウトして、そのレッグをエラーターゲットに置き換えます。
エラーターゲットは、実際のデバイス上でタイムアウトおよび再試行を回避する方法として、障害のあるデバイスの代わりに使用することができます。エラーターゲットは、障害時に LVM メタデータを再配置している間に中間的ターゲットとして機能します。
error マッピングターゲットは、startlength のパラメーター以外には追加のパラメーターを取りません。
以下の例では、error ターゲットを示しています。
0 65536 error
Copy to Clipboard Toggle word wrap

A.1.6. ゼロマッピングターゲット

zero マッピングターゲットは、/dev/zero と同等のブロックデバイスです。このマッピングの読み取り操作はゼロのブロックを返します。このマッピングに書き込まれたデータは破棄されますが、書き込みは成功します。zero マッピングターゲットは startlength パラメーター以外には追加のパラメーターは取りません。
以下の例では、16Tb デバイス用の zero ターゲットを示しています。
0 65536 zero
Copy to Clipboard Toggle word wrap

A.1.7. マルチパスマッピングターゲット

マルチパスマッピングターゲットはマルチパス化したデバイスのマッピングをサポートします。multipath ターゲットの形式は以下のようになります:
start length  multipath  #features [feature1 ... featureN] #handlerargs [handlerarg1 ... handlerargN] #pathgroups pathgroup pathgroupargs1 ... pathgroupargsN
Copy to Clipboard Toggle word wrap
それぞれのパスグループ用に 1 つのセットの pathgroupargs パラメーター群があります。
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
#features
マルチパス機能の数。その後にその機能が続きます。このパラメーターがゼロであれば、feature パラメーターは存在せず、次のデバイスマッピングパラメーターは #handlerargs となります。現在、multipath.conf ファイルの features 属性で設定可能なサポートされている機能が 1 つあります。queue_if_no_path です。これは、パスがない場合には、マルチパス化したデバイスが I/O 操作をキューに登録するように現在セットされていることを意味します。
下記の例では、パスを使用するための試行を設定回数行った後にすべてのパスが失敗とマークされるまでのみ、multipath.conf ファイルの no_path_retry 属性は I/O 操作をキューに登録するようにセットされます。この場合、すべてのパスチェッカーが指定回数失敗するまでマッピングは以下のように表示されます。
0 71014400 multipath 1 queue_if_no_path 0 2 1 round-robin 0 2 1 66:128 \
1000 65:64 1000 round-robin 0 2 1 8:0 1000 67:192 1000
Copy to Clipboard Toggle word wrap
すべてのパスチェッカーがチェックに指定回数失敗した後には、マッピングは以下のように表示されるでしょう。
0 71014400 multipath 0 0 2 1 round-robin 0 2 1 66:128 1000 65:64 1000 \
round-robin 0 2 1 8:0 1000 67:192 1000
Copy to Clipboard Toggle word wrap
#handlerargs
ハードウェアハンドラー引数の数です。それらの引数がその後に付きます。ハードウェアハンドラーは、パスグループを切り替える時、または I/O エラーを処理する時に、ハードウェア特有のアクションを実行するために使用されるモジュールを指定します。これがゼロにセットしてある場合は、次のパラメーターは #pathgroups となります。
#pathgroups
パスグループの数です。バスグループとは、マルチパス化したデバイスがロードバランシングを行うパスのセットのことです。それぞれのパスグループに 1 つのセットの pathgroupargs パラメーターがあります。
pathgroup
試行する次のパスグループ
pathgroupsargs
各パスグループは以下の引数で構成されます:
pathselector #selectorargs #paths #pathargs device1 ioreqs1 ... deviceN ioreqsN 
Copy to Clipboard Toggle word wrap
パスグループ内の各パス用に1つのセットのパス引数群があります。
pathselector
次の I/O オペレーションで使用するのに、このパスグループ内でのパスを決定するために使用するアルゴリズムを指定します。
#selectorargs
マルチパスマッピングでこの引数に従うパスセレクター引数の数。現在、この引数の値は常に 0 (ゼロ) です。
#paths
このパスグループ内のパスの数
#pathargs
このグループ内の各パス用に指定されたパス引数の数。現在、この数は 常に 1 で ioreqs 引数です。
device
パスのブロックデバイス数。major:minor の形式で、メジャー番号とマイナー番号によって参照されます。
ioreqs
現在のグループ内の次のパスへ切り替えるまでのこのパスへルーティングする I/O 要求数。
図A.1「マルチパスマッピングターゲット」 2つのパスグループを持つマルチパスターゲットの形式を示します。

図A.1 マルチパスマッピングターゲット

以下の例では、同じマルチパスデバイスのための純粋なフェイルオーバーターゲットの定義を示しています。このターゲットには、4つのパスグループがあります。マルチパス化したデバイスが一度に1つのパスのみを使用するように、パスグループ毎に1つのパスのみが開いています。
0 71014400 multipath 0 0 4 1 round-robin 0 1 1 66:112 1000 \
round-robin 0 1 1 67:176 1000 round-robin 0 1 1 68:240 1000 \
round-robin 0 1 1 65:48 1000
Copy to Clipboard Toggle word wrap
次の例では、同じマルチパス化したデバイスを対象とする、完全に拡散した (multibus) ターゲットの定義を示しています。このターゲットでは、すべてのパスを含む1つのパスグループのみが存在しています。このセットアップでは、マルチパスはパスのすべてに渡って均等に負荷を拡散します。
0 71014400 multipath 0 0 1 1 round-robin 0 4 1 66:112 1000 \
 67:176 1000 68:240 1000 65:48 1000
Copy to Clipboard Toggle word wrap
マルチパッシングに関する詳細情報は、『DM マルチパスの使用 (Using Device Mapper Multipath)』 をご覧ください。

A.1.8. crypt マッピングターゲット

crypt ターゲットは、指定したデバイスを経由してデータパッシングを暗号化します。これは、kernel Crypto API を使用します。
crypt ターゲットの形式は以下のようになります:
start length crypt cipher key IV-offset device offset
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
cipher
Cipher は、cipher[-chainmode]-ivmode[:iv options] で構成されます。
cipher
利用できる Cipher は /proc/crypto (例えば、aes) 内に一覧表示してあります。
chainmode
常に cbc を使用します。ebc は 使用しません。これは初期ベクトル (IV) を使いません。
ivmode[:iv options]
IV は暗号化を変更するために使用する初期ベクトルです。IV モードは plainessiv:hash です。-plainivmode は、セクター番号 (プラス、IV オフセット) を IV として使用します。-essivivmode はウォーターマークの弱点を回避するための機能強化です。
key
暗号化キー、16進法で供給
IV-offset
初期ベクトル (IV) オフセット
device
ブロックデバイス。ファイルシステム内のデバイス名で参照、または major:minor の形式のメジャー番号とマイナー番号で参照されます。
offset
デバイス上のマッピングの始点オフセット
以下に crypt ターゲットの例を示します。
0 2097152 crypt aes-plain 0123456789abcdef0123456789abcdef 0 /dev/hda 0
Copy to Clipboard Toggle word wrap

A.1.9. The device-mapper RAID Mapping Target

The device-mapper RAID (dm-raid) target provides a bridge from DM to MD. It allows the MD RAID drivers to be accessed using a device-mapper interface. The format of the dm-raid target is as follows
start length raid raid_type #raid_params raid_params #raid_devs metadata_dev0 dev0 [.. metadata_devN devN]
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
raid_type
The RAID type can be one of the following
raid1
RAID1 mirroring
raid4
RAID4 dedicated parity disk
raid5_la
RAID5 left asymmetric
— rotating parity 0 with data continuation
raid5_ra
RAID5 right asymmetric
— rotating parity N with data continuation
raid5_ls
RAID5 left symmetric
— rotating parity 0 with data restart
raid5_rs
RAID5 right symmetric
— rotating parity N with data restart
raid6_zr
RAID6 zero restart
— rotating parity 0 (left to right) with data restart
raid6_nr
RAID6 N restart
— rotating parity N (right to left) with data restart
raid6_nc
RAID6 N continue
— rotating parity N (right to left) with data continuation
raid10
Various RAID10-inspired algorithms selected by further optional arguments
— RAID 10: Striped mirrors (striping on top of mirrors)
— RAID 1E: Integrated adjacent striped mirroring
— RAID 1E: Integrated offset striped mirroring
— Other similar RAID10 variants
#raid_params
The number of parameters that follow
raid_params
Mandatory parameters:
chunk_size
Chunk size in sectors. This parameter is often known as "stripe size". It is the only mandatory parameter and is placed first.
Followed by optional parameters (in any order):
[sync|nosync]
Force or prevent RAID initialization.
rebuild idx
Rebuild drive number idx (first drive is 0).
daemon_sleep ms
Interval between runs of the bitmap daemon that clear bits. A longer interval means less bitmap I/O but resyncing after a failure is likely to take longer.
min_recovery_rate KB/sec/disk
Throttle RAID initialization
max_recovery_rate KB/sec/disk
Throttle RAID initialization
write_mostly idx
Mark drive index idx write-mostly.
max_write_behind sectors
See the description of --write-behind in the mdadm man page.
stripe_cache sectors
Stripe cache size (RAID 4/5/6 only)
region_size sectors
The region_size multiplied by the number of regions is the logical size of the array. The bitmap records the device synchronization state for each region.
raid10_copies #copies
The number of RAID10 copies. This parameter is used in conjunction with the raid10_format parameter to alter the default layout of a RAID10 configuration. The default value is 2.
raid10_format near|far|offset
This parameter is used in conjunction with the raid10_copies parameter to alter the default layout of a RAID10 configuration. The default value is near, which specifies a standard mirroring layout.
If the raid10_copies and raid10_format are left unspecified, or raid10_copies 2 and/or raid10_format near is specified, then the layouts for 2, 3 and 4 devices are as follows:
2 drives    3 drives      4 drives
--------    ----------    --------------
A1  A1      A1  A1  A2    A1  A1  A2  A2
A2  A2      A2  A3  A3    A3  A3  A4  A4
A3  A3      A4  A4  A5    A5  A5  A6  A6
A4  A4      A5  A6  A6    A7  A7  A8  A8
..  ..      ..  ..  ..    ..  ..  ..  ..
Copy to Clipboard Toggle word wrap
The 2-device layout is equivalent to 2-way RAID1. The 4-device layout is what a traditional RAID10 would look like. The 3-device layout is what might be called a 'RAID1E - Integrated Adjacent Stripe Mirroring'.
If raid10_copies 2 and raid10_format far are specified, then the layouts for 2, 3 and 4 devices are as follows:
2 drives    3 drives        4 drives
--------   -----------      ------------------
A1  A2      A1  A2  A3      A1   A2   A3   A4
A3  A4      A4  A5  A6      A5   A6   A7   A8
A5  A6      A7  A8  A9      A9   A10  A11  A12
..  ..      ..  ..  ..      ..   ..   ..   ..
A2  A1      A3  A1  A2      A2   A1   A4   A3
A4  A3      A6  A4  A5      A6   A5   A8   A7
A6  A5      A9  A7  A8      A10  A9   A12  A11
..  ..      ..  ..  ..      ..   ..   ..   ..
Copy to Clipboard Toggle word wrap
If raid10_copies 2 and raid10_format offset are specified, then the layouts for 2, 3 and 4 devices are as follows:
2 drives    3 drives       4 drives
--------    --------       ------------------
A1  A2      A1  A2  A3     A1   A2   A3   A4
A2  A1      A3  A1  A2     A2   A1   A4   A3
A3  A4      A4  A5  A6     A5   A6   A7   A8
A4  A3      A6  A4  A5     A6   A5   A8   A7
A5  A6      A7  A8  A9     A9   A10  A11  A12
A6  A5      A9  A7  A8     A10  A9   A12  A11
..  ..      ..  ..  ..     ..   ..   ..   ..
Copy to Clipboard Toggle word wrap
These layouts closely resemble the layouts fo RAID1E - Integrated Offset Stripe Mirroring'
#raid_devs
The number of devices composing the array
Each device consists of two entries. The first is the device containing the metadata (if any); the second is the one containing the data.
If a drive has failed or is missing at creation time, a '-' can be given for both the metadata and data drives for a given position.
The following example shows a RAID4 target with a starting block of 0 and a segment length of 1960893648. There are 4 data drives, 1 parity, with no metadata devices specified to hold superblock/bitmap info and a chunk size of 1MiB
0 1960893648 raid raid4 1 2048 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
Copy to Clipboard Toggle word wrap
The following example shows a RAID4 target with a starting block of 0 and a segment length of 1960893648. there are 4 data drives, 1 parity, with metadata devices, a chunk size of 1MiB, force RAID initialization, and a min_recovery rate of 20 kiB/sec/disks.
0 1960893648 raid raid4 4 2048 sync min_recovery_rate 20 5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82
Copy to Clipboard Toggle word wrap

A.1.10. The thin and thin-pool Mapping Targets

The format of a thin-pool target is as follows:
start length thin-pool metadata_dev data_dev data_block_size low_water_mark [#feature_args [arg*] ]
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
metadata_dev
The metadata device
data_dev
The data device
data_block_size
The data block size (in sectors). The data block size gives the smallest unit of disk space that can be allocated at a time expressed in units of 512-byte sectors. Data block size must be between 64KB (128 sectors) and 1GB (2097152 sectors) inclusive and it must be a mutlipole of 128 (64KB).
low_water_mark
The low water mark, expressed in blocks of size data_block_size. If free space on the data device drops below this level then a device-mapper event will be triggered which a user-space daemon should catch allowing it to extend the pool device. Only one such event will be sent. Resuming a device with a new table itself triggers an event so the user-space daemon can use this to detect a situation where a new table already exceeds the threshold.
A low water mark for the metadata device is maintained in the kernel and will trigger a device-mapper event if free space on the metadata device drops below it.
#feature_args
The number of feature arguments
arg
The thin pool feature argument are as follows:
skip_block_zeroing
Skip the zeroing of newly-provisioned blocks.
ignore_discard
Disable discard support.
no_discard_passdown
Do not pass discards down to the underlying data device, but just remove the mapping.
read_only
Do not allow any changes to be made to the pool metadata.
error_if_no_space
Error IOs, instead of queuing, if no space.
The following example shows a thin-pool target with a starting block in the virtual device of 0, a segment length of 1638400. /dev/sdc1 is a small metadata device and /dev/sdc2 is a larger data device. The chunksize is 64k, the low_water_mark is 0, and there are no features.
0 16384000 thin-pool /dev/sdc1 /dev/sdc2 128 0 0
Copy to Clipboard Toggle word wrap
The format of a thin target is as follows:
start length thin pool_dev dev_id [external_origin_dev]
Copy to Clipboard Toggle word wrap
start
仮想デバイス内の始点ブロック
length
このセグメントの長さ
pool_dev
The thin-pool device, for example /dev/mapper/my_pool or 253:0
dev_id
The internal device identifier of the device to be activated.
external_origin_dev
An optional block device outside the pool to be treated as a read-only snapshot origin. Reads to unprovisioned areas of the thin target will be mapped to this device.
The following example shows a 1 GiB thinLV that uses /dev/mapper/pool as its backing store (thin-pool). The target has a starting block in the virtual device of 0 and a segment length of 2097152.
0 2097152 thin /dev/mapper/pool 1
Copy to Clipboard Toggle word wrap

A.2. dmsetup コマンド

dmsetup コマンドはデバイスマッパーとの通信のためのコマンドラインラッパーです。LVM デバイスに関する全般的システム情報については、以下のサブセクションに記載したように、 dmsetup コマンドの infolsstatus、および deps オプションが役に立つでしょう。
dmsetup コマンドのその他のオプションとその機能に関する情報は、 dmsetup(8) の man ページをご覧ください。

A.2.1. dmsetup info コマンド

dmsetup info device コマンドは デバイスマッパーデバイスに関する要約情報を提供します。デバイス名を指定しないと、その出力は現在設定されているすべてのデバイスマッパーデバイスに関する情報となります。デバイスを1つ指定すると、このコマンドはそのデバイスのみについて情報を出します。
dmsetup info コマンドは以下のカテゴリ内で情報を提供します:
Name
The name of the device. An LVM device is expressed as the volume group name and the logical volume name separated by a hyphen. A hyphen in the original name is translated to two hyphens. During standard LVM operations, you should not use the name of an LVM device in this format to specify an LVM device directly, but instead you should use the vg/lv alternative.
State
可能なデバイスの状態 (state) は、SUSPENDEDACTIVE、および READ-ONLY となります。dmsetup suspend コマンドはデバイスを SUSPENDED の状態にします。デバイスがサスペンドになっている時は、そのデバイスへのすべての I/O オペレーションは停止します。 dmsetup resume コマンドはそのデバイスの状態を ACTIVE に復元します。
Read Ahead
読み取りオペレーションが進行中の開いたファイルを対象にシステムが先読みをするデータブロックの数です。デフォルトでカーネルは自動的に適切な値を選択します。この値を変更するには、dmsetup コマンドで --readahead を使用します。
Tables present
このカテゴリ用の可能な状態は LIVEINACTIVE です。 INACTIVE 状態は、テーブルの状態が LIVE となるように dmsetup resume コマンドがデバイス状態を ACTIVE に復元する時に入れ替えられるようなテーブルがロードされていることを示します。詳細は dmsetup man ページをご覧ください。
Open count
open reference count はデバイスが開かれた回数を示します。mount コマンドはデバイスを開きます。
Event number
現在の受信イベント数。dmsetup wait n コマンドを発行すると、ユーザーは ’n' 番めのイベントを待つことができ、それが受理されるまでコールをブロックします。
Major, minor
メジャーとマイナーのデバイス番号
Number of targets
デバイスを構成するフラグメントの数です。例えば、3つのディスクに渡るリニアデバイスは3つのターゲットを持つことになります。ディスクの先頭と終点で構成されて、中間を持たないリニアデバイスは2つのターゲットを持ちます。
UUID
デバイスの UUID
以下の例では、dmsetup info コマンド用の一部の出力を示しています。
# dmsetup info
Name:              testgfsvg-testgfslv1
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      253, 2
Number of targets: 2
UUID: LVM-K528WUGQgPadNXYcFrrf9LnPlUMswgkCkpgPIgYzSvigM7SfeWCypddNSWtNzc2N
...
Name:              VolGroup00-LogVol00
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        1
Event number:      0
Major, minor:      253, 0
Number of targets: 1
UUID: LVM-tOcS1kqFV9drb0X1Vr8sxeYP0tqcrpdegyqj5lZxe45JMGlmvtqLmbLpBcenh2L3
Copy to Clipboard Toggle word wrap

A.2.2. dmsetup ls コマンド

マップ済みデバイスのデバイス名は、dmsetup ls コマンドで一覧表示できます。指定タイプのターゲットを少なくとも1つ持つデバイスは、dmsetup ls --target target_type コマンドを使用して一覧表示できます。 dmsetup ls の他のオペレーションについては、dmsetup man ページをご覧ください。
以下の例では、現在設定されているマップ済みデバイスのデバイス名を一覧表示するコマンドを示します。
# dmsetup ls
testgfsvg-testgfslv3    (253:4)
testgfsvg-testgfslv2    (253:3)
testgfsvg-testgfslv1    (253:2)
VolGroup00-LogVol01     (253:1)
VolGroup00-LogVol00     (253:0)
Copy to Clipboard Toggle word wrap
以下の例では、現在設定されているミラーマッピングのデバイス名を一覧表示するコマンドを示します。
# dmsetup ls --target mirror
lock_stress-grant--02.1722      (253, 34)
lock_stress-grant--01.1720      (253, 18)
lock_stress-grant--03.1718      (253, 52)
lock_stress-grant--02.1716      (253, 40)
lock_stress-grant--03.1713      (253, 47)
lock_stress-grant--02.1709      (253, 23)
lock_stress-grant--01.1707      (253, 8)
lock_stress-grant--01.1724      (253, 14)
lock_stress-grant--03.1711      (253, 27)
Copy to Clipboard Toggle word wrap
マルチパスまたはその他のデバイスマッパーデバイス上にスタックされる LVM 設定は複雑でわかりにくい場合があります。dmsetup ls のコマンドには、以下に示した例のように、デバイス間の依存関係をツリーとして表示する --tree オプションがあります。
# dmsetup ls --tree
vgtest-lvmir (253:13)
 ├─vgtest-lvmir_mimage_1 (253:12)
 │  └─mpathep1 (253:8)
 │     └─mpathe (253:5)
 │        ├─ (8:112)
 │        └─ (8:64)
 ├─vgtest-lvmir_mimage_0 (253:11)
 │  └─mpathcp1 (253:3)
 │     └─mpathc (253:2)
 │        ├─ (8:32)
 │        └─ (8:16)
 └─vgtest-lvmir_mlog (253:4)
    └─mpathfp1 (253:10)
       └─mpathf (253:6)
          ├─ (8:128)
          └─ (8:80)
Copy to Clipboard Toggle word wrap

A.2.3. dmsetup status コマンド

dmsetup status device コマンドは指定されたデバイス内の各ターゲット用の状態情報を提供します。デバイス名を指定しないと、その出力は現在設定されているすべてのデバイスマッパーデバイスに関する情報となります。dmsetup status --target target_type コマンドを使用すると、1つの指定されたタイプの最低でも1つのターゲットを持つデバイスのみの状態を一覧表示することができます。
以下の例では、現在設定されているすべてのマップ済みデバイス内のターゲットの状態を一覧表示するコマンドを示しています。
# dmsetup status
testgfsvg-testgfslv3: 0 312352768 linear 
testgfsvg-testgfslv2: 0 312352768 linear 
testgfsvg-testgfslv1: 0 312352768 linear 
testgfsvg-testgfslv1: 312352768 50331648 linear 
VolGroup00-LogVol01: 0 4063232 linear 
VolGroup00-LogVol00: 0 151912448 linear
Copy to Clipboard Toggle word wrap

A.2.4. dmsetup deps コマンド

dmsetup deps device コマンドは、指定デバイスのマッピングテーブルによって参照されるデバイス用の (メジャー/マイナー) ペアの一覧を提供します。デバイス名を指定しないと、その出力は現在設定済のすべてのデバイスマッパーデバイスに関する情報になります。
以下の例では、現在設定されているマップ済みデバイスのすべての依存関係を一覧表示するコマンドを示しています。
# dmsetup deps
testgfsvg-testgfslv3: 1 dependencies    : (8, 16)
testgfsvg-testgfslv2: 1 dependencies    : (8, 16)
testgfsvg-testgfslv1: 1 dependencies    : (8, 16)
VolGroup00-LogVol01: 1 dependencies     : (8, 2)
VolGroup00-LogVol00: 1 dependencies     : (8, 2)
Copy to Clipboard Toggle word wrap
以下の例では、デバイス lock_stress-grant--02.1722 の依存関係のみを一覧表示するコマンドを示しています。
# dmsetup deps lock_stress-grant--02.1722
3 dependencies  : (253, 33) (253, 32) (253, 31)
Copy to Clipboard Toggle word wrap

A.3. デバイスマッパーの udev デバイスマネージャサポート

The primary role of the udev device manager is to provide a dynamic way of setting up nodes in the /dev directory. The creation of these nodes is directed by the application of udev rules in user space. These rules are processed on udev events sent from the kernel directly as a result of adding, removing or changing particular devices. This provides a convenient and central mechanism for hotplugging support.
udev デバイスマネージャは、実際のノードを作成するだけでなく、ユーザーによる名前付けが可能なシンボリックリンクも作成できます。これにより、ユーザーは独自のカスタマイズされた命名および /dev ディレクトリ内のディレクトリ構造を必要に応じて自由に選択できるようになります。
udev イベントには、処理中のデバイスに関する基本情報が格納されています。これには、そのデバイスの名前、属するサブシステム、デバイスのタイプ、使用されているメジャーとマイナーの番号、イベントのタイプなどが含まれます。udev ルール内でもアクセス可能な /sys ディレクトリ内にあるすべての情報にアクセスする可能性があることを考慮すると、ユーザーはこの情報に基づいてシンプルなフィルターを利用し、この情報に基づいて条件付きでルールを実行することができます。
udev デバイスマネージャは、ノードのアクセス権設定の一元化された方法も提供します。ユーザーはカスタマイズされたルールセットを用意に追加し、イベント処理中に入手可能な情報のいずれかのビットによって指定されている任意のデバイスのアクセス権を定義することができます。
udev ルール内に直接プログラムのフックを追加することも可能です。udev デバイスマネージャは、これらのプログラムを呼び出して、イベントを処理するにあたって必要とされる更なる処理を提供することが可能です。また、プログラムは、この処理の結果として、環境変数をエクスポートすることもできます。追加の情報源として、任意の結果を更にルール内で使用することが可能です。
udev ライブラリを使用するソフトウェアは、入手可能なすべての情報とともに、udev イベントを受信および処理することが可能です。このため、処理は、udev デーモンのみにバインドされません。

A.3.1. udev のデバイスマッパーとの統合

Red Hat Enterprise Linux 6 では、デバイスマッパーは udev 統合に対して直接のサポートを提供します。これによって、デバイスマッパーは、LVM デバイスを含むデバイスマッパーデバイスに関連したすべての udev 処理と同期します。udev デーモンにルールを適用する方式は、デバイスの変更元であるプログラム (dmsetup や LVM など) を使用した並列処理であるため、同期が必要です。このサポートがなかったため、前回の変更イベントの結果、引き続きオープンな udev ルールで処理されたデバイスをユーザーが削除しようとする問題が頻繁に発生していました。この問題は、デバイスに対する変更の間隔が短い場合に特に多く発生していました。
Red Hat Enterprise Linux 6 リリースは、一般的なデバイスマッパーデバイスおよび LVM 向けの udev ルールを正式にサポートしています。表A.1「デバイスマッパーデバイス向けの udev ルール」 は、/lib/udev/rules.d にインストールされているこれらのルールについてまとめています。
Expand
表A.1 デバイスマッパーデバイス向けの udev ルール
ファイル名説明
10-dm.rules
基本的/一般的なデバイスマッパールールを格納し、/dev/mapper 内に/dev/dm-N をターゲットとするシンボリックリンクを作成します。ここで N は、カーネルによってデバイスに動的に割り当てられる数です。 (/dev/dm-N はノードです)
注意: /dev/dm-N ノードは、デバイスにアクセスするスクリプトには 決して 使用されるべきではありません。N の数は動的に割り当てられ、デバイスがどのように有効化される順序とともに変化します。したがって、/dev/mapper ディレクトリ内の真の名前を使用すべきです。このレイアウトは、ノード/シンボリックリンクが作成されるべき方法の要件をサポートします。
11-dm-lvm.rules
LVM デバイス用に適用されるルールを格納し、ボリュームグループの論理ボリュームのシンボリックリンクを作成します。このシンボリックリンクは、/dev/vgnameディレクトリに、/dev/dm-N をターゲットとして作成されます。
注意: デバイスマッパーサブシステムの今後すべてのルールを命名する基準に一致させるには、udev ルールは、11-dm-subsystem_name.rulesのフォーマットに従う必要があります。udev ルールも提供する libdevmapper ユーザーはいずれも、この基準に従う必要があります。
13-dm-disk.rules全デバイスマッパーデバイスに適用されるルールを格納し、/dev/disk/by-id/dev/disk/by-uuid、および /dev/disk/by-uuidのディレクトリ内にシンボリックリンクを作成します。
95-dm-notify.ruleslibdevmapper を使用する待機中のプロセスを通知するルールを格納します。(LVM や dmsetup と同様)。以前の全ルールが適用された後で通知が行われ、udev 処理が確実に完了するようにします。通知されたプロセスは、その後で再開します。
69-dm-lvm-metad.rules Contains a hook to trigger an LVM scan on any newly appeared block device in the system and do any LVM autoactivation if possible. This supports the lvmetad daemon, which is set with use_lvmetad=1 in the lvm.conf file. The lvmeetad daemon and autoactivation are not supported in a clustered environment.
12-dm-permissions.rules ファイルを用いて、さらなるカスタマイズされたアクセス権ルールを追加することができます。このファイルは/lib/udev/rules ディレクトリにはインストール されず/usr/share/doc/device-mapper-version ディレクトリにあります。12-dm-permissions.rules ファイルは、アクセス権設定方法のヒントが記載されたテンプレートで、一例として取り上げられている一部のマッチングルールをベースとしています。ファイルには、一般的な状況の例が記載されています。このファイルを編集して、手動で/etc/udev/rules.d ディレクトリに配置すると、アップデートがあってもそのまま残り、設定が維持されます。
これらのルールは、イベントの処理中に、他のルールによっても使用可能なすべての基本的な変数をセットします。
以下の変数は、10-dm.rules 内でセットされています:
  • DM_NAME: デバイスマッパーデバイスの名前
  • DM_UUID: デバイスマッパーデバイスのUUID
  • DM_SUSPENDED: デバイスマッパーデバイスの停止状態
  • DM_UDEV_RULES_VSN: udev ルールバージョン (これは主に、前述の変数が。正式なデバイスマッパールールによって直接セットされていることを、他すべてのルールが確認するためのものです)
以下の変数は、11-dm-lvm.rules で設定されています:
  • DM_LV_NAME: 論理ボリューム名
  • DM_VG_NAME: ボリュームグループ名
  • DM_LV_LAYER: LVM レイヤー名
12-dm-permissions.rules ファイルに文書化されているように、これらの変数を、12-dm-permissions.rules ファイル内で使用して、特定のデバイスマッパーデバイスのアクセス権を定義することができます。

A.3.2. udev をサポートするコマンドとインターフェース

表A.2「udev をサポートする dmsetup コマンド」 には、udevの統合をサポートする dmsetup コマンドについてまとめています。
Expand
表A.2 udev をサポートする dmsetup コマンド
コマンド説明
dmsetup udevcompleteudev がルールの処理を完了し、待機中のプロセスのロックを解除したことを通知するのに使用されます (95-dm-notify.rules 内の udev ルールの中から呼び出されます)。
dmsetup udevcomplete_allデバッグの目的で使用され、待機中の全プロセスのロックを手動で解除します。
dmsetup udevcookiesデバッグの目的で使用され、既存の全クッキー (システム全体のセマフォ) を表示します。
dmsetup udevcreatecookieクッキー (セマフォ) を手動で作成するのに使用されます。これは、単一の同期リソース下で、より多くのプロセスを実行するのに役立ちます。
dmsetup udevreleasecookieその単一の同期クッキー下に置かれるすべてのプロセスに関連した、全 udev 処理に待つのに使用されます。
udev 統合をサポートする dmsetup オプションは、以下の通りです。
--udevcookie
udevトランザクションに追加したいすべての dmsetup プロセスを対象に定義する必要があります。udevcreatecookie および udevreleasecookie と併せて使用されます:
COOKIE=$(dmsetup udevcreatecookie)
  dmsetup command --udevcookie $COOKIE ....
  dmsetup command --udevcookie $COOKIE ....
  ....
  dmsetup command --udevcookie $COOKIE ....
dmsetup udevreleasecookie --udevcookie $COOKIE
Copy to Clipboard Toggle word wrap
--udevcookie オプションを使用する以外には、プロセスの環境に変数を単にエクスポートすることができます。
export DM_UDEV_COOKIE=$(dmsetup udevcreatecookie)
  dmsetup command ...
  dmsetup command ...
  ...
  dmsetup command ...
Copy to Clipboard Toggle word wrap
--noudevrules
udev ルールを無効にします。Nodes/symlinks は、libdevmapper 自体によって作成されます (旧式の方法)。このオプションは、udev が適正に機能しない場合のデバッグを目的としています。
--noudevsync
udev の同期を無効にします。これもデバッグを目的としています。
dmsetup とそのオプション関する情報は、dmsetup(8) の man ページをご覧ください。
LVM コマンドは、udev の統合に対応した以下のオプションをサポートします。
  • --noudevrules: dmsetup コマンドにおいて、udev ルールを無効にします。
  • --noudevsync: dmsetup コマンドにおいて、udev 同期を無効にします。
lvm.conf ファイルには、udev の統合をサポートする以下のオプションが含まれます:
  • udev_rules: すべての LVM2 コマンドを対象に udev_rules をグローバルに有効/無効にします。
  • udev_sync: すべての LVM コマンドを対象に udev 同期をグローバルに有効/無効にします。
lvm.conf ファイルオプションに関する詳細情報は、lvm.conf ファイルのインラインコメントをご覧ください。

付録B LVM 設定ファイル

LVM は複数の設定ファイルに対応しています。システム起動時に lvm.conf 設定ファイルが、環境変数 LVM_SYSTEM_DIR によって指定されたディレクトリからロードされます。このディレクトリはデフォルトでは /etc/lvm にセットしてあります。
The lvm.conf file can specify additional configuration files to load. Settings in later files override settings from earlier ones. To display the settings in use after loading all the configuration files, execute the lvmconfig command.
追加の設定ファイルのロードに関する情報は、「ホストタグ」 をご覧ください。

B.1. LVM 設定ファイル

LVM 設定に使用されるファイルは以下のとおりです。
/etc/lvm/lvm.conf
ツールで読み込まれる中央設定ファイル
etc/lvm/lvm_hosttag.conf
For each host tag, an extra configuration file is read if it exists: lvm_hosttag.conf. If that file defines new tags, then further configuration files will be appended to the list of files to read in. For information on host tags, see 「ホストタグ」.
LVM profiles
An LVM profile is a set of selected customizable configuration settings that can be implemented for specific environments. The settings in an LVM profile can be used to override existing configuration. For information on LVM profiles see 「LVM Profiles」.
LVM 設定ファイルの他にも、LVM を稼働しているシステムには LVM システムセットアップに影響する以下のようなファイルが含まれます。
/etc/lvm/cache/.cache
デバイス名フィルターキャッシュファイル (設定可能)
/etc/lvm/backup/
ボリュームグループメタデータの自動バックアップ用ディレクトリ (設定可能)
/etc/lvm/archive/
ボリュームグループメタデータの自動アーカイブ用ディレクトリ (ディレクトリパスとアーカイブ履歴の範囲に関して設定可能)
/var/lock/lvm/
単一ホストの設定では、並行ツール実行によるメタデータの破損を防止するロックファイルが使用され、クラスターでは、クラスター全域の DLM が使用されます。

B.2. The lvmconfig Command

You can display the current LVM configuration, or save the configuration to a file, with the lvmconfig command. The lvmconfig command displays the LVM configuration information after loading the /etc/lvm/lvm.conf file and any other configuration files.
There are a variety of features that the lvmconfig command provides, including the following;
  • You can dump the current lvm configuration merged with any tag configuration files.
  • You can dump all current configuration settings for which the values differ from the defaults.
  • You can dump all new configuration settings introduced in the current LVM version, in a specific LVM version.
  • You can dump all profilable configuration settings, either in their entirety or separately for command and metadata profiles. For information on LVM profiles see 「LVM Profiles」.
  • You can dump only the configuration settings for a specific version of LVM.
  • You can validate the current configuration.
For a full list of supported features and information on specifying the lvmconfig options, see the lvmconfig man page.

B.3. LVM Profiles

An LVM profile is a set of selected customizable configuration settings that can be used to achieve certain characteristics in various environments or uses. Normally, the name of the profile should reflect that environment or use. An LVM profile overrides existing configuration.
There are two groups of LVM profiles that LVM recognizes: command profiles and metadata profiles.
  • A command profile is used to override selected configuration settings at the global LVM command level. The profile is applied at the beginning of LVM command execution and it is used throughout the time of the LVM command execution. You apply a command profile by specifying the --commandprofile ProfileName option when executing an LVM command.
  • A metadata profile is used to override selected configuration settings at the volume group/logical volume level. It is applied independently for each volume group/logical volume that is being processed. As such, each volume group/logical volume can store the profile name used in its metadata so that next time the volume group/logical volume is processed, the profile is applied automatically. If the volume group and any of its logical volumes have different profiles defined, the profile defined for the logical volume is preferred.
    • You can attach a metadata profile to a volume group or logical volume by specifying the --metadataprofile ProfileName option when you create the volume group or logical volume with the vgcreate or lvcreate command.
    • You can attach or detach a metadata profile to an existing volume group or logical volume by specifying the --metadataprofile ProfileName or the --detachprofile option of the lvchange or vgchange command.
    • You can specify the -o vg_profile and -o lv_profile output options of the vgs and lvs commands to display the metadata profile currently attached to a volume group or a logical volume.
The set of options allowed for command profiles and the set of options allowed for metadata profiles are mutually exclusive. The settings that belong to either of these two sets cannot be mixed together and the LVM tools will reject such profiles.
LVM provides a few predefined configuration profiles. The LVM profiles are stored in the /etc/lvm/profile directory by default. This location can be changed by using the profile_dir setting in the /etc/lvm/lvm.conf file. Each profile configuration is stored in ProfileName.profile file in the profile directory. When referencing the profile in an LVM command, the .profile suffix is omitted.
You can create additional profiles with different values. For this purpose, LVM provides the command_profile_template.profile file (for command profiles) and the metadata_profile_template.profile file (for metadata profiles) which contain all settings that are customizable by profiles of each type. You can copy these template profiles and edit them as needed.
Alternatively, you can use the lvmconfig command to generate a new profile for a given section of the profile file for either profile type. The following command creates a new command profile named ProfileName.profile consisting of the settings in section.
lvmconfig --file ProfileName.profile --type profilable-command section
Copy to Clipboard Toggle word wrap
The following command creates a new metadata profile named ProfileName.profile consisting of the settings in section.
lvmconfig --file ProfileName.profile --type profilable-metadata section
Copy to Clipboard Toggle word wrap
If the section is not specified, all profilable settings are reported.

B.4. サンプルの lvm.conf ファイル

lvm.conf 設定ファイルのサンプルを以下に示します。ご使用のデフォルト設定とは若干異なる可能性があります。

注記

You can generate an lvm.conf file with all of the default values set and with the comments included by running the following command:
lvmconfig --type default --withcomments
Copy to Clipboard Toggle word wrap
# This is an example configuration file for the LVM2 system.
# It contains the default settings that would be used if there was no
# /etc/lvm/lvm.conf file.
#
# Refer to 'man lvm.conf' for further information including the file layout.
#
# To put this file in a different directory and override /etc/lvm set
# the environment variable LVM_SYSTEM_DIR before running the tools.
#
# N.B. Take care that each setting only appears once if uncommenting
# example settings in this file.

# This section allows you to set the way the configuration settings are handled.
config {

    # If enabled, any LVM2 configuration mismatch is reported.
    # This implies checking that the configuration key is understood
    # by LVM2 and that the value of the key is of a proper type.
    # If disabled, any configuration mismatch is ignored and default
    # value is used instead without any warning (a message about the
    # configuration key not being found is issued in verbose mode only).
    checks = 1

    # If enabled, any configuration mismatch aborts the LVM2 process.
    abort_on_errors = 0

    # Directory where LVM looks for configuration profiles.
    profile_dir = "/etc/lvm/profile"
}

# This section allows you to configure which block devices should
# be used by the LVM system.
devices {

    # Where do you want your volume groups to appear ?
    dir = "/dev"

    # An array of directories that contain the device nodes you wish
    # to use with LVM2.
    scan = [ "/dev" ]

    # If set, the cache of block device nodes with all associated symlinks
    # will be constructed out of the existing udev database content.
    # This avoids using and opening any inapplicable non-block devices or
    # subdirectories found in the device directory. This setting is applied
    # to udev-managed device directory only, other directories will be scanned
    # fully. LVM2 needs to be compiled with udev support for this setting to
    # take effect. N.B. Any device node or symlink not managed by udev in
    # udev directory will be ignored with this setting on.
    obtain_device_list_from_udev = 1

    # If several entries in the scanned directories correspond to the
    # same block device and the tools need to display a name for device,
    # all the pathnames are matched against each item in the following
    # list of regular expressions in turn and the first match is used.
    # preferred_names = [ ]

    # Try to avoid using undescriptive /dev/dm-N names, if present.
    preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]

    # A filter that tells LVM2 to only use a restricted set of devices.
    # The filter consists of an array of regular expressions.  These
    # expressions can be delimited by a character of your choice, and
    # prefixed with either an 'a' (for accept) or 'r' (for reject).
    # The first expression found to match a device name determines if
    # the device will be accepted or rejected (ignored).  Devices that
    # don't match any patterns are accepted.

    # Be careful if there there are symbolic links or multiple filesystem 
    # entries for the same device as each name is checked separately against
    # the list of patterns.  The effect is that if the first pattern in the 
    # list to match a name is an 'a' pattern for any of the names, the device
    # is accepted; otherwise if the first pattern in the list to match a name
    # is an 'r' pattern for any of the names it is rejected; otherwise it is
    # accepted.

    # Don't have more than one filter line active at once: only one gets used.

    # Run vgscan after you change this parameter to ensure that
    # the cache file gets regenerated (see below).
    # If it doesn't do what you expect, check the output of 'vgscan -vvvv'.


    # By default we accept every block device:
    filter = [ "a/.*/" ]

    # Exclude the cdrom drive
    # filter = [ "r|/dev/cdrom|" ]

    # When testing I like to work with just loopback devices:
    # filter = [ "a/loop/", "r/.*/" ]

    # Or maybe all loops and ide drives except hdc:
    # filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]

    # Use anchors if you want to be really specific
    # filter = [ "a|^/dev/hda8$|", "r/.*/" ]

    # Since "filter" is often overridden from command line, it is not suitable
    # for system-wide device filtering (udev rules, lvmetad). To hide devices
    # from LVM-specific udev processing and/or from lvmetad, you need to set
    # global_filter. The syntax is the same as for normal "filter"
    # above. Devices that fail the global_filter are not even opened by LVM.

    # global_filter = []

    # The results of the filtering are cached on disk to avoid
    # rescanning dud devices (which can take a very long time).
    # By default this cache is stored in the /etc/lvm/cache directory
    # in a file called '.cache'.
    # It is safe to delete the contents: the tools regenerate it.
    # (The old setting 'cache' is still respected if neither of
    # these new ones is present.)
    # N.B. If obtain_device_list_from_udev is set to 1 the list of
    # devices is instead obtained from udev and any existing .cache
    # file is removed.
    cache_dir = "/etc/lvm/cache"
    cache_file_prefix = ""

    # You can turn off writing this cache file by setting this to 0.
    write_cache_state = 1

    # Advanced settings.

    # List of pairs of additional acceptable block device types found 
    # in /proc/devices with maximum (non-zero) number of partitions.
    # types = [ "fd", 16 ]

    # If sysfs is mounted (2.6 kernels) restrict device scanning to 
    # the block devices it believes are valid.
    # 1 enables; 0 disables.
    sysfs_scan = 1

    # By default, LVM2 will ignore devices used as component paths
    # of device-mapper multipath devices.
    # 1 enables; 0 disables.
    multipath_component_detection = 1

    # By default, LVM2 will ignore devices used as components of
    # software RAID (md) devices by looking for md superblocks.
    # 1 enables; 0 disables.
    md_component_detection = 1

    # By default, if a PV is placed directly upon an md device, LVM2
    # will align its data blocks with the md device's stripe-width.
    # 1 enables; 0 disables.
    md_chunk_alignment = 1

    # Default alignment of the start of a data area in MB.  If set to 0,
    # a value of 64KB will be used.  Set to 1 for 1MiB, 2 for 2MiB, etc.
    # default_data_alignment = 1

    # By default, the start of a PV's data area will be a multiple of
    # the 'minimum_io_size' or 'optimal_io_size' exposed in sysfs.
    # - minimum_io_size - the smallest request the device can perform
    #   w/o incurring a read-modify-write penalty (e.g. MD's chunk size)
    # - optimal_io_size - the device's preferred unit of receiving I/O
    #   (e.g. MD's stripe width)
    # minimum_io_size is used if optimal_io_size is undefined (0).
    # If md_chunk_alignment is enabled, that detects the optimal_io_size.
    # This setting takes precedence over md_chunk_alignment.
    # 1 enables; 0 disables.
    data_alignment_detection = 1

    # Alignment (in KB) of start of data area when creating a new PV.
    # md_chunk_alignment and data_alignment_detection are disabled if set.
    # Set to 0 for the default alignment (see: data_alignment_default)
    # or page size, if larger.
    data_alignment = 0

    # By default, the start of the PV's aligned data area will be shifted by
    # the 'alignment_offset' exposed in sysfs.  This offset is often 0 but
    # may be non-zero; e.g.: certain 4KB sector drives that compensate for
    # windows partitioning will have an alignment_offset of 3584 bytes
    # (sector 7 is the lowest aligned logical block, the 4KB sectors start
    # at LBA -1, and consequently sector 63 is aligned on a 4KB boundary).
    # But note that pvcreate --dataalignmentoffset will skip this detection.
    # 1 enables; 0 disables.
    data_alignment_offset_detection = 1

    # If, while scanning the system for PVs, LVM2 encounters a device-mapper
    # device that has its I/O suspended, it waits for it to become accessible.
    # Set this to 1 to skip such devices.  This should only be needed
    # in recovery situations.
    ignore_suspended_devices = 0

    # During each LVM operation errors received from each device are counted.
    # If the counter of a particular device exceeds the limit set here, no
    # further I/O is sent to that device for the remainder of the respective
    # operation. Setting the parameter to 0 disables the counters altogether.
    disable_after_error_count = 0

    # Allow use of pvcreate --uuid without requiring --restorefile.
    require_restorefile_with_uuid = 1

    # Minimum size (in KB) of block devices which can be used as PVs.
    # In a clustered environment all nodes must use the same value.
    # Any value smaller than 512KB is ignored.

    # Ignore devices smaller than 2MB such as floppy drives.
    pv_min_size = 2048

    # The original built-in setting was 512 up to and including version 2.02.84.
    # pv_min_size = 512

    # Issue discards to a logical volumes's underlying physical volume(s) when
    # the logical volume is no longer using the physical volumes' space (e.g.
    # lvremove, lvreduce, etc).  Discards inform the storage that a region is
    # no longer in use.  Storage that supports discards advertise the protocol
    # specific way discards should be issued by the kernel (TRIM, UNMAP, or
    # WRITE SAME with UNMAP bit set).  Not all storage will support or benefit
    # from discards but SSDs and thinly provisioned LUNs generally do.  If set
    # to 1, discards will only be issued if both the storage and kernel provide
    # support.
    # 1 enables; 0 disables.
    issue_discards = 0
}

# This section allows you to configure the way in which LVM selects
# free space for its Logical Volumes.
allocation {

    # When searching for free space to extend an LV, the "cling"
    # allocation policy will choose space on the same PVs as the last
    # segment of the existing LV.  If there is insufficient space and a
    # list of tags is defined here, it will check whether any of them are
    # attached to the PVs concerned and then seek to match those PV tags
    # between existing extents and new extents.
    # Use the special tag "@*" as a wildcard to match any PV tag.
 
    # Example: LVs are mirrored between two sites within a single VG.
    # PVs are tagged with either @site1 or @site2 to indicate where
    # they are situated.

    # cling_tag_list = [ "@site1", "@site2" ]
    # cling_tag_list = [ "@*" ]

    # Changes made in version 2.02.85 extended the reach of the 'cling'
    # policies to detect more situations where data can be grouped
    # onto the same disks.  Set this to 0 to revert to the previous
    # algorithm.
    maximise_cling = 1

    # Set to 1 to guarantee that mirror logs will always be placed on 
    # different PVs from the mirror images.  This was the default
    # until version 2.02.85.
    mirror_logs_require_separate_pvs = 0

    # Set to 1 to guarantee that thin pool metadata will always
    # be placed on different PVs from the pool data.
    thin_pool_metadata_require_separate_pvs = 0

    # Specify the minimal chunk size (in KB) for thin pool volumes.
    # Use of the larger chunk size may improve perfomance for plain
    # thin volumes, however using them for snapshot volumes is less efficient,
    # as it consumes more space and takes extra time for copying.
    # When unset, lvm tries to estimate chunk size starting from 64KB
    # Supported values are in range from 64 to 1048576.
    # thin_pool_chunk_size = 64

    # Specify discards behavior of the thin pool volume.
    # Select one of  "ignore", "nopassdown", "passdown"
    # thin_pool_discards = "passdown"

    # Set to 0, to disable zeroing of thin pool data chunks before their
    # first use.
    # N.B. zeroing larger thin pool chunk size degrades performance.
    # thin_pool_zero = 1
}

# This section that allows you to configure the nature of the
# information that LVM2 reports.
log {

    # Controls the messages sent to stdout or stderr.
    # There are three levels of verbosity, 3 being the most verbose.
    verbose = 0

    # Set to 1 to suppress all non-essential messages from stdout.
    # This has the same effect as -qq.
    # When this is set, the following commands still produce output:
    # dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay, 
    # pvs, version, vgcfgrestore -l, vgdisplay, vgs.
    # Non-essential messages are shifted from log level 4 to log level 5
    # for syslog and lvm2_log_fn purposes.
    # Any 'yes' or 'no' questions not overridden by other arguments
    # are suppressed and default to 'no'.
    silent = 0

    # Should we send log messages through syslog?
    # 1 is yes; 0 is no.
    syslog = 1

    # Should we log error and debug messages to a file?
    # By default there is no log file.
    #file = "/var/log/lvm2.log"

    # Should we overwrite the log file each time the program is run?
    # By default we append.
    overwrite = 0

    # What level of log messages should we send to the log file and/or syslog?
    # There are 6 syslog-like log levels currently in use - 2 to 7 inclusive.
    # 7 is the most verbose (LOG_DEBUG).
    level = 0

    # Format of output messages
    # Whether or not (1 or 0) to indent messages according to their severity
    indent = 1

    # Whether or not (1 or 0) to display the command name on each line output
    command_names = 0

    # A prefix to use before the message text (but after the command name,
    # if selected).  Default is two spaces, so you can see/grep the severity
    # of each message.
    prefix = "  "

    # To make the messages look similar to the original LVM tools use:
    #   indent = 0
    #   command_names = 1
    #   prefix = " -- "

    # Set this if you want log messages during activation.
    # Don't use this in low memory situations (can deadlock).
    # activation = 0

    # Some debugging messages are assigned to a class and only appear
    # in debug output if the class is listed here.
    # Classes currently available:
    #   memory, devices, activation, allocation, lvmetad, metadata, cache,
    #   locking
    # Use "all" to see everything.
    debug_classes = [ "memory", "devices", "activation", "allocation",
		      "lvmetad", "metadata", "cache", "locking" ]
}

# Configuration of metadata backups and archiving.  In LVM2 when we
# talk about a 'backup' we mean making a copy of the metadata for the
# *current* system.  The 'archive' contains old metadata configurations.
# Backups are stored in a human readeable text format.
backup {

    # Should we maintain a backup of the current metadata configuration ?
    # Use 1 for Yes; 0 for No.
    # Think very hard before turning this off!
    backup = 1

    # Where shall we keep it ?
    # Remember to back up this directory regularly!
    backup_dir = "/etc/lvm/backup"

    # Should we maintain an archive of old metadata configurations.
    # Use 1 for Yes; 0 for No.
    # On by default.  Think very hard before turning this off.
    archive = 1

    # Where should archived files go ?
    # Remember to back up this directory regularly!
    archive_dir = "/etc/lvm/archive"

    # What is the minimum number of archive files you wish to keep ?
    retain_min = 10

    # What is the minimum time you wish to keep an archive file for ?
    retain_days = 30
}

# Settings for the running LVM2 in shell (readline) mode.
shell {

    # Number of lines of history to store in ~/.lvm_history
    history_size = 100
}


# Miscellaneous global LVM2 settings
global {
    # The file creation mask for any files and directories created.
    # Interpreted as octal if the first digit is zero.
    umask = 077

    # Allow other users to read the files
    #umask = 022

    # Enabling test mode means that no changes to the on disk metadata
    # will be made.  Equivalent to having the -t option on every
    # command.  Defaults to off.
    test = 0

    # Default value for --units argument
    units = "h"

    # Since version 2.02.54, the tools distinguish between powers of
    # 1024 bytes (e.g. KiB, MiB, GiB) and powers of 1000 bytes (e.g.
    # KB, MB, GB).
    # If you have scripts that depend on the old behaviour, set this to 0
    # temporarily until you update them.
    si_unit_consistency = 1

    # Whether or not to communicate with the kernel device-mapper.
    # Set to 0 if you want to use the tools to manipulate LVM metadata 
    # without activating any logical volumes.
    # If the device-mapper kernel driver is not present in your kernel
    # setting this to 0 should suppress the error messages.
    activation = 1

    # If we can't communicate with device-mapper, should we try running 
    # the LVM1 tools?
    # This option only applies to 2.4 kernels and is provided to help you
    # switch between device-mapper kernels and LVM1 kernels.
    # The LVM1 tools need to be installed with .lvm1 suffices
    # e.g. vgscan.lvm1 and they will stop working after you start using
    # the new lvm2 on-disk metadata format.
    # The default value is set when the tools are built.
    # fallback_to_lvm1 = 0

    # The default metadata format that commands should use - "lvm1" or "lvm2".
    # The command line override is -M1 or -M2.
    # Defaults to "lvm2".
    # format = "lvm2"

    # Location of proc filesystem
    proc = "/proc"

    # Type of locking to use. Defaults to local file-based locking (1).
    # Turn locking off by setting to 0 (dangerous: risks metadata corruption
    # if LVM2 commands get run concurrently).
    # Type 2 uses the external shared library locking_library.
    # Type 3 uses built-in clustered locking.
    # Type 4 uses read-only locking which forbids any operations that might 
    # change metadata.
    locking_type = 1

    # Set to 0 to fail when a lock request cannot be satisfied immediately.
    wait_for_locks = 1

    # If using external locking (type 2) and initialisation fails,
    # with this set to 1 an attempt will be made to use the built-in
    # clustered locking.
    # If you are using a customised locking_library you should set this to 0.
    fallback_to_clustered_locking = 1

    # If an attempt to initialise type 2 or type 3 locking failed, perhaps
    # because cluster components such as clvmd are not running, with this set
    # to 1 an attempt will be made to use local file-based locking (type 1).
    # If this succeeds, only commands against local volume groups will proceed.
    # Volume Groups marked as clustered will be ignored.
    fallback_to_local_locking = 1

    # Local non-LV directory that holds file-based locks while commands are
    # in progress.  A directory like /tmp that may get wiped on reboot is OK.
    locking_dir = "/var/lock/lvm"

    # Whenever there are competing read-only and read-write access requests for
    # a volume group's metadata, instead of always granting the read-only
    # requests immediately, delay them to allow the read-write requests to be
    # serviced.  Without this setting, write access may be stalled by a high
    # volume of read-only requests.
    # NB. This option only affects locking_type = 1 viz. local file-based
    # locking.
    prioritise_write_locks = 1

    # Other entries can go here to allow you to load shared libraries
    # e.g. if support for LVM1 metadata was compiled as a shared library use
    #   format_libraries = "liblvm2format1.so" 
    # Full pathnames can be given.

    # Search this directory first for shared libraries.
    #   library_dir = "/lib"

    # The external locking library to load if locking_type is set to 2.
    #   locking_library = "liblvm2clusterlock.so"

    # Treat any internal errors as fatal errors, aborting the process that
    # encountered the internal error. Please only enable for debugging.
    abort_on_internal_errors = 0

    # Check whether CRC is matching when parsed VG is used multiple times.
    # This is useful to catch unexpected internal cached volume group
    # structure modification. Please only enable for debugging.
    detect_internal_vg_cache_corruption = 0

    # If set to 1, no operations that change on-disk metadata will be permitted.
    # Additionally, read-only commands that encounter metadata in need of repair
    # will still be allowed to proceed exactly as if the repair had been 
    # performed (except for the unchanged vg_seqno).
    # Inappropriate use could mess up your system, so seek advice first!
    metadata_read_only = 0

    # 'mirror_segtype_default' defines which segtype will be used when the
    # shorthand '-m' option is used for mirroring.  The possible options are:
    #
    # "mirror" - The original RAID1 implementation provided by LVM2/DM.  It is
    # 	         characterized by a flexible log solution (core, disk, mirrored)
    #		 and by the necessity to block I/O while reconfiguring in the
    #		 event of a failure.
    #
    #		 There is an inherent race in the dmeventd failure handling
    #		 logic with snapshots of devices using this type of RAID1 that
    #		 in the worst case could cause a deadlock.
    #		   Ref: https://bugzilla.redhat.com/show_bug.cgi?id=817130#c10
    #
    # "raid1"  - This implementation leverages MD's RAID1 personality through
    # 	       	 device-mapper.  It is characterized by a lack of log options.
    #		 (A log is always allocated for every device and they are placed
    #		 on the same device as the image - no separate devices are
    #		 required.)  This mirror implementation does not require I/O
    #		 to be blocked in the kernel in the event of a failure.
    #		 This mirror implementation is not cluster-aware and cannot be
    #		 used in a shared (active/active) fashion in a cluster.
    #
    # Specify the '--type <mirror|raid1>' option to override this default
    # setting.
    mirror_segtype_default = "mirror"

    # 'raid10_segtype_default' determines the segment types used by default
    # when the '--stripes/-i' and '--mirrors/-m' arguments are both specified
    # during the creation of a logical volume.
    # Possible settings include:
    #
    # "raid10" - This implementation leverages MD's RAID10 personality through
    #            device-mapper.
    #
    # "mirror" - LVM will layer the 'mirror' and 'stripe' segment types.  It
    #            will do this by creating a mirror on top of striped sub-LVs;
    #            effectively creating a RAID 0+1 array.  This is suboptimal
    #            in terms of providing redunancy and performance.  Changing to
    #            this setting is not advised.
    # Specify the '--type <raid10|mirror>' option to override this default
    # setting.
    raid10_segtype_default = "mirror"

    # The default format for displaying LV names in lvdisplay was changed 
    # in version 2.02.89 to show the LV name and path separately.
    # Previously this was always shown as /dev/vgname/lvname even when that
    # was never a valid path in the /dev filesystem.
    # Set to 1 to reinstate the previous format.
    #
    # lvdisplay_shows_full_device_path = 0

    # Whether to use (trust) a running instance of lvmetad. If this is set to
    # 0, all commands fall back to the usual scanning mechanisms. When set to 1
    # *and* when lvmetad is running (it is not auto-started), the volume group
    # metadata and PV state flags are obtained from the lvmetad instance and no
    # scanning is done by the individual commands. In a setup with lvmetad,
    # lvmetad udev rules *must* be set up for LVM to work correctly. Without
    # proper udev rules, all changes in block device configuration will be
    # *ignored* until a manual 'pvscan --cache' is performed.
    #
    # If lvmetad has been running while use_lvmetad was 0, it MUST be stopped
    # before changing use_lvmetad to 1 and started again afterwards.
    use_lvmetad = 0

    # Full path of the utility called to check that a thin metadata device
    # is in a state that allows it to be used.
    # Each time a thin pool needs to be activated or after it is deactivated
    # this utility is executed. The activation will only proceed if the utility
    # has an exit status of 0.
    # Set to "" to skip this check.  (Not recommended.)
    # The thin tools are available as part of the device-mapper-persistent-data
    # package from https://github.com/jthornber/thin-provisioning-tools.
    #
    # thin_check_executable = "/usr/sbin/thin_check"

    # Array of string options passed with thin_check command. By default,
    # option "-q" is for quiet output.
    # With thin_check version 2.1 or newer you can add "--ignore-non-fatal-errors"
    # to let it pass through ignoreable errors and fix them later.
    #
    # thin_check_options = [ "-q" ]

    # Full path of the utility called to repair a thin metadata device
    # is in a state that allows it to be used.
    # Each time a thin pool needs repair this utility is executed.
    # See thin_check_executable how to obtain binaries.
    #
    # thin_repair_executable = "/usr/sbin/thin_repair"

    # Array of extra string options passed with thin_repair command.
    # thin_repair_options = [ "" ]

    # Full path of the utility called to dump thin metadata content.
    # See thin_check_executable how to obtain binaries.
    #
    # thin_dump_executable = "/usr/sbin/thin_dump"

    # If set, given features are not used by thin driver.
    # This can be helpful not just for testing, but i.e. allows to avoid
    # using problematic implementation of some thin feature.
    # Features:
    #   block_size
    #   discards
    #   discards_non_power_2
    #   external_origin
    #   metadata_resize
    #
    # thin_disabled_features = [ "discards", "block_size" ]
}

activation {
    # Set to 1 to perform internal checks on the operations issued to
    # libdevmapper.  Useful for debugging problems with activation.
    # Some of the checks may be expensive, so it's best to use this
    # only when there seems to be a problem.
    checks = 0

    # Set to 0 to disable udev synchronisation (if compiled into the binaries).
    # Processes will not wait for notification from udev.
    # They will continue irrespective of any possible udev processing
    # in the background.  You should only use this if udev is not running
    # or has rules that ignore the devices LVM2 creates.
    # The command line argument --nodevsync takes precedence over this setting.
    # If set to 1 when udev is not running, and there are LVM2 processes
    # waiting for udev, run 'dmsetup udevcomplete_all' manually to wake them up.
    udev_sync = 1

    # Set to 0 to disable the udev rules installed by LVM2 (if built with
    # --enable-udev_rules). LVM2 will then manage the /dev nodes and symlinks
    # for active logical volumes directly itself.
    # N.B. Manual intervention may be required if this setting is changed
    # while any logical volumes are active.
    udev_rules = 1

    # Set to 1 for LVM2 to verify operations performed by udev. This turns on
    # additional checks (and if necessary, repairs) on entries in the device
    # directory after udev has completed processing its events. 
    # Useful for diagnosing problems with LVM2/udev interactions.
    verify_udev_operations = 0

    # If set to 1 and if deactivation of an LV fails, perhaps because
    # a process run from a quick udev rule temporarily opened the device,
    # retry the operation for a few seconds before failing.
    retry_deactivation = 1

    # How to fill in missing stripes if activating an incomplete volume.
    # Using "error" will make inaccessible parts of the device return
    # I/O errors on access.  You can instead use a device path, in which 
    # case, that device will be used to in place of missing stripes.
    # But note that using anything other than "error" with mirrored 
    # or snapshotted volumes is likely to result in data corruption.
    missing_stripe_filler = "error"

    # The linear target is an optimised version of the striped target
    # that only handles a single stripe.  Set this to 0 to disable this
    # optimisation and always use the striped target.
    use_linear_target = 1

    # How much stack (in KB) to reserve for use while devices suspended
    # Prior to version 2.02.89 this used to be set to 256KB
    reserved_stack = 64

    # How much memory (in KB) to reserve for use while devices suspended
    reserved_memory = 8192

    # Nice value used while devices suspended
    process_priority = -18

    # If volume_list is defined, each LV is only activated if there is a
    # match against the list.
    #
    #   "vgname" and "vgname/lvname" are matched exactly.
    #   "@tag" matches any tag set in the LV or VG.
    #   "@*" matches if any tag defined on the host is also set in the LV or VG
    #
    # If any host tags exist but volume_list is not defined, a default
    # single-entry list containing "@*" is assumed.
    #
    # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]

    # If auto_activation_volume_list is defined, each LV that is to be
    # activated with the autoactivation option (--activate ay/-a ay) is
    # first checked against the list. There are two scenarios in which
    # the autoactivation option is used:
    #
    #   - automatic activation of volumes based on incoming PVs. If all the
    #     PVs making up a VG are present in the system, the autoactivation
    #     is triggered. This requires lvmetad (global/use_lvmetad=1) and udev
    #     to be running. In this case, "pvscan --cache -aay" is called
    #     automatically without any user intervention while processing
    #     udev events. Please, make sure you define auto_activation_volume_list
    #     properly so only the volumes you want and expect are autoactivated.
    #
    #   - direct activation on command line with the autoactivation option.
    #     In this case, the user calls "vgchange --activate ay/-a ay" or
    #     "lvchange --activate ay/-a ay" directly.
    #
    # By default, the auto_activation_volume_list is not defined and all
    # volumes will be activated either automatically or by using --activate ay/-a ay.
    #
    # N.B. The "activation/volume_list" is still honoured in all cases so even
    # if the VG/LV passes the auto_activation_volume_list, it still needs to
    # pass the volume_list for it to be activated in the end.

    # If auto_activation_volume_list is defined but empty, no volumes will be
    # activated automatically and --activate ay/-a ay will do nothing.
    #
    # auto_activation_volume_list = []

    # If auto_activation_volume_list is defined and it's not empty, only matching
    # volumes will be activated either automatically or by using --activate ay/-a ay.
    #
    #   "vgname" and "vgname/lvname" are matched exactly.
    #   "@tag" matches any tag set in the LV or VG.
    #   "@*" matches if any tag defined on the host is also set in the LV or VG
    #
    # auto_activation_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]

    # If read_only_volume_list is defined, each LV that is to be activated 
    # is checked against the list, and if it matches, it as activated
    # in read-only mode.  (This overrides '--permission rw' stored in the
    # metadata.)
    #
    #   "vgname" and "vgname/lvname" are matched exactly.
    #   "@tag" matches any tag set in the LV or VG.
    #   "@*" matches if any tag defined on the host is also set in the LV or VG
    #
    # read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]

    # Each LV can have an 'activation skip' flag stored persistently against it.
    # During activation, this flag is used to decide whether such an LV is skipped.
    # The 'activation skip' flag can be set during LV creation and by default it
    # is automatically set for thin snapshot LVs. The 'auto_set_activation_skip'
    # enables or disables this automatic setting of the flag while LVs are created.
    # auto_set_activation_skip = 1

    # For RAID or 'mirror' segment types, 'raid_region_size' is the
    # size (in kiB) of each:
    # - synchronization operation when initializing
    # - each copy operation when performing a 'pvmove' (using 'mirror' segtype)
    # This setting has replaced 'mirror_region_size' since version 2.02.99
    raid_region_size = 512

    # Setting to use when there is no readahead value stored in the metadata.
    #
    # "none" - Disable readahead.
    # "auto" - Use default value chosen by kernel.
    readahead = "auto"

    # 'raid_fault_policy' defines how a device failure in a RAID logical
    # volume is handled.  This includes logical volumes that have the following
    # segment types: raid1, raid4, raid5*, and raid6*.
    #
    # In the event of a failure, the following policies will determine what
    # actions are performed during the automated response to failures (when
    # dmeventd is monitoring the RAID logical volume) and when 'lvconvert' is
    # called manually with the options '--repair' and '--use-policies'.
    #
    # "warn"	- Use the system log to warn the user that a device in the RAID
    # 		  logical volume has failed.  It is left to the user to run
    #		  'lvconvert --repair' manually to remove or replace the failed
    #		  device.  As long as the number of failed devices does not
    #		  exceed the redundancy of the logical volume (1 device for
    #		  raid4/5, 2 for raid6, etc) the logical volume will remain
    #		  usable.
    #
    # "allocate" - Attempt to use any extra physical volumes in the volume
    # 		  group as spares and replace faulty devices.
    #
    raid_fault_policy = "warn"

    # 'mirror_image_fault_policy' and 'mirror_log_fault_policy' define
    # how a device failure affecting a mirror (of "mirror" segment type) is
    # handled.  A mirror is composed of mirror images (copies) and a log.
    # A disk log ensures that a mirror does not need to be re-synced
    # (all copies made the same) every time a machine reboots or crashes.
    #
    # In the event of a failure, the specified policy will be used to determine
    # what happens. This applies to automatic repairs (when the mirror is being
    # monitored by dmeventd) and to manual lvconvert --repair when
    # --use-policies is given.
    #
    # "remove" - Simply remove the faulty device and run without it.  If
    #            the log device fails, the mirror would convert to using
    #            an in-memory log.  This means the mirror will not
    #            remember its sync status across crashes/reboots and
    #            the entire mirror will be re-synced.  If a
    #            mirror image fails, the mirror will convert to a
    #            non-mirrored device if there is only one remaining good
    #            copy.
    #
    # "allocate" - Remove the faulty device and try to allocate space on
    #            a new device to be a replacement for the failed device.
    #            Using this policy for the log is fast and maintains the
    #            ability to remember sync state through crashes/reboots.
    #            Using this policy for a mirror device is slow, as it
    #            requires the mirror to resynchronize the devices, but it
    #            will preserve the mirror characteristic of the device.
    #            This policy acts like "remove" if no suitable device and
    #            space can be allocated for the replacement.
    #
    # "allocate_anywhere" - Not yet implemented. Useful to place the log device
    #            temporarily on same physical volume as one of the mirror
    #            images. This policy is not recommended for mirror devices
    #            since it would break the redundant nature of the mirror. This
    #            policy acts like "remove" if no suitable device and space can
    #            be allocated for the replacement.

    mirror_log_fault_policy = "allocate"
    mirror_image_fault_policy = "remove"

    # 'snapshot_autoextend_threshold' and 'snapshot_autoextend_percent' define
    # how to handle automatic snapshot extension. The former defines when the
    # snapshot should be extended: when its space usage exceeds this many
    # percent. The latter defines how much extra space should be allocated for
    # the snapshot, in percent of its current size.
    #
    # For example, if you set snapshot_autoextend_threshold to 70 and
    # snapshot_autoextend_percent to 20, whenever a snapshot exceeds 70% usage,
    # it will be extended by another 20%. For a 1G snapshot, using up 700M will
    # trigger a resize to 1.2G. When the usage exceeds 840M, the snapshot will
    # be extended to 1.44G, and so on.
    #
    # Setting snapshot_autoextend_threshold to 100 disables automatic
    # extensions. The minimum value is 50 (A setting below 50 will be treated
    # as 50).

    snapshot_autoextend_threshold = 100
    snapshot_autoextend_percent = 20

    # 'thin_pool_autoextend_threshold' and 'thin_pool_autoextend_percent' define
    # how to handle automatic pool extension. The former defines when the
    # pool should be extended: when its space usage exceeds this many
    # percent. The latter defines how much extra space should be allocated for
    # the pool, in percent of its current size.
    #
    # For example, if you set thin_pool_autoextend_threshold to 70 and
    # thin_pool_autoextend_percent to 20, whenever a pool exceeds 70% usage,
    # it will be extended by another 20%. For a 1G pool, using up 700M will
    # trigger a resize to 1.2G. When the usage exceeds 840M, the pool will
    # be extended to 1.44G, and so on.
    #
    # Setting thin_pool_autoextend_threshold to 100 disables automatic
    # extensions. The minimum value is 50 (A setting below 50 will be treated
    # as 50).

    thin_pool_autoextend_threshold = 100
    thin_pool_autoextend_percent = 20

    # While activating devices, I/O to devices being (re)configured is
    # suspended, and as a precaution against deadlocks, LVM2 needs to pin
    # any memory it is using so it is not paged out.  Groups of pages that
    # are known not to be accessed during activation need not be pinned
    # into memory.  Each string listed in this setting is compared against
    # each line in /proc/self/maps, and the pages corresponding to any
    # lines that match are not pinned.  On some systems locale-archive was
    # found to make up over 80% of the memory used by the process.
    # mlock_filter = [ "locale/locale-archive", "gconv/gconv-modules.cache" ]

    # Set to 1 to revert to the default behaviour prior to version 2.02.62
    # which used mlockall() to pin the whole process's memory while activating
    # devices.
    use_mlockall = 0

    # Monitoring is enabled by default when activating logical volumes.
    # Set to 0 to disable monitoring or use the --ignoremonitoring option.
    monitoring = 1

    # When pvmove or lvconvert must wait for the kernel to finish
    # synchronising or merging data, they check and report progress
    # at intervals of this number of seconds.  The default is 15 seconds.
    # If this is set to 0 and there is only one thing to wait for, there
    # are no progress reports, but the process is awoken immediately the
    # operation is complete.
    polling_interval = 15
}


####################
# Advanced section #
####################

# Metadata settings
#
# metadata {
    # Default number of copies of metadata to hold on each PV.  0, 1 or 2.
    # You might want to override it from the command line with 0 
    # when running pvcreate on new PVs which are to be added to large VGs.

    # pvmetadatacopies = 1

    # Default number of copies of metadata to maintain for each VG.
    # If set to a non-zero value, LVM automatically chooses which of
    # the available metadata areas to use to achieve the requested
    # number of copies of the VG metadata.  If you set a value larger
    # than the the total number of metadata areas available then
    # metadata is stored in them all.
    # The default value of 0 ("unmanaged") disables this automatic
    # management and allows you to control which metadata areas
    # are used at the individual PV level using 'pvchange
    # --metadataignore y/n'.

    # vgmetadatacopies = 0

    # Approximate default size of on-disk metadata areas in sectors.
    # You should increase this if you have large volume groups or
    # you want to retain a large on-disk history of your metadata changes.

    # pvmetadatasize = 255

    # List of directories holding live copies of text format metadata.
    # These directories must not be on logical volumes!
    # It's possible to use LVM2 with a couple of directories here,
    # preferably on different (non-LV) filesystems, and with no other 
    # on-disk metadata (pvmetadatacopies = 0). Or this can be in
    # addition to on-disk metadata areas.
    # The feature was originally added to simplify testing and is not
    # supported under low memory situations - the machine could lock up.
    #
    # Never edit any files in these directories by hand unless you
    # you are absolutely sure you know what you are doing! Use
    # the supplied toolset to make changes (e.g. vgcfgrestore).

    # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
#}

# Event daemon
#
dmeventd {
    # mirror_library is the library used when monitoring a mirror device.
    #
    # "libdevmapper-event-lvm2mirror.so" attempts to recover from
    # failures.  It removes failed devices from a volume group and
    # reconfigures a mirror as necessary. If no mirror library is
    # provided, mirrors are not monitored through dmeventd.

    mirror_library = "libdevmapper-event-lvm2mirror.so"

    # snapshot_library is the library used when monitoring a snapshot device.
    #
    # "libdevmapper-event-lvm2snapshot.so" monitors the filling of
    # snapshots and emits a warning through syslog when the use of
    # the snapshot exceeds 80%. The warning is repeated when 85%, 90% and
    # 95% of the snapshot is filled.

    snapshot_library = "libdevmapper-event-lvm2snapshot.so"

    # thin_library is the library used when monitoring a thin device.
    #
    # "libdevmapper-event-lvm2thin.so" monitors the filling of
    # pool and emits a warning through syslog when the use of
    # the pool exceeds 80%. The warning is repeated when 85%, 90% and
    # 95% of the pool is filled.

    thin_library = "libdevmapper-event-lvm2thin.so"

    # Full path of the dmeventd binary.
    #
    # executable = "/sbin/dmeventd"
}
Copy to Clipboard Toggle word wrap

付録C LVM Selection Criteria

As of Red Hat Enterpise Linux release 6.6, many LVM reporting commmands accept the -S or --select option to define selection criteria for those commands. As of Red Hat Enterprise Linux release 6.7, many processing commands support selection criteria as well. These two categories of commands for which you can define selection criteria are defined as follows:
  • Reporting commands — Display only the lines that satisfy the selection criteria. Examples of reporting commands for which you can define selection criteria include pvs, vgs, lvs, pvdisplay, vgdisplay, lvdisplay, lvm devtypes, and dmsetup info -c.
    Specifying the -o selected option in addition to the -S option displays all rows and adds a "selected" column that shows 1 if the row matches the selection criteria and 0 if it does not.
  • Processing commands — Process only the items that satisfy the selection criteria. Examples of processing commands for which you can define selection criteria include pvchange, vgchange, lvchange, vgimport, vgexport, vgremove, and lvremove.
Selection criteria are a set of statements that use comparison operators to define the valid values for particular fields to display or process. The selected fields are, in turn, combined by logical and grouping operators.
When specifying which fields to display using selection criteria, there is no requirement for the field which is in the selection criteria to be displayed. The selection criteria can contain one set of fields while the output can contain a different set of fields.
  • For a listing of available fields for the various LVM components, see 「Selection Criteria Fields」.
  • For a listing of allowed operators, see 「Selection Criteria Operators」. The operators are also provided on the lvm(8) man page.
  • You can also see full sets of fields and possible operators by specifying the help (or ?) keyword for the -S/--select option of a reporting commands. For example, the following command displays the fields and possible operators for the lvs command.
    # lvs -S help
    Copy to Clipboard Toggle word wrap
For the Red Hat Enterprise Linux 6.8 release, you can specify time values as selection criteria for fields with a field type of time. For information on specifying time values, see 「Specifying Time Values」.

C.1. Selection Criteria Field Types

The fields you specify for selection criteria are of a particular type. The help output for each field display the field type enclosed in brackets. The following help output examples show the output indicating the field types string, string_list, number, percent, and size.
lv_name             - Name. LVs created for internal use are enclosed in brackets.[string]
lv_role             - LV role. [string list]
raid_mismatch_count - For RAID, number of mismatches found or repaired. [number]
copy_percent        - For RAID, mirrors and pvmove, current percentage in-sync. [percent]
lv_size             - Size of LV in current units. [size]
Copy to Clipboard Toggle word wrap
表C.1「Selection Criteria Field Types」 describes the selection criteria field types
Expand
表C.1 Selection Criteria Field Types
Field TypeDescription
number Non-negative integer value.
size Floating point value with units, 'm' unit used by default if not specified.
percent Non-negative integer with or without % suffix.
string Characters quoted by ' or " or unquoted.
string list Strings enclosed by [ ] or { } and elements delimited by either "all items must match" or "at least one item must match" operator.
The values you specify for a field can be the following:
  • Concrete values of the field type
  • Regular expressions that include any fields of the string field type, such as "+~" operator.
  • Reserved values; for example -1, unknown, undefined, undef are all keywords to denote an undefined numeric value.
  • Defined synonyms for the field values, which can be used in selection criteria for values just as for their original values. For a listing of defined synonyms for field values, see 表C.14「Selection Criteria Synonyms」.

C.2. Selection Criteria Operators

表C.2「Selection Criteria Grouping Operators」 describes the selection criteria grouping operators.
Expand
表C.2 Selection Criteria Grouping Operators
Grouping OperatorDescription
( ) Used for grouping statements
[ ] Used to group strings into a string list (exact match)
{ } Used to group strings into a string list (subset match)
表C.3「Selection Criteria Comparison Operators」 describes the selection criteria comparison operators and the field types with which they can be used.
Expand
表C.3 Selection Criteria Comparison Operators
Comparison OperatorDescriptionField Type
=~ Matching regular expression regex
!~ Not matching regular expression. regex
= Equal to number, size, percent, string, string list
!= Not equal to number, size, percent, string, string list
>= Greater than or equal to number, size, percent
> Greater than number, size, percent
<= Less than or equal to number, size, percent
< Less than number, size, percent
表C.4「Selection Criteria Logical and Grouping Operators」 describes the selection criteria logical and grouping operators.
Expand
表C.4 Selection Criteria Logical and Grouping Operators
Logical and Grouping OperatorDescription
&& All fields must match
, All fields must match (same as &&)
|| At least one field must match
# At least one field must match (same as ||)
! Logical negation
( Left parenthesis (grouping operator)
) Right parenthesis (grouping operator)
[ List start (grouping operator)
] List end (grouping operator)
{ List subset start (grouping operator)
} List subset end (grouping operator)

C.3. Selection Criteria Fields

This section describes the logical and physical volume selection criteria fields you can specify.
表C.5「Logical Volume Fields」 describes the logical volume fields and their field types.
Expand
表C.5 Logical Volume Fields
Logical Volume FieldDescriptionField Type
lv_uuid Unique identifier string
lv_name Name (logical volumes created for internal use are enclosed in brackets) string
lv_full_name Full name of logical volume including its volume group, namely VG/LV string
lv_path Full pathname for logical volume (blank for internal logical volumes) string
lv_dm_path Internal device mapper pathname for logical volume (in /dev/mapper directory) string
lv_parent For logical volumes that are components of another logical volume, the parent logical volume string
lv_layout logical volume layout string list
lv_role logical volume role string list
lv_initial_image_sync Set if mirror/RAID images underwent initial resynchronization number
lv_image_synced Set if mirror/RAID image is synchronized number
lv_merging Set if snapshot logical volume is being merged to origin number
lv_converting Set if logical volume is being converted number
lv_allocation_policy logical volume allocation policy string
lv_allocation_locked Set if logical volume is locked against allocation changes number
lv_fixed_minor Set if logical volume has fixed minor number assigned number
lv_merge_failed Set if snapshot merge failed number
lv_snapshot_invalid Set if snapshot logical volume is invalid number
lv_skip_activation Set if logical volume is skipped on activation number
lv_when_full For thin pools, behavior when full string
lv_active Active state of the logical volume string
lv_active_locally Set if the logical volume is active locally number
lv_active_remotely Set if the logical volume is active remotely number
lv_active_exclusively Set if the logical volume is active exclusively number
lv_major Persistent major number or -1 if not persistent number
lv_minor Persistent minor number or -1 if not persistent number
lv_read_ahead Read ahead setting in current units size
lv_size Size of logical volume in current units size
lv_metadata_size For thin and cache pools, the size of the logical volume that holds the metadata size
seg_count Number of segments in logical volume number
origin For snapshots, the origin device of this logical volume string
origin_size For snapshots, the size of the origin device of this logical volume size
data_percent For snapshot and thin pools and volumes, the percentage full if logical volume is active percent
snap_percent For snapshots, the percentage full if logical volume is active percent
metadata_percent For thin pools, the percentage of metadata full if logical volume is active percent
copy_percent For RAID, mirrors and pvmove, current percentage in-sync percent
sync_percent For RAID, mirrors and pvmove, current percentage in-sync percent
raid_mismatch_count For RAID, number of mismatches found or repaired number
raid_sync_action For RAID, the current synchronization action being performed string
raid_write_behind For RAID1, the number of outstanding writes allowed to writemostly devices number
raid_min_recovery_rate For RAID1, the minimum recovery I/O load in kiB/sec/disk number
raid_max_recovery_rate For RAID1, the maximum recovery I/O load in kiB/sec/disk number
move_pv For pvmove, source physical volume of temporary logical volume created by pvmove string
convert_lv For lvconvert, name of temporary logical volume created by lvconvert string
mirror_log For mirrors, the logical volume holding the synchronization log string
data_lv For thin and cache pools, the logical volume holding the associated data string
metadata_lv For thin and cache pools, the logical volume holding the associated metadata string
pool_lv For thin volumes, the thin pool logical volume for this volume string
lv_tags Tags, if any string list
lv_profile Configuration profile attached to this logical volume string
lv_time Creation time of the logical volume, if known string
lv_host Creation host of the logical volume, if known string
lv_modules Kernel device-mapper modules required for this logical volume string list
表C.6「Logical Volume Device Combined Info and Status Fields」 describes the logical volume device fields that combine both logical device info and logical device status.
Expand
表C.6 Logical Volume Device Combined Info and Status Fields
Logical Volume FieldDescriptionField Type
lv_attr Selects according to both logical volume device info as well as logical volume status. string
表C.7「Logical Volume Device Info Fields」 describes the logical volume device info fields and their field types.
Expand
表C.7 Logical Volume Device Info Fields
Logical Volume FieldDescriptionField Type
lv_kernel_major Currently assigned major number or -1 if logical volume is not active number
lv_kernel_minor Currently assigned minor number or -1 if logical volume is not active number
lv_kernel_read_ahead Currently-in-use read ahead setting in current units size
lv_permissions logical volume permissions string
lv_suspended Set if logical volume is suspended number
lv_live_table Set if logical volume has live table present number
lv_inactive_table Set if logical volume has inactive table present number
lv_device_open Set if logical volume device is open number
表C.8「Logical Volume Device Status Fields」 describes the logical volume device status fields and their field types.
Expand
表C.8 Logical Volume Device Status Fields
Logical Volume FieldDescriptionField Type
cache_total_blocks Total cache blocks number
cache_used_blocks Used cache blocks number
cache_dirty_blocks Dirty cache blocks number
cache_read_hits Cache read hits number
cache_read_misses Cache read misses number
cache_write_hits Cache write hits number
cache_write_misses Cache write misses number
lv_health_status logical volume health status string
表C.9「Physical Volume Label Fields」 describes the physical volume label fields and their field types.
Expand
表C.9 Physical Volume Label Fields
Physical Volume FieldDescriptionField Type
pv_fmt Type of metadata string
pv_uuid Unique identifier string
dev_size Size of underlying device in current units size
pv_name Name string
pv_mda_free Free metadata area space on this device in current units size
pv_mda_size Size of smallest metadata area on this device in current units size
表C.5「Logical Volume Fields」 describes the physical volume fields and their field types.
Expand
表C.10 Pysical Volume Fields
Physical Volume FieldDescriptionField Type
pe_start Offset to the start of data on the underlying device number
pv_size Size of physical volume in current units size
pv_free Total amount of unallocated space in current units size
pv_used Total amount of allocated space in current units size
pv_attr Various attributes string
pv_allocatable Set if this device can be used for allocation number
pv_exported Set if this device is exported number
pv_missing Set if this device is missing in system number
pv_pe_count Total number of physical extents number
pv_pe_alloc_count Total number of allocated physical extents number
pv_tags Tags, if any string list
pv_mda_count Number of metadata areas on this device number
pv_mda_used_count Number of metadata areas in use on this device number
pv_ba_start Offset to the start of PV Bootloader Area on the underlying device in current units size
pv_ba_size Size of PV Bootloader Area in current units size
表C.11「Volume Group Fields」 describes the volume group fields and their field types.
Expand
表C.11 Volume Group Fields
Volume Group FieldDescriptionField Type
vg_fmt Type of metadata string
vg_uuid Unique identifier string
vg_name Name string
vg_attr Various attributes string
vg_permissions Volume group permissions string
vg_extendable Set if volume group is extendable number
vg_exported Set if volume group is exported number
vg_partial Set if volume group is partial number
vg_allocation_policy Volume group allocation policy string
vg_clustered Set if volume group is clustered number
vg_size Total size of volume group in current units size
vg_free Total amount of free space in current units size
vg_sysid System ID of the volume group indicating which host owns it string
vg_systemid System ID of the volume group indicating which host owns it string
vg_extent_size Size of physical extents in current units size
vg_extent_count Total number of physical extents number
vg_free_count Total number of unallocated physical extents number
max_lv Maximum number of logical volumes allowed in volume group or 0 if unlimited number
max_pv Maximum number of physical volumes allowed in volume group or 0 if unlimited number
pv_count Number of physical volumes number
lv_count Number of logical volumes number
snap_count Number of snapshots number
vg_seqno Revision number of internal metadata — incremented whenever it changes number
vg_tags Tags, if any string list
vg_profile Configuration profile attached to this volume group string
vg_mda_count Number of metadata areas on this volume group number
vg_mda_used_count Number of metadata areas in use on this volume group number
vg_mda_free Free metadata area space for this volume group in current units size
vg_mda_size Size of smallest metadata area for this volume group in current units size
vg_mda_copies Target number of in use metadata areas in the volume group number
表C.12「Logical Volume Segment Fields」 describes the logical volume segment fields and their field types.
Expand
表C.12 Logical Volume Segment Fields
Logical Volume Segment FieldDescriptionField Type
segtype Type of logical volume segment string
stripes Number of stripes or mirror legs number
stripesize For stripes, amount of data placed on one device before switching to the next size
stripe_size For stripes, amount of data placed on one device before switching to the next size
regionsize For mirrors, the unit of data copied when synchronizing devices size
region_size For mirrors, the unit of data copied when synchronizing devices size
chunksize For snapshots, the unit of data used when tracking changes size
chunk_size For snapshots, the unit of data used when tracking changes size
thin_count For thin pools, the number of thin volumes in this pool number
discards For thin pools, how discards are handled string
cachemode For cache pools, how writes are cached string
zero For thin pools, if zeroing is enabled number
transaction_id For thin pools, the transaction id number
thin_id For thin volumes, the thin device id number
seg_start Offset within the logical volume to the start of the segment in current units size
seg_start_pe Offset within the logical volume to the start of the segment in physical extents. number
seg_size Size of segment in current units size
seg_size_pe Size of segment in physical extents size
seg_tags Tags, if any string list
seg_pe_ranges Ranges of physical extents of underlying devices in command line format string
devices Underlying devices used with starting extent numbers string
seg_monitor dmeventd monitoring status of the segment string
cache_policy The cache policy (cached segments only) string
cache_settings Cache settings/parameters (cached segments only) string list
表C.13「Pysical Volume Segment Fields」 describes the physical volume segment fields and their field types.
Expand
表C.13 Pysical Volume Segment Fields
Physical Volume Segment FieldDescriptionField Type
pvseg_start Physical extent number of start of segment number
pvseg_size Number of extents in segment number
表C.14「Selection Criteria Synonyms」 lists the synonyms you can use for field values. These synonyms can be used in selection criteria as well as for values just like their original values. In this table, a field value of "" indicates a blank string, which can be matched by specifying -S 'field_name=""'.
In this table, a field indicated by 0 or 1 indicates a binary value. You can specify a --binary option for reporting tools which causes binary fields to display 0 or 1 instead of what is indicated in this table as "some text" or "".
Expand
表C.14 Selection Criteria Synonyms
FieldField ValueSynonyms
pv_allocatable allocatable 1
pv_allocatable "" 0
pv_exported exported 1
pv_exported "" 0
pv_missing missing 1
pv_missing "" 0
vg_extendable extendable 1
vg_extendable "" 0
vg_exported exported 1
vg_exported "" 0
vg_partial partial 1
vg_partial "" 0
vg_clustered clustered 1
vg_clustered "" 0
vg_permissions writeable rw, read-write
vg_permissions read-only r, ro
vg_mda_copies unmanaged unknown, undefined, undef, -1
lv_initial_image_sync initial image sync sync, 1
lv_initial_image_sync "" 0
lv_image_synced image synced synced, 1
lv_image_synce "" 0
lv_merging merging 1
lv_merging "" 0
lv_converting converting 1
lv_converting "" 0
lv_allocation_locked allocation locked locked, 1
lv_allocation_locked "" 0
lv_fixed_minor fixed minor fixed, 1
lv_fixed_minor "" 0
lv_active_locally active locally active, locally, 1
lv_active_locally "" 0
lv_active_remotely active remotely active, remotely, 1
lv_active_remotely "" 0
lv_active_exclusively active exclusively active, exclusively, 1
lv_active_exclusively "" 0
lv_merge_failed merge failed failed, 1
lv_merge_failed "" 0
lv_snapshot_invalid snapshot invalid invalid, 1
lv_snapshot_invalid "" 0
lv_suspended suspended 1
lv_suspended "" 0
lv_live_table live table present live table, live, 1
lv_live_table "" 0
lv_inactive_table inactive table present inactive table, inactive, 1
lv_inactive_table "" 0
lv_device_open open 1
lv_device_open "" 0
lv_skip_activation skip activation skip, 1
lv_skip_activation "" 0
zero zero 1
zero "" 0
lv_permissions writeable rw, read-write
lv_permissions read-only r, ro
lv_permissions read-only-override ro-override, r-override, R
lv_when_full error error when full, error if no space
lv_when_full queue queue when full, queue if no space
lv_when_full "" undefined
cache_policy "" undefined
seg_monitor "" undefined
lv_health_status "" undefined

C.3.1. Specifying Time Values

When specifying time values for LVM selection, you can use either a standardized time specification format or a more free-form specification, as described in 「Standard time selection format」 and 「Freeform time selection format」.
You can specify the way time values are displayed with the report/time format configuration option in the /etc/lvm/lvm.conf configuration file. Information on specifying this option is provided in the lvm.conf file.
When specifying time values, you can use the comparison operator aliases since, after, until, and before, as described in 表C.3「Selection Criteria Comparison Operators」.
C.3.1.1. Standard time selection format
You can specify time values for LVM selection in the following format.
date time timezone
Copy to Clipboard Toggle word wrap
表C.15「Time Specification Formats」 summarizes the formats you can use when specifying these time values.
Expand
表C.15 Time Specification Formats
FieldField Value
date
YYYY-MM-DD
YYYY-MM, auto DD=1
YYYY, auto MM=01 and DD=01
time
hh:mm:ss
hh:mm, auto ss=0
hh, auto mm=0, auto ss=0
timezone (always with + or - sign)
+hh:mm or -hh:mm
+hh or -hh
The full date/time specification is YYYY-MM-DD hh:mm:ss. Users are able to leave date/time parts from right to left. Whenever these parts are left out, a range is assumed automatically with second granularity. For example:
  • "2015-07-07 9:51" means range of "2015-07-07 9:51:00" - "2015-07-07 9:51:59"
  • "2015-07" means range of "2015-07-01 0:00:00" - "2015-07-31 23:59:59"
  • "2015" means range of "2015-01-01 0:00:00" - "2015-12-31 23:59:59"
The following examples show the date/time specification as used in selection criteria.
lvs -S 'time since "2015-07-07 9:51"'
lvs -S 'time = "2015-07""
lvs -S 'time = "2015"'
Copy to Clipboard Toggle word wrap
C.3.1.2. Freeform time selection format
You can specify the date/time specification in LVM selection criteria using the following entitles.
  • weekday names ("Sunday" - "Saturday" or abbreviated as "Sun" - "Sat")
  • labels for points in time ("noon", "midnight")
  • labels for a day relative to current day ("today", "yesterday")
  • points back in time with relative offset from today (N is a number)
  • ( "N" "seconds"/"minutes"/"hours"/"days"/"weeks"/"years" "ago")
  • ( "N" "secs"/"mins"/"hrs" ... "ago")
  • ( "N" "s"/"m"/"h" ... "ago")
  • time specification either in hh:mm:ss format or with AM/PM suffixes
  • month names ("January" - "December" or abbreviated as "Jan" - "Dec")
The following examples the show the freeform date/time specificaiton as used in selection criteria.
lvs -S 'time since "yesterday 9AM"'
lvs -S 'time since "Feb 3 years 2 months ago"'
lvs -S 'time = "February 2015"'
lvs -S 'time since "Jan 15 2015" &&  time until yesterday'
lvs -S 'time since "today 6AM"'
Copy to Clipboard Toggle word wrap

C.4. Selection Criteria Display Examples

This section provides a series of examples showing how to use selection criteria for LVM display commands. The examples in this section use a system configured with LVM volumes that yield the following output when selection criteria are not used.
# lvs -a -o+layout,role
  LV              VG Attr       LSize   Pool Origin Data%  Meta%  Layout      Role
  root            f1 -wi-ao----   9.01g                           linear      public
  swap            f1 -wi-ao---- 512.00m                           linear      public
  [lvol0_pmspare] vg ewi-------   4.00m                           linear      private,   \
                                                                              pool,spare
  lvol1           vg Vwi-a-tz--   1.00g pool        0.00          thin,sparse public
  lvol2           vg Vwi-a-tz--   1.00g pool        0.00          thin,sparse public,    \
                                                                              origin,    \
                                                                              thinorigin
  lvol3           vg Vwi---tz-k   1.00g pool lvol2                thin,sparse public,    \
                                                                              snapshot,  \
                                                                              thinsnapshot
  pool            vg twi-aotz-- 100.00m             0.00   1.07   thin,pool   private
  [pool_tdata]    vg Twi-ao---- 100.00m                           linear      private,   \
                                                                              thin,pool, \
                                                                              data
  [pool_tmeta]    vg ewi-ao----   4.00m                           linear      private,   \
                                                                              thin,pool, \
                                                                              metadata
Copy to Clipboard Toggle word wrap
The following command displays all logical volumes with "lvol[13]" in their name, using a regular expression to specify this.
# lvs -a -o+layout,role -S 'lv_name=~lvol[13]'
  LV    VG   Attr       LSize Pool Origin Data%  Layout      Role                        
  lvol1 vg   Vwi-a-tz-- 1.00g pool        0.00   thin,sparse public                      
  lvol3 vg   Vwi---tz-k 1.00g pool lvol2         thin,sparse public,snapshot,thinsnapshot
Copy to Clipboard Toggle word wrap
The following command displays all logical volumes greater than 500m in size.
# lvs -a -o+layout,role -S 'lv_size>500m'
  LV    VG Attr       LSize   Pool Origin Data%  Layout      Role                        
  root  f1 -wi-ao----   9.01g                    linear      public                      
  swap  f1 -wi-ao---- 512.00m                    linear      public                      
  lvol1 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public                      
  lvol2 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public,origin,thinorigin    
  lvol3 vg Vwi---tz-k   1.00g pool lvol2         thin,sparse public,snapshot,           \
                                                             thinsnapshot
Copy to Clipboard Toggle word wrap
The following command displays all logical volumes that include thin as a logical volume role, indicating that the logical volume is used in constructing a thin pool. This example uses braces ({}) to indicate a subset in the display.
# lvs -a -o+layout,role -S 'lv_role={thin}'
  LV           VG   Attr       LSize   Layout     Role                      
  [pool_tdata] vg   Twi-ao---- 100.00m linear     private,thin,pool,data    
  [pool_tmeta] vg   ewi-ao----   4.00m linear     private,thin,pool,metadata
Copy to Clipboard Toggle word wrap
The following command displays all usable top-level logical volumes, which are the logical volumes with a role of "public". If you do not specify braces ({}) in a string list to indicate a subset, it is assumed by default; specifying lv_role=public is equivalent to specifying lv_role={public}.
# lvs -a -o+layout,role -S 'lv_role=public' 
  LV    VG Attr       LSize   Pool Origin Data%  Layout      Role                        
  root  f1 -wi-ao----   9.01g                    linear      public                      
  swap  f1 -wi-ao---- 512.00m                    linear      public                      
  lvol1 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public                      
  lvol2 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public,origin,thinorigin 
  lvol3 vg Vwi---tz-k   1.00g pool lvol2         thin,sparse public,snapshot,thinsnapshot
Copy to Clipboard Toggle word wrap
The following command displays all logical volumes with a thin layout.
# lvs -a -o+layout,role -S 'lv_layout={thin}'
  LV    VG Attr       LSize   Pool Origin Data% Meta% Layout      Role 
  lvol1 vg Vwi-a-tz--   1.00g pool        0.00        thin,sparse public 
  lvol2 vg Vwi-a-tz--   1.00g pool        0.00        thin,sparse public,origin,          \
                                                                  thinorigin    
  lvol3 vg Vwi---tz-k   1.00g pool lvol2              thin,sparse public,snapshot,        \
                                                                  thinsnapshot
  pool  vg twi-aotz-- 100.00m             0.00  1.07  thin,pool   private
Copy to Clipboard Toggle word wrap
The following command displays all logical volumes with a layout field that matches "sparse,thin" exactly. Note that it is not necessary to specify the string list members for the match to be positive.
# lvs -a -o+layout,role -S 'lv_layout=[sparse,thin]'
  LV    VG   Attr       LSize Pool Origin Data%  Layout      Role                        
  lvol1 vg   Vwi-a-tz-- 1.00g pool        0.00   thin,sparse public                      
  lvol2 vg   Vwi-a-tz-- 1.00g pool        0.00   thin,sparse public,origin,thinorigin    
  lvol3 vg   Vwi---tz-k 1.00g pool lvol2         thin,sparse public,snapshot,thinsnapshot
Copy to Clipboard Toggle word wrap
The following command displays the logical volume names of the logical volumes that are thin, sparse logical volumes. Note that the list of fields used for selection criteria do not need to be the same as the list of fields to display.
# lvs -a -o lv_name -S 'lv_layout=[sparse,thin]'
  LV   
  lvol1
  lvol2
  lvol3
Copy to Clipboard Toggle word wrap

C.5. Selection Criteria Processing Examples

This section provides a series of examples showing how to use selection criteria in commands that process LVM logical volumes.
This example shows the initial configuration of a group of logical volumes, including thin snapshots. Thin snapshots have the "skip activation" flag set by default. This example also includes the logical volume lvol4 which also has the "skip activation" flag set.
# lvs -o name,skip_activation,layout,role
  LV    SkipAct         Layout      Role                        
  root                  linear      public                      
  swap                  linear      public                      
  lvol1                 thin,sparse public                      
  lvol2                 thin,sparse public,origin,thinorigin    
  lvol3 skip activation thin,sparse public,snapshot,thinsnapshot
  lvol4 skip activation linear      public                      
  pool                  thin,pool   private
Copy to Clipboard Toggle word wrap
The following command removes the skip activation flag from all logical volmes that are thin snapshots.
# lvchange --setactivationskip n -S 'role=thinsnapshot'
  Logical volume "lvol3" changed.
Copy to Clipboard Toggle word wrap
The following command shows the configuration of the logical volumes after executing the lvchange command. Note that the "skip activation" flag has not been unset from the logical volume that is not a thin snapshot.
# lvs -o name,active,skip_activation,layout,role
  LV    Active SkipAct         Layout      Role                        
  root  active                 linear      public                      
  swap  active                 linear      public                      
  lvol1 active                 thin,sparse public                      
  lvol2 active                 thin,sparse public,origin,thinorigin    
  lvol3                        thin,sparse public,snapshot,thinsnapshot
  lvol4 active skip activation linear      public                      
  pool  active                 thin,pool   private
Copy to Clipboard Toggle word wrap
The following command shows the configuration of the logical volumes after an additional thin origin/snapshot volume has been created.
# lvs -o name,active,skip_activation,origin,layout,role
  LV    Active SkipAct         Origin Layout      Role                        
  root  active                        linear      public                      
  swap  active                        linear      public                      
  lvol1 active                        thin,sparse public                      
  lvol2 active                        thin,sparse public,origin,thinorigin    
  lvol3                        lvol2  thin,sparse public,snapshot,thinsnapshot
  lvol4 active skip activation        linear      public                      
  lvol5 active                        thin,sparse public,origin,thinorigin    
  lvol6                        lvol5  thin,sparse public,snapshot,thinsnapshot
  pool  active                        thin,pool   private
Copy to Clipboard Toggle word wrap
The following command activates logical volumes that are both thin snapshot volumes and have an origin volume of lvol2.
# lvchange -ay -S 'lv_role=thinsnapshot && origin=lvol2'

# lvs -o name,active,skip_activation,origin,layout,role
  LV    Active SkipAct         Origin Layout      Role                        
  root  active                        linear      public                      
  swap  active                        linear      public                      
  lvol1 active                        thin,sparse public                      
  lvol2 active                        thin,sparse public,origin,thinorigin    
  lvol3 active                 lvol2  thin,sparse public,snapshot,thinsnapshot
  lvol4 active skip activation        linear      public                      
  lvol5 active                        thin,sparse public,origin,thinorigin    
  lvol6                        lvol5  thin,sparse public,snapshot,thinsnapshot
  pool  active                        thin,pool   private
Copy to Clipboard Toggle word wrap
If you execute a command on a whole item while specifying selection criteria that match an item from that whole, the entire whole item is processed. For example, if you change a volume group while selecting one or more items from that volume group, the whole volume group is selected. This example selects logical volume lvol1, which is part of volume group vg. All of the logical volumes in volume group vg are processed.
# lvs -o name,vg_name
  LV    VG    
  root  fedora
  swap  fedora
  lvol1 vg    
  lvol2 vg    
  lvol3 vg    
  lvol4 vg    
  lvol5 vg    
  lvol6 vg    
  pool  vg 

# vgchange -ay -S 'lv_name=lvol1'
  7 logical volume(s) in volume group "vg" now active
Copy to Clipboard Toggle word wrap
The following example shows a more complex selection criteria statement. In this example, all logical volumes are tagged with "mytag" if they have a role of origin and are also named lvol[456] or the logical volume size is more than 5g.
# lvchange --addtag mytag -S '(role=origin && lv_name=~lvol[456]) || lv_size > 5g'
  Logical volume "root" changed.
  Logical volume "lvol5" changed.
Copy to Clipboard Toggle word wrap

付録D LVM オブジェクトタグ

An LVM tag is a word that can be used to group LVM2 objects of the same type together. Tags can be attached to objects such as physical volumes, volume groups, and logical volumes. Tags can be attached to hosts in a cluster configuration.
タグは、コマンドラインで引数 PV、VG、または LV の代わりに表示することができます。混乱を防ぐために、タグには @ を前に付ける必要があります。各タグは、コマンドライン上の位置から想定されるタイプの、そのタグを処理するすべてのオブジェクトに置き換えることによって拡張されます。
Red Hat Enterprise Linux 6.1 リリースでは、LVM タグは、最長 1024 文字の文字列です (旧リリースでは、文字数制限は 128 文字でした)。LVM タグの先頭にハイフンを使用することはできません。
有効なタグには、限定された範囲の文字のみで構成されます。Red Hat Enterprise Linux 6.0 リリースで使用可能な文字は、 [A-Za-z0-9_+.-] です。Red Hat Enterprise Linux 6.1 リリースでは、使用可能な文字の一覧が拡大され、タグには "/"、"="、"!"、":"、"#"、および "&" の文字が使用できるようになりました。
Only objects in a volume group can be tagged. Physical volumes lose their tags if they are removed from a volume group; this is because tags are stored as part of the volume group metadata and that is deleted when a physical volume is removed.
以下のコマンドは、database タグを持つすべての論理ボリュームを一覧表示します。
lvs @database
Copy to Clipboard Toggle word wrap
The following command lists the currently active host tags.
lvm tags
Copy to Clipboard Toggle word wrap

D.1. オブジェクトタグの追加と削除

物理ボリュームにタグを追加したり、そこからタグを削除したりするには、pvchange コマンドで --addtag オプションや --deltag オプションを使用します。
ボリュームグループにタグを追加したり、そこからタグを削除するには、vgchange か、vgcreate コマンドで --addtag や、--deltag オプションを使用します。
論理ボリュームにタグを追加したり、そこからタグを削除するには、lvchange か、lvcreate コマンドで --addtag--deltag オプションを使用します。
Red Hat Enterprise Linux 6.1 リリースでは、pvchangevgchange、またはlvchange の単一のコマンドで、--addtag および --deltag の引数を複数指定することができます。例えば、以下のコマンドでは、タグ T9T10 が削除され、the タグ T13T14 がボリュームグループ grant に追加されます。
vgchange --deltag T9 --deltag T10 --addtag T13 --addtag T14 grant
Copy to Clipboard Toggle word wrap

D.2. ホストタグ

In a cluster configuration, you can define host tags in the configuration files. If you set hosttags = 1 in the tags section, a host tag is automatically defined using the machine's host name. This allow you to use a common configuration file which can be replicated on all your machines so they hold identical copies of the file, but the behavior can differ between machines according to the host name.
設定ファイルに関する情報は、付録B LVM 設定ファイルをご覧ください。
各ホストタグには、存在する場合は余分の設定ファイルが読み込まれます (lvm_hosttag.conf)。このファイルが新規タグを定義する場合、更なる設定ファイルが読み取りのためにファイルの一覧に追記されます。
For example, the following entry in the configuration file always defines tag1, and defines tag2 if the host name is host1.
tags { tag1 { }  tag2 { host_list = ["host1"] } }
Copy to Clipboard Toggle word wrap

D.3. タグを使用したアクティブ化の制御

特定の論理ボリュームのみがホスト上でアクティブ化されるように設定ファイルで指定することができます。例えば、以下のエントリはアクティベーション要求 (vgchange -ay など) のフィルタとして動作して、vg1/lvol0 とホスト上のメタデータ内に database タグを持ついずれかの論理ボリューム、またはボリュームグループのみをアクティブ化します。
activation { volume_list = ["vg1/lvol0", "@database" ] }
Copy to Clipboard Toggle word wrap
いずれかのメタデータタグがマシンのホストタグのいずれかに一致する場合のみに一致する要因となる特別一致記号 "@*" が存在します。
もう一つの例として、クラスター内の各マシンの設定ファイルに以下のエントリがあるような状況を考えてみます。
tags { hosttags = 1 }
Copy to Clipboard Toggle word wrap
ホスト db2 上のみで vg1/lvol2 をアクティブ化したい場合は、以下のようにします:
  1. クラスター内のいずれかのホストから lvchange --addtag @db2 vg1/lvol2 を実行します。
  2. lvchange -ay vg1/lvol2 を実行します。
この解決法では、ボリュームグループメタデータの中にホスト名を保存する必要があります。

付録E LVM ボリュームグループメタデータ

ボリュームグループの設定詳細は、メタデータと呼ばれます。デフォルトでは、メタデータの同一のコピーは、ボリュームグループ内のすべての物理ボリュームのすべてのメタデータ領域で管理されます。LVM ボリュームグループメタデータは ASCII として保存されます。
ボリュームグループが多くの物理ボリュームを含む場合、それだけ多くのメタデータの冗長コピーを持つことは効率的ではありません。メタデータのコピー無しで物理ボリュームを作成するには、pvcreate コマンドで --metadatacopies 0 オプションを使用することで達成できます。物理ボリュームが含むべきメタデータコピーの数を一旦選択すると、後で変更はできません。0 コピーを選択すると、設定変更での更新が 迅速になります。しかし、注意することは、すべてのボリュームグループは常時、メタデータエリア1つを持つ物理ボリュームを最低1つ含む必要があることです (高度な設定を使用してボリュームグループメタデータをファイルシステム内に保存できる場合を除く)。将来、ボリュームグループを分割する予定がある場合は、それぞれのボリュームグループに、最低1つのメタデータが必要となります。
核となるメタデータは ASCII 形式で保存されます。メタデータ領域は循環バッファです。新規のメタデータは古いメタデータに追記され、その開始点へのポインターが更新されます。
メタデータ領域のサイズは、pvcreate コマンドで --metadatasize オプションを使用して指定することができます。デフォルトのサイズは、数百の物理ボリュームや論理ボリュームを持つボリュームグループには小さすぎる場合があります。

E.1. 物理ボリュームラベル

デフォルトでは、pvcreate コマンドは 物理ボリュームラベルを 2 番めの 512-byte セクターに配置します。物理ボリュームラベルをスキャンする LVM ツールが 最初の 4 つのセクターをチェックするため、このラベルはオプションとしてその 4 つのセクターのいずれかに配置することができます。物理ボリュームラベルは文字列 LABELONE で始まります。
物理ボリュームラベルに含まれる内容:
  • 物理ボリューム UUID
  • ブロックデバイスの容量 (バイト)
  • データエリアロケーションの NULL-終了一覧
  • メタデータエリアロケーションの NULL-終了一覧
メタデータロケーションはオフセットおよびサイズ (バイト) として保存されます。ラベルには、15 ロケーション用のスペースがありますが、LVM ツールは現在3つしか使いません:1つのデータエリアと最大で2つのメタデータエリアです。

E.2. メタデータの内容

ボリュームグループメタデータに含まれる内容:
  • それが作成された手段と時期の情報
  • ボリュームグループに関する情報
ボリュームグループ情報に含まれる内容:
  • 名前と一意識別子
  • メタデータが更新される度に増加するバージョン番号
  • プロパティ: 読み取り/書き込み? サイズ変更可能?
  • 含まれる物理ボリュームと論理ボリュームの数に対する管理制限
  • エクステントのサイズ (512 byte として定義されるセクターのユニットで表示)
  • ボリュームグループを構成する物理ボリュームの順序なし一覧。それぞれ以下を含みます:
    • UUID: 物理ボリュームを格納するブロックデバイスの確認に使用
    • プロパティ: 物理ボリュームの割り当て可能性など
    • 物理ボリューム内の一番目のエクステントの開始点までのオフセット (セクターで表示)
    • エクステントの数
  • 論理ボリュームの順序なし一覧。それぞれ以下の要素で構成されています。
    • 論理ボリュームセグメントの順序付き一覧。各セグメントに対して、物理ボリュームセグメントまたは論理ボリュームセグメントの順序付き一覧に適用されるマッピングがメタデータに含まれます。

E.3. サンプルのメタデータ

myvg と呼ばれるボリュームグループ用の LVM ボリュームグループメタデータの例を以下に示します。
# Generated by LVM2: Tue Jan 30 16:28:15 2007

contents = "Text Format Volume Group"
version = 1

description = "Created *before* executing 'lvextend -L+5G /dev/myvg/mylv /dev/sdc'"

creation_host = "tng3-1"        # Linux tng3-1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686
creation_time = 1170196095      # Tue Jan 30 16:28:15 2007

myvg {
        id = "0zd3UT-wbYT-lDHq-lMPs-EjoE-0o18-wL28X4"
        seqno = 3
        status = ["RESIZEABLE", "READ", "WRITE"]
        extent_size = 8192              # 4 Megabytes
        max_lv = 0
        max_pv = 0

        physical_volumes {

                pv0 {
                        id = "ZBW5qW-dXF2-0bGw-ZCad-2RlV-phwu-1c1RFt"
                        device = "/dev/sda"     # Hint only

                        status = ["ALLOCATABLE"]
                        dev_size = 35964301     # 17.1491 Gigabytes
                        pe_start = 384
                        pe_count = 4390 # 17.1484 Gigabytes
                }

                pv1 {
                        id = "ZHEZJW-MR64-D3QM-Rv7V-Hxsa-zU24-wztY19"
                        device = "/dev/sdb"     # Hint only

                        status = ["ALLOCATABLE"]
                        dev_size = 35964301     # 17.1491 Gigabytes
                        pe_start = 384
                        pe_count = 4390 # 17.1484 Gigabytes
                }

                pv2 {
                        id = "wCoG4p-55Ui-9tbp-VTEA-jO6s-RAVx-UREW0G"
                        device = "/dev/sdc"     # Hint only

                        status = ["ALLOCATABLE"]
                        dev_size = 35964301     # 17.1491 Gigabytes
                        pe_start = 384
                        pe_count = 4390 # 17.1484 Gigabytes
                }

                pv3 {
                        id = "hGlUwi-zsBg-39FF-do88-pHxY-8XA2-9WKIiA"
                        device = "/dev/sdd"     # Hint only

                        status = ["ALLOCATABLE"]
                        dev_size = 35964301     # 17.1491 Gigabytes
                        pe_start = 384
                        pe_count = 4390 # 17.1484 Gigabytes
                }
        }
        logical_volumes {

                mylv {
                        id = "GhUYSF-qVM3-rzQo-a6D2-o0aV-LQet-Ur9OF9"
                        status = ["READ", "WRITE", "VISIBLE"]
                        segment_count = 2

                        segment1 {
                                start_extent = 0
                                extent_count = 1280     # 5 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv0", 0
                                ]
                        }
                        segment2 {
                                start_extent = 1280
                                extent_count = 1280     # 5 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv1", 0
                                ]
                        }
                }
        }
}

Copy to Clipboard Toggle word wrap

付録F 改訂履歴

改訂履歴
改訂 10.0-3Wed Mar 8 2017Steven Levine
Version for 6.9 GA Publication
改訂 10.0-1Fri Dec 16 2016Steven Levine
Version for 6.9 Beta Publication
改訂 9.0-5Tue Nov 29 2016Steven Levine
Updating document for 6.8.
改訂 9.0-4Wed Apr 27 2016Steven Levine
Preparing document for 6.8 GA publication.
改訂 9.0-3Wed Mar 9 2016Steven Levine
Initial revision for Red Hat Enterprise Linux 6.8 Beta release
改訂 8.0-16Mon Jul 13 2015Steven Levine
Republish version for Red Hat Enterprise Linux 6.7
改訂 8.0-14Wed Jul 8 2015Steven Levine
Initial revision for Red Hat Enterprise Linux 6.7
改訂 8.0-13Tue Apr 14 2015Steven Levine
Initial revision for Red Hat Enterprise Linux 6.7 Beta release
改訂 7.0-9Wed Oct 8 2014Steven Levine
Initial revision for Red Hat Enterprise Linux 6.6
改訂 7.0-8Thu Aug 7 2014Steven Levine
Initial revision for Red Hat Enterprise Linux 6.6 Beta release
改訂 6.0-14Wed Nov 13 2013Steven Levine
Initial revision for Red Hat Enterprise Linux 6.5
改訂 6.0-10Fri Sep 27 2013Steven Levine
Initial revision for Red Hat Enterprise Linux 6.5 Beta release
改訂 5.0-19Mon Feb 18 2013John Ha
Initial revision for Red Hat Enterprise Linux 6.4
改訂 5.0-12Mon Nov 27 2012Steven Levine
Initial revision for Red Hat Enterprise Linux 6.4 Beta release
改訂 4.0-2Fri Jun 15 2012Steven Levine
Initial revision for Red Hat Enterprise Linux 6.3
改訂 3.0-1Mon Sep 19 2011Steven Levine
Red Hat Enterprise Linux 6.2 Beta リリースに向けた初回改訂
改訂 2.0-1Thu May 19 2011Steven Levine
Initial revision for Red Hat Enterprise Linux 6.1
改訂 1.0-1Wed Nov 10 2010Steven Levine
Red Hat Enterprise Linux 6 の初期リリース

索引

シンボル

/lib/udev/rules.d ディレクトリ, udev のデバイスマッパーとの統合
アーカイブファイル, 論理ボリュームのバックアップ
エクステント
割り当て, ボリュームグループの作成, LVM の割り当て
定義, ボリュームグループ, ボリュームグループの作成
オンラインでのデータの再配置, オンラインデータ移動
キャッシュファイル
構築, キャッシュファイル構築のためのボリュームグループのディスクスキャン
クラスター環境, クラスター化論理ボリュームマネージャ (CLVM), クラスター内での LVM ボリューム作成
コマンドラインユニット, CLI コマンドの使用
サイズ変更
物理ボリューム, 物理ボリュームのサイズ変更
シンプロビジョニングされたスナップショットボリューム, シンプロビジョニングされたスナップショットボリューム
シンプロビジョニングされたスナップショット論理ボリューム
作成, シンプロビジョニングされたスナップショットボリュームの作成
シンプロビジョニングされた論理ボリューム, シンプロビジョニングされた論理ボリューム (シンボリューム)
作成, シンプロビジョニングされた論理ボリュームの作成
スキャン
ブロックデバイス, ブロックデバイスのスキャン
ストライプ化論理ボリューム
作成, ストライプ化ボリュームの作成
作成例, ストライプ化論理ボリュームの作成
定義, ストライプ化論理ボリューム
拡張, ストライプ化ボリュームの拡張
スナップショットボリューム
定義, スナップショットボリューム
スナップショット論理ボリューム
作成, スナップショットボリュームの作成
デバイスのスキャン、フィルター, フィルターを使用した LVM デバイススキャンの制御
デバイスサイズ、最大, ボリュームグループの作成
デバイススキャンフィルター, フィルターを使用した LVM デバイススキャンの制御
デバイスパス名, CLI コマンドの使用
デバイス特有のファイルがあるディレクトリ, ボリュームグループの作成
デバイス番号
マイナー, 永続的なデバイス番号
メジャー, 永続的なデバイス番号
永続的, 永続的なデバイス番号
データの再配置、オンライン, オンラインデータ移動
トラブルシューティング, LVM トラブルシューティング
バックアップ
ファイル, 論理ボリュームのバックアップ
メタデータ, 論理ボリュームのバックアップ, ボリュームグループメタデータのバックアップ
パス名, CLI コマンドの使用
パーティション
複数, ディスク上の複数パーティション
パーティションタイプ、設定, パーティションタイプの設定
ファイルシステム
論理ボリューム上における拡張, 論理ボリューム上におけるファイルシステムの拡張
ファイルシステムの拡張
論理ボリューム, 論理ボリューム上におけるファイルシステムの拡張
フィルター, フィルターを使用した LVM デバイススキャンの制御
フィードバック
本マニュアルに関する連絡先情報, フィードバック
ブロックデバイス
スキャン, ブロックデバイスのスキャン
ヘルプの表示, CLI コマンドの使用
ボリュームグループ
vgs 引数の表示, vgs コマンド
アクティブ化, ボリュームグループのアクティブ化と非アクティブ化
クラスター内での作成, クラスター内でのボリュームグループ作成
システム間での移動, ボリュームグループの別のシステムへの移動
パラーメーターの変更, ボリュームグループのパラメーター変更
マージ, ボリュームグループの統合
分割, ボリュームグループの分割
手順の例, ボリュームグループの分割
削除, ボリュームグループの削除
名前変更, ボリュームグループの名前変更
定義, ボリュームグループ
拡張, ボリュームグループへの物理ボリュームの追加
管理、一般, ボリュームグループ管理
結合, ボリュームグループの統合
縮小, ボリュームグループからの物理ボリュームの削除
表示, ボリュームグループの表示 , LVM 用のカスタム報告, vgs コマンド
非アクティブ化, ボリュームグループのアクティブ化と非アクティブ化
ボリュームグループのアクティブ化, ボリュームグループのアクティブ化と非アクティブ化
ローカルノードのみ, ボリュームグループのアクティブ化と非アクティブ化
個別のノード, ボリュームグループのアクティブ化と非アクティブ化
ボリュームグループの非アクティブ化, ボリュームグループのアクティブ化と非アクティブ化
ローカルノードのみ, ボリュームグループのアクティブ化と非アクティブ化
単一ノード上で排他的, ボリュームグループのアクティブ化と非アクティブ化
ミラー化論理ボリューム
クラスター化された, クラスター内でのミラー化 LVM 論理ボリュームの作成
リニアへの変換, ミラー化ボリューム設定の変更
作成, ミラー化ボリュームの作成
再設定, ミラー化ボリューム設定の変更
定義, ミラー化論理ボリューム
拡張, ミラー化ボリュームの拡張
障害ポリシー, ミラー化論理ボリュームの障害ポリシー
障害回復, LVM ミラー障害からの回復
メタデータ
バックアップ, 論理ボリュームのバックアップ, ボリュームグループメタデータのバックアップ
回復, 物理ボリュームメタデータの復元
メタデータデーモン, メタデータデーモン (lvmetad)
ユニット、コマンドライン, CLI コマンドの使用
リニア論理ボリューム
ミラー化への変換, ミラー化ボリューム設定の変更
作成, リニア論理ボリュームの作成
定義, リニアボリューム
レポートのフォーマット、LVM デバイス, LVM 用のカスタム報告
ロギング, ロギング
不十分な空きエクステントメッセージ, 論理ボリュームでの不十分な空きエクステント
作成
クラスター内でのLVM ボリューム, クラスター内での LVM ボリューム作成
ストライプ化論理ボリューム、例, ストライプ化論理ボリュームの作成
ボリュームグループ、クラスター化, クラスター内でのボリュームグループ作成
物理ボリューム, 物理ボリュームの作成
論理ボリューム, リニア論理ボリュームの作成
論理ボリューム、例, 3つのディスク上での LVM 論理ボリューム作成
初期化
パーティション, 物理ボリュームの初期化
物理ボリューム, 物理ボリュームの初期化
削除
物理ボリューム, 物理ボリュームの削除
論理ボリューム, 論理ボリュームの削除
論理ボリュームからディスクを, 論理ボリュームからのディスクの削除
割り当て, LVM の割り当て
ポリシー, ボリュームグループの作成
防止, 物理ボリューム上での割り当て防止
名前変更
ボリュームグループ, ボリュームグループの名前変更
論理ボリューム, 論理ボリュームの名前変更
新機能および変更された機能, 新機能および変更された機能
概要
新機能および変更された機能, 新機能および変更された機能
永続的なデバイス番号, 永続的なデバイス番号
物理エクステント
割り当ての防止, 物理ボリューム上での割り当て防止
物理ボリューム
pvs 引数の表示, pvs コマンド
サイズ変更, 物理ボリュームのサイズ変更
ボリュームグループから削除, ボリュームグループからの物理ボリュームの削除
ボリュームグループに追加, ボリュームグループへの物理ボリュームの追加
レイアウト, LVM 物理ボリュームレイアウト
作成, 物理ボリュームの作成
初期化, 物理ボリュームの初期化
削除, 物理ボリュームの削除
回復, 紛失した物理ボリュームの入れ替え
図, LVM 物理ボリュームレイアウト
定義, 物理ボリューム
管理、一般, 物理ボリュームの管理
紛失したボリュームの削除, 紛失した物理ボリュームのボリュームグループからの削除
表示, 物理ボリュームの表示, LVM 用のカスタム報告, pvs コマンド
管理の手順, LVM 管理の概要
表示
ボリュームグループ, ボリュームグループの表示 , vgs コマンド
出力のソート, LVM 報告のソート
物理ボリューム, 物理ボリュームの表示, pvs コマンド
論理ボリューム, 論理ボリュームの表示, lvs コマンド
設定の例, LVM 設定の例
詳細出力, CLI コマンドの使用
論理ボリューム
lvs 引数の表示, lvs コマンド
シンプロビジョニング, シンプロビジョニングされた論理ボリュームの作成
シンプロビジョニングされたスナップショット, シンプロビジョニングされたスナップショットボリュームの作成
ストライプ化, ストライプ化ボリュームの作成
スナップショット, スナップショットボリュームの作成
パラメーターの変更, 論理ボリュームグループのパラメーター変更
ミラー化, ミラー化ボリュームの作成
リニア, リニア論理ボリュームの作成
ローカルアクセス, クラスター内の個別ノード上の論理ボリュームのアクティブ化
作成, リニア論理ボリュームの作成
作成例, 3つのディスク上での LVM 論理ボリューム作成
削除, 論理ボリュームの削除
名前変更, 論理ボリュームの名前変更
定義, 論理ボリューム, LVM 論理ボリューム
拡張, 論理ボリュームの拡張
排他的アクセス, クラスター内の個別ノード上の論理ボリュームのアクティブ化
管理、一般, 論理ボリュームの管理
縮小, 論理ボリュームの縮小
表示, 論理ボリュームの表示, LVM 用のカスタム報告, lvs コマンド
論理ボリュームのアクティブ化
個別のノード, クラスター内の個別ノード上の論理ボリュームのアクティブ化
障害の発生したデバイス
表示, 障害の発生したデバイスの情報表示

L

logical volume
activation, Controlling Logical Volume Activation
cache, Creating LVM Cache Logical Volumes
lvchange コマンド, 論理ボリュームグループのパラメーター変更
lvconvert コマンド, ミラー化ボリューム設定の変更
lvcreate コマンド, リニア論理ボリュームの作成
lvdisplay コマンド, 論理ボリュームの表示
lvextend コマンド, 論理ボリュームの拡張
LVM
アーキテクチャーの概要, LVM アーキテクチャーの概要
カスタムレポートのフォーマット, LVM 用のカスタム報告
クラスター化, クラスター化論理ボリュームマネージャ (CLVM)
コンポーネント, LVM アーキテクチャーの概要, LVM コンポーネント
ディレクトリ構造, ボリュームグループの作成
ヘルプ, CLI コマンドの使用
ボリュームグループ、定義, ボリュームグループ
ラベル, 物理ボリューム
ロギング, ロギング
履歴, LVM アーキテクチャーの概要
物理ボリューム、定義, 物理ボリューム
物理ボリュームの管理, 物理ボリュームの管理
論理ボリュームの管理, 論理ボリュームの管理
LVM ボリュームの作成
概要, 論理ボリューム作成の概要
LVM1, LVM アーキテクチャーの概要
LVM2, LVM アーキテクチャーの概要
lvmdiskscan コマンド, ブロックデバイスのスキャン
lvmetad デーモン, メタデータデーモン (lvmetad)
lvreduce コマンド, 論理ボリュームの縮小
lvremove コマンド, 論理ボリュームの削除
lvrename コマンド, 論理ボリュームの名前変更
lvs コマンド, LVM 用のカスタム報告, lvs コマンド
引数の表示, lvs コマンド
lvscan コマンド, 論理ボリュームの表示

M

man ページの表示, CLI コマンドの使用
mirror_image_fault_policy 設定パラメーター, ミラー化論理ボリュームの障害ポリシー
mirror_log_fault_policy 設定パラメーター, ミラー化論理ボリュームの障害ポリシー

P

pvdisplay コマンド, 物理ボリュームの表示
pvmove コマンド, オンラインデータ移動
pvremove コマンド, 物理ボリュームの削除
pvresize コマンド, 物理ボリュームのサイズ変更
pvs コマンド, LVM 用のカスタム報告
引数の表示, pvs コマンド
pvscan コマンド, 物理ボリュームの表示

R

RAID logical volume, RAID Logical Volumes
rules.d ディレクトリ, udev のデバイスマッパーとの統合

法律上の通知

Copyright © 2017 Red Hat, Inc.
This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat