<!doctype linuxdoctr system> 
<!-- 
$Id: LVM-HOWTO.sgml,v 1.2 2000/11/01 13:42:21 hisai Exp $
-->

<article>
<title>Logical Volume Manager HOWTO</title>
<author>bert hubert &lt;ahu@ds9a.nl&gt;&nl;
Richard Allen &lt;ra@ra.is&gt</author>
<date>Version 0.0.2 $Date: 2000/11/01 13:42:21 $</date>
<trans> 高橋 聡 <tt>hisai@din.or.jp</tt>
<tdate> 22 Oct 2000
<abstract>
<!-- A very hands-on HOWTO for Linux LVM -->
とても実践的な Linux LVM HOWTO 
</abstract>

<!-- Table of contents -->
<toc>

<!-- Begin the document -->

<!-- <sect>Introduction -->
<sect>はじめに
<p>
<!-- Welcome, gentle reader.  -->
親愛なる読者の皆さんへ。

<!--
This document is written to help enlighten you on what LVM is, how it works,
and how you can use it to make your life easier. While there is an LVM
FAQ, and even a German HOWTO, this document is written from a different
perspective. It is a true 'HOWTO' in that it is very hands-on, while also
imparting understanding (hopefully).
-->
このドキュメントでは、LVM が何者で、どのように働き、これを利用することで
いかに楽ができるのかについて、皆さんの理解の一助になるように書きました。
LVM FAQ やドイツ語で書かれた HOWTO もありますが、このドキュメントとは系統
が違っています。
このドキュメントはまさに「HOWTO」そのもので、とても実践的であるだけでなく、
LVM の理解をも深めます(うまくいけば)。

<!--
I should make it clear that I am not an author of the Linux Logical Volume
Manager. I have great respect for the people who are, and hope to be able to
cooperate with them.
-->
はっきりさせておきますが、私は Linux の Logical Volume Manager の開発者では
ありません。開発者の方々には敬意を表していますし、協力し合って行きたいと
思っています。

<!--
It's even weirder, I don't even know the developers of LVM. I hope this will
change soon. I apologise in advance for stepping on peoples toes.
-->
ただおかしな話なのですが、いまだに LVM の開発者がどなたなのかを知りません。
すぐにでも改めたいと思っています。「なんだ」と思われる前にあらかじめお詫びして
おきます。
<!-- <sect1>Disclaimer &amp; License -->
<sect1>おことわりと著作権
<p>
<!--
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-->
これが役に立つドキュメントになることを望んで配布していますが、「保証は一切
ありません」し、「商業向け」や「特定の目的への適用」に対する保証もありません。

<!--
If your disks melt and your company fires you - it's never our fault. Sorry.
Make frequent backups and do your experiments on non-mission critical
systems.
-->
ディスクが融けて、会社をクビになっても - それは私のせいではありません。
申し訳ありませんが。
いつもバックアップを取って、ミッション・クリティカルなシステムでは試さない
でください。

<!--
Furthermore, Richard Allen does not speak for his employer.

Linux is a registered trademark of Linus Torvalds.
-->
ましてや Richard Allen(著者)は、雇用主を代表しているわけでもありません。

Linux は Linus Torvalds 氏の登録商標です。

<!-- <sect1>Prior knowledge -->
<sect1>前提となる知識
<p>
<!--
Not much. If you have ever installed Linux and made a filesystem
(fdisk/mkfs), you should be all set.  As always when operating as root,
caution is advised.  Incorrect commands or any operation on device files
may damage your existing data.
-->
たいしたことはありません。Linux をインストールして、ファイルシステム(fdisk 
や mkfs を使って)を作成したことがあれば、それで十分です。毎度のことですが、
root で作業する場合は注意してください。デバイス・ファイルへの間違った命令や
操作は、既存のデータを壊す恐れがあります。

<!--
If you know how to configure HP/UX LVM you are almost done, Linux works
almost exactly like the HP implementation.
-->
HP/UX の LVM の設定方法を知っていれば、それでほとんど OK です。Linux 
は、HP で実現できることと、ほとんど同じにように動きます。
<!-- <sect1>Housekeeping notes -->
<sect1>ドキュメントの改訂について
<p>
<!--
There are several things which should be noted about this document. While I
wrote most of it, I really don't want it to stay that way. I am a strong
believer in Open Source, so I encourage you to send feedback, updates,
patches etcetera. Do not hesitate to inform us of typos or plain old errors.
-->
このドキュメントにはいくつか注意すべき点があります。私がこのドキュメントの
大半を書きましたが、そのようなやり方を続けるつもりは毛頭ありません。私は
オープン・ソースを信奉していますから、フィードバックや更新、パッチその他を
皆さんにお願いしたいと思っています。誤植や明らかに古くなった間違いを遠慮なし
に報告してください。

<!--
If you feel to you are better qualified to maintain a section, or think that
you can author and maintain new sections, you are welcome to do so. The SGML
of this HOWTO is available via CVS.  I envision this being a collaborative
project.
-->
どのセクションでも、ご自分の方が改訂者として優れていると感じられたり、著者
もしくは新規セクションの改訂者になれるとお思いになったら、そうしてください。
歓迎します。HOWTO の SGML は CVS でいじることができます。私はこれが共同プロ
ジェクトとなることを望んでいます。

<!--
In aid of this, you will find lots of FIXME notices. Patches are always
welcome! Wherever you find a FIXME, you should know that you are treading
unknown territory. This is not to say that there are no errors elsewhere,
but be extra careful. If you have validated something, please let us know so
I can remove the FIXME notice.
-->
手助けしていただくと分かりますが、このドキュメントの中にはたくさんの FIXME
(修正して)があることに気づかれると思います。パッチはいつでも歓迎します！ 
FIXME にどこで遭遇したとしても、そこは未知の領域であることを了解してくだ
さい。
どこにも間違いがないとは言い切れませんので、くれぐれも注意してください。
もし確実なことがわかったなら、何でもお知らせください。 FIXME を削除したい
と思います。

<!-- <sect1>Access, CVS &amp; submitting updates -->
<sect1>CVS アップデートは CVS へアクセス
<p>
<!-- The canonical location for the HOWTO is -->
HOWTO の正式な所在は、下記のところです。

<!--
<url url="http://www.ds9a.nl/lvm-howto/" 
name="http://www.ds9a.nl/lvm-howto/">
-->
<url url="http://www.ds9a.nl/lvm-howto/" name="http://www.ds9a.nl/lvm-howto/">

<!--
We now have anonymous CVS access available for the world at large.  This
allows you to easily obtain the latest version of this HOWTO and to
provide your changes and enhancements.
-->
世界中からアクセス可能な anonymous CVS を用意してあります。これで最新版の 
HOWTO を手軽に得られる上に、皆さんが変更や追加作業を簡単に行えます。

<!-- If you want to grab a copy of the HOWTO via CVS, here is how to do so: -->
CVS を利用して HOWTO のコピーを持ってきたいならば、下記のようにしてください。

<tscreen><verb>
$ export CVSROOT=:pserver:anon@outpost.ds9a.nl:/var/cvsroot
$ cvs login
CVS password: [enter 'cvs' (without 's)]
$ cvs co lvm-howto
cvs server: Updating lvm-howto
U lvm-howto/lvm-howto.sgml
</verb></tscreen>

<!--
If you spot an error, or want to add something, just fix it locally, and run
"cvs diff -u", and send the result off to us.
-->
間違いを見つけたり、追加したいことがあれば、まず手元で修正してから 
「cvs diff -u」を実行して、その結果を送ってください。

<!--
A Makefile is supplied which should help you create postscript, dvi, pdf,
html and plain text. You may need to install sgml-tools, ghostscript and
tetex to get all formats.
-->
postscript や dvi、pdf、html、テキストを作るのに役立つ Makefile が用意して
あります。色々なフォーマットを作るために、sgml-tools や ghostscript、tetex 
をインストールする必要があるかもしれません。

<!-- <sect1>Layout of this document -->
<sect1>このドキュメントの構成
<p>
<!--
We will initially be explaining some basic stuff which is needed to do
things. We do try however to include examples where this would aid
comprehension.
-->
まず LVM を動かすのに必要な基本的な要件をいくつか説明します。ただし例を
あげながら、理解のできるように努めます。

<!-- <sect>What is LVM?  -->
<sect>LVM とは？
<p>
<!--
Historically, a partition size is static.  This requires a system installer
to have to consider not the question of "how much data will I store
on this partition", but rather "how much data will I *EVER* store on
this partition".  When a user runs out of space on a partition, they
either have to re-partition (which may involve an entire operating
system reload) or use kludges such as symbolic links.
-->
ずっと以前から、パーティションの大きさは一度決めたらそのままです。システム
を導入する方は「このパーティションにどのくらいのデータを入れようかな」と
考えるというよりは、「『そもそも』このパーティションにどのくらいのデータを
入れるんだろう」と自問自答しなければなりません。ユーザがパーティションの空き
を越えて使おうとすると、パーティションを切り直すか(システムの再インストール
もありえます)、シンボリック・リンクなどのスマートとは言えない方法で修正
しなければなりません。

<!--
The notion that a partition was a sequential series of blocks on a
physical disc has since evolved.  Most Unix-like systems now have
the ability to break up physical discs into some number of units.
Storage units from multiple drives can be pooled into a "logical
volume", where they can be allocated to partitions.  Additionally,
units can be added or removed from partitions as space requirements
change.
-->
これまでパーティションは、物理的なディスク上の連続したブロックである、
という考え方にならってきました。最近の UNIX ライクなシステムのほとんどは、
物理的に複数のディスクを分割して、いくつかのユニットとして扱う機能を
備えています。
複数のドライブから成る記憶装置のユニットをまとめて「論理ボリューム」とし、
各パーティションに割り振れます。さらにこのユニットは、空きの調整が必要と
なった時に、パーティションに対して追加や削除が行えます。

<!-- This is the basis of a Logical Volume Manager (LVM).  -->
これが論理ボリュームマネージャ(LVM)の基本です。

<!--
For example, say that you have a 1GB disc and you create the "/home"
partition using 600MB.  Imagine that you run out of space and decide
that you need 1GB in "/home".  Using the old notion of partitions,
you'd have to have another drive at least 1GB in size.  You could then
add the disc, create a new /home, and copy the existing data over.
-->
たとえば 1 GB のディスクを持っていて、「/home」パーティションに 600 MB 
割り当てるとします。空きが無くなって、「/home」に 1 GB 必要になったと
考えてみてください。今までのパーティションの考え方だと、少なくとも 1 GB 
の大きさを持つ他のドライブを用意するしかありませんでした。そしてできる
ことはといえば、ディスクを追加し、新しい「/home」を作成し、既存のデータの
コピーをすることです。

<!--
However, with an LVM setup, you could simply add a 400MB (or larger)
disc, and add it's storage units to the "/home" partition.  Other
tools allow you to resize an existing file-system, so you simply
resize it to take advantage of the larger partition size and you're
back in business.
-->
ところが LVM での設定は、ただ 400 MB(もしくはそれ以上の)ディスクを追加
するだけです。その記憶ユニットを「/home」パーティションに追加するのです。
別のツールを使えば、既存のファイルシステムの大きさを変更できます。こう
してサイズを変更し、大きなサイズのパーティションのありがたさを感じつつ、
本来の仕事を再開できます。

<!--
As a very special treat, LVM can even make 'snapshots' of itself which
enable you to make backups of a non-moving target. We return to this
exciting possibility, which has lots of other real-world applications, later
on.
-->
LVM は「スナップショット」という非常にユニークな機能を持っていて、ある決まった
時点でのファイルシステムの内容をバックアップすることができます。
この興味をそそる機能が、実際に様々な用途に応用できることについては、後程
触れたいと思います。

<!--
In the next section we explain the basics of LVM, and the multitude of
abstractions it uses.
-->
次のセクションでは LVM の基本と、LVM が採用している考え方のポイントの
数々を説明します。

<!-- <sect>Basic principles -->
<sect>基本的な原則
<p>
<!--
Ok, don't let this scare you off, but LVM comes with a lot of jargon which
you should understand lest you endanger your filesystems.
-->
では、脅かし文句はこれぐらいにしておきましょう。しかし LVM には理解しておか
なければいけない専門用語がたくさんあります。理解しておかないと、ファイル
システムを危険にさらすはめになってしまうかもしれません。

<!-- We start at the bottom, more or less.  -->
まずは基礎のあたりからはじめます。

<descrip>
<!--
<tag>The physical media</tag>
You should take the word 'physical' with a grain of salt, though we will
initially assume it to be a simple hard disk, or a partition. Examples,
/dev/hda, /dev/hda6, /dev/sda. You can turn any consecutive number of blocks
on a block device into a ...
-->
<tag>物理媒体</tag>
「物理」という言葉の意味を複雑に考えないでください。単にハードディスク
もしくはパーティションを仮定しています。たとえば、/dev/hda、/dev/hda6、
/dev/sda のような。ブロック・デバイスにある連続したブロックをいくらでも
物理ボリュームに割り当てられます。その物理ボリュームとは…
<!--
<tag>Physical Volume (PV)</tag>
A PV is nothing more than a physical medium with some administrative data
added to it - once you have added this, LVM will recognise it as a holder
of ...
-->
<tag>物理ボリューム (PV)</tag>
物理ボリュームとは管理データをいくつか物理媒体に付加した物理媒体そのもの
を表します。
これを付加すると、LVM からは物理エクステントを入れる器に見えます。その物理
エクステントとは…
<!--
<tag>Physical Extents (PE)</tag>
Physical Extents are like really big blocks, often with a size of megabytes.
PEs can be assigned to a...
-->
<tag>物理エクステント(PE)</tag>
物理エクステントは、いかにも大きいブロックのように見え、通常は数 MB の大きさ
になります。
物理エクステントはボリューム・グループに配置されます。そのボリューム・
グループ とは…
<!--
<tag>Volume Group</tag>
A VG is made up of a number of Physical Extents (which may have come from
multiple Physical Volumes or hard drives).  While it may be tempting to
think of a VG as being made up of several hard drives (/dev/hda and /dev/sda
for example), it's more accurate to say that it contains PEs which are provided
by these hard drives.

>From this Volume Group, PEs can be assigned to a ...
-->
<tag>ボリューム・グループ (VG)</tag>
ボリューム・グループは、いくつかの物理エクステント(複数の物理ボリュームや
ハード・ドライブから成る)から構成されます。ボリューム・グループを多数の
ハード・ドライブ(たとえば /dev/hda や /dev/sda)から構成されているものと
理解したくなるかもしれませんが、より正しくは、ボリューム・グループは複数の 
物理エクステントから構成され、物理エクステントの機能はハード・ドライブに
よって提供されているということになります。

&gt;このボリューム・グループを元にして、物理エクステントは論理ボリュームに
割り当てられます。その論理ボリュームとは…
<!--
<tag>Logical Volume (LV)</tag>
Yes, we're finally getting somewhere. A Logical Volume is the end result of
our work, and it's there that we store our information. This is equivalent to
the historic idea of partitions.

As with a regular partition, on this Logical Volume you would typically build
a ...
-->
<tag>論理ボリューム (LV)</tag>
そうです、やっとたどり着きました。解説の最終目標はこの論理ボリュームなのです。
情報を保存するのは、まさにここなのです。論理ボリュームは、従来のパーティション
と同じ意味になります。

通常のパーティション上で作成するのと同じように、論理ボリューム上でファイル
システムを構築するのが普通です。そのファイルシステムとは…
<!--
<tag>Filesystem</tag>
This filesystem is whatever you want it to be: the standard ext2,
ReiserFS, NWFS, XFS, JFX, NTFS, etc...  To the linux kernel, there is
no difference between a regular partition and a Logical Volume.
-->
<tag>ファイルシステム</tag>
ファイルシステムは好みのものを何でも選べます。標準の ext2 や ReiserFS、NWFS、
XFS、JFX、NTFS 等どれでも。Linux のカーネルにとっては、普通のパーティション
と論理ボリュームには何も違いはありません。

<bf>訳註：</bf>各種ファイルシステムについては、
<url url="http://www.linux.or.jp/docs/Filesystems-HOWTO" 
name="Filesystems-HOWTO の日本語訳">をご覧ください。

</descrip>

<!-- I've attempted some ASCII art which may help you visualise this.  -->
ASCII 文字列による創作を試みることで、このしくみを図解してみましょう。

<!-- 
<verb>
A Physical Volume, containing Physical Extents:

  + - - - - -[ Physical Volume ]- - - - - - +
  | PE | PE | PE | PE | PE | PE  |
  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

A Volume Group, containing 2 Physical Volumes (PVs) with 6 Physical Extents:

  + - - - - - - [ Volume Group ] - - - - - - - - - - - - - -  - - - +
  |  + - - [PV] - - - - - - - - +  + - - [PV] - - - - - - -  - - +  | 
  |  | PE | PE | PE |  | PE | PE | PE  |  |
  |  + - - - - - - - - -  - - - - - +  + - - - - - - -  - - - - - -  - - +  |
  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 

We now further expand this:

  + - - - - - - [ Volume Group ] - - - - - - - - - - - - - - - - - +
  |  + - - [PV] - - - - - - - - +  + - - [PV] - - - - - - - - - +  |
  |  | PE | PE | PE |  | PE | PE | PE  |  |
  |  + - - + - - - + - - - + - - - +  + - + - - - - + - - - - + - - - +  |
  |     |   |   | + - - - - - /     |    |      |
  |     |   |   | |           |    |      |
  |   + - + - - - + - - - + - +      + - - - - + - - - - + - - +   |
  |   |  Logical  |      |  Logical   |   |
  |   |  Volume   |      |   Volume   |   |
  |   |           |      |            |   |
  |   |  /home    |      |    /var    |   |
  |   + - - - - - - - - - - - +      + - - - - - - - - - - - - +   |
  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
</verb>
-->
<verb>
物理ボリュームは、物理エクステントを含みます。

  +------[ 物理ボリューム ]------+
  | PE | PE | PE | PE | PE | PE  |
  +------------------------------+

ボリューム・グループは、2 つの物理ボリューム(PV)を含み、6 つの物理エクス
テントから構成されます。

  +------[ ボリューム・グループ ]---------+
  |  +--[PV]--------+  +--[PV]---------+  | 
  |  | PE | PE | PE |  | PE | PE | PE  |  |
  |  +--------------+  +---------------+  |
  +---------------------------------------+ 

もっと広げてみると、こうなります。

  +------[ ボリューム・グループ ]---------+
  |  +--[PV]--------+  +--[PV]---------+  |
  |  | PE | PE | PE |  | PE | PE | PE  |  |
  |  +--+---+---+---+  +-+----+----+---+  |
  |     |   |   | +-----/     |    |      |
  |     |   |   | |           |    |      |
  |   +-+---+---+-+      +----+----+--+   |
  |   | 論理      |      | 論理       |   |
  |   | ボリューム|      | ボリューム |   |
  |   |           |      |            |   |
  |   |  /home    |      |    /var    |   |
  |   +-----------+      +------------+   |
  +---------------------------------------+
</verb>

<!--
This shows us two filesystems, spanning two disks. The /home filesystem
contains 4 Physical Extents, the /var filesystem 2.
-->
この図では、2 つのファイルシステムがあり、2 つのディスクにまたがっています。
/home ファイルシステムは 4 つ、/var は 2 つの物理エクステントから構成されて
います。

<!--
bert hubert is writing <url name="a tool" url="http://ds9a.nl/lvm-viewer"> to
represent LVM more visually, a <url name="screenshot"
url="http://ds9a.nl/lvm-howto/screenshot.gif"> is provided. Looks better
than the ASCII art.
-->
bert hubert 氏は LVM をより視覚的に表示する 
<url name="ツール" url="http://ds9a.nl/lvm-viewer"> を作成しています。
<url name="スクリーンショット" url="http://ds9a.nl/lvm-howto/screenshot.gif"> 
が見られます。私の ASCII 文字創作品より見栄えがします。

<!-- <sect1>Show &amp; Tell -->
<sect1>実例を見ながらの解説
<p>
<!--
Ok, this stuff is hard to assimilate ('We are LVM of Borg...'), so here is a
very annotated example of creating a Logical Volume. Do NOT paste this
example onto your console because you WILL destroy data, unless it happens
that on your computer /dev/hda3 and /dev/hdb2 aren't used. 
-->
そうなんです。LVM はとても頭の中で消化しづらい考えなので(「我々はボーグの 
LVM…」)、ここでは論理ボリュームを作成する例を注釈をつけながら進めたいと思
います。
この例をコンソールにそのまま入力「しないで」ください。データを壊してしまう
「恐れ」があります。たとえ手持ちのコンピュータが、/dev/hda3 や /dev/hdb2 を
使用していなくてもです。
<p>
<bf>訳註：</bf>ボーグ(Borg)とは、スタートレック(ネクスト・ジェネレーション)
に登場するサイボーグ種族のことで、あらゆるものを非情な手段で自分達の中に取り
込む種族のことです。ハッカーたちの間では、その貪欲に何物をも自分に取り込む
姿から、 Microsoft にたとえる場合があります。
<p>
<!-- When in doubt, view the ASCIIgram above.  -->
納得いかなければ、上記の ASCII文字で書かれた図をご覧ください。

<!--
You should first set the partition types of /dev/hda3 and /dev/hdb2 to 0x8e,
which is 'Linux LVM'. Please note that your version of fdisk may not yet know
this type, so it will be listed as 'Unknown':
-->
まず /dev/hda3 と /dev/hdb2 のパーティションのタイプを 0x8e にしてください。
これが「Linux LVM」となります。ただし、お手持ちの fdisk のバージョンによって
は、このタイプを認識できずに「Unknown」と表示されるかもしれません。


<tscreen><verb>
# fdisk /dev/hda

Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 623 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1         2     16033+  83  Linux
/dev/hda2             3       600   4803435   83  Linux
/dev/hda3           601       607     56227+  83  Linux
/dev/hda4           608       614     56227+  83  Linux

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e

Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 623 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1         2     16033+  83  Linux
/dev/hda2             3       600   4803435   83  Linux
/dev/hda3           601       607     56227+  8e  Unknown
/dev/hda4           608       614     56227+  83  Linux

Command (m for help): w
</verb></tscreen>

<!--
We do the same for /dev/hdb2, but we don't display it here. This is needed
so that LVM is able to reconstruct things should you lose your
configuration.
-->
/dev/hdb2 に対しても同様な操作をしてみますが、ここではその結果を表示しません。
この操作は、構成を失った場合に LVM を再構築するのに必要です。

<!--
Now, this shouldn't be necessary, but some computers require a reboot at
this point. So if the following examples don't work, try rebooting.
-->
必ずしも全てのコンピュータではありませんが、ここでリブートが必要になる場合
もあります。次の例がうまくいかないようなら、リブートしてみてください。

<!-- We then create our Physical Volumes, like this: -->
下記のようにすれば、物理ボリュームが作成できます。
<tscreen><verb>
# pvcreate  /dev/hda3
pvcreate -- physical volume "/dev/hda3" successfully created
# pvcreate  /dev/hdb2
pvcreate -- physical volume "/dev/hdb2" successfully created
</verb></tscreen>

<!-- We than add these two PVs to a Volume Group called 'test': -->
では、2 つの物理ボリュームを「test」というボリューム・グループに追加して
みます。
<tscreen><verb>
# vgcreate test /dev/hdb2 /dev/hda3
vgcreate -- INFO: using default physical extent size 4 MB
vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte
vgcreate -- doing automatic backup of volume group "test"
vgcreate -- volume group "test" successfully created and activated
</verb></tscreen>

<!-- So we now have an empty Volume Group, let's examine it a bit: -->
これで未使用のボリューム・グループが 1 つできあがりました。ちょっと調べて
みましょう。

<tscreen><verb>
# vgdisplay -v test
--- Volume group ---
VG Name               test
VG Access             read/write
VG Status             available/resizable
VG #                  0
MAX LV                256
Cur LV                0
Open LV               0
MAX LV Size           255.99 GB
Max PV                256
Cur PV                2
Act PV                2
VG Size               184 MB
PE Size               4 MB
Total PE              46
Alloc PE / Size       0 / 0
Free  PE / Size       46 / 184 MB

--- No logical volumes defined in test ---


--- Physical volumes ---
PV Name (#)           /dev/hda3 (2)
PV Status             available / allocatable
Total PE / Free PE    13 / 13

PV Name (#)           /dev/hdb2 (1)
PV Status             available / allocatable
Total PE / Free PE    33 / 33
</verb></tscreen>
<!--
Lots of data here - most of it should be understandable by now. We see that
there are no Logical Volumes defined, so we should work to remedy that. We
try to generate a 50 megabyte volume called 'HOWTO' in the Volume
 Group 'test':
-->
情報がずらずら並んでいますが、今のところは大部分を理解できないはずです。
まだ論理ボリュームを定義していませんから、これを修正する必要があります。
50 MB の「HOWTO」というボリュームを「test」ボリューム・グループに作ってみ
ます。

<tscreen><verb>
# lvcreate -L 50M -n HOWTO test 
lvcreate -- rounding up size to physical extent boundary "52 MB"
lvcreate -- doing automatic backup of "test"
lvcreate -- logical volume "/dev/test/HOWTO" successfully created
</verb></tscreen>

<!-- Ok, we're nearly there, let's make a filesystem: -->
これで、あと少しというところまできましたので、次はファイルシステムを作成
しましょう。

<tscreen><verb>
# mke2fs /dev/test/HOWTO 
mke2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
13328 inodes, 53248 blocks
2662 blocks (5.00%) reserved for the super user
First data block=1
7 block groups
8192 blocks per group, 8192 fragments per group
1904 inodes per group
Superblock backups stored on blocks: 
	8193, 24577, 40961

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done
# mount /dev/test/HOWTO /mnt
# ls /mnt
lost+found
</verb></tscreen>

<!--
And we're done! Let's review our Volume Group, because it should be filled
up a bit by now:
-->
これで完了です！ 作成したボリューム・グループを見直してみましょう。もう
これでボリューム・グループをデータで埋めつくせるようになっているはずです
から。

<tscreen><verb>
# vgdisplay test -v
--- Volume group ---
VG Name               test
VG Access             read/write
VG Status             available/resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           255.99 GB
Max PV                256
Cur PV                2
Act PV                2
VG Size               184 MB
PE Size               4 MB
Total PE              46
Alloc PE / Size       13 / 52 MB
Free  PE / Size       33 / 132 MB

--- Logical volume ---
LV Name               /dev/test/HOWTO
VG Name               test
LV Write Access       read/write
LV Status             available
LV #                  1
# open                1
LV Size               52 MB
Current LE            13
Allocated LE          13
Allocation            next free
Read ahead sectors    120
Block device          58:0


--- Physical volumes ---
PV Name (#)           /dev/hda3 (2)
PV Status             available / allocatable
Total PE / Free PE    13 / 13

PV Name (#)           /dev/hdb2 (1)
PV Status             available / allocatable
Total PE / Free PE    33 / 20
</verb></tscreen>

<!--
Well, it is. /dev/hda3 is completely unused, but /dev/hdb2 has 13 Physical
Extents in use.
-->
そう、/dev/hda3 はまったく使用していませんが、/dev/hdb2 は 13 個の
物理エクステントを使用しています。
<!-- <sect1>Active and Inactive: kernel space and user space -->
<sect1>アクティブとインアクティブ - カーネル空間とユーザ空間
<p>
<!--
As with all decent operating systems, Linux is divided in two parts: kernel
space and user space. Userspace is sometimes called userland, which would
also be a good name for a theme park, 'Userland'.
-->
まともなオペレーティング・システムがそうであるように、Linux は システム構成
が 2 つに別れています。それは、カーネル空間とユーザ空間です。ユーザ空間は、
ユーザランドと呼ばれることもあります。「ユーザランド」は、人気のあるテーマ・
パークを表す意味でも使われています。

<!--
Discovery, creation and modification of things pertaining to Logical Volume
Management is done in user space, and then communicated to the kernel. Once
a volume group or logical volume is reported to the kernel, it is
called 'Active'. Certain changes can only be performed when an entity is
active, others only when it is not.
-->
論理ボリュームに関連した新規作成や修正作業は、ユーザ空間で行われ、その結果
をカーネルとやりとりします。ボリューム・グループや論理ボリュームについての
情報がカーネルに渡ると、「アクティブ」と呼ばれる状態になります。修正作業の
中には、ある要素がアクティブな状態であることが必要だったり、インアクティブ
な状態が必要なものもあります。

<!-- <sect>Prerequisites -->
<sect>必要な条件
<p>
<!--
There is a wide range of kernels where LVM is available on. In Linux 2.4,
LVM will be fully integrated. From kernel 2.3.47 and onwards, LVM is in the
process of being merged into the main kernel.
-->
LVM は幅広いバージョンのカーネルで利用できます。Linux 2.4 では、LVM が全面的
に採用されています。カーネル 2.3.47 以降のバージョンでは、LVM はメインブランチ
に統合される途中の状態です。

<!-- <sect1>Kernel -->
<sect1>カーネル
<sect2>Linux 2.4
<p>
<!--
Will contain everything you need. It is expected that most distributions
will release with LVM included as a module. If you need to compile, just
tick off the LVM option when selecting your block devices.
-->
Linux 2.4 では必要な機能すべてが用意されています。大部分のディストリビュー
ションで、LVM はモジュールとして含まれてリリースされると思われます。コン
パイルする必要があれば、ブロック・デバイス選択のところで LVM の項目に
チェックを付けてください。
<sect2>Linux 2.3.99.*
<p>
<!--
Once things have calmed down on the kernel development front, this section
will vanish. For now, the gory details.
-->
最先端のカーネル開発が安定してしまえば、このセクションはなくなるでしょう。
さしあたりは、ぐちゃぐちゃすっきりしませんが。

<!--
As we write this, Linux 2.3.99pre5 is current and it still needs a very tiny
patch to get LVM working. 
-->
これを書いている時点では Linux 2.3.99pre5 が最新版で、LVM を動作させるのには、
非常に小さいのですが、まだパッチが必要です。

<!-- For Linux 2.3.99pre3, two patches were released: -->
Linux 2.3.99pre3 に対しては、2 つのパッチがリリースされています。

<!--
The patch was posted on linux-kernel, and is available <url name="here"
url="http://ds9a.nl/lvm-howto/2.3.99pre3">.
-->
そのパッチは linux-kernel に投稿され、
<url name="ここ" url="http://ds9a.nl/lvm-howto/2.3.99pre3">から取ってこられ
ます。

<!--
Andrea Arcangeli improved on that patch, and supplied 
<url name="an incremental patch" url="http://ds9a.nl/lvm-howto/andrea.patch">,
which should be applied on top of the 2.3.99pre3 LVM patch above.
-->
Andrea Arcangeli 氏はこのパッチを改良して
<url name="差分パッチ" url="http://ds9a.nl/lvm-howto/andrea.patch">として
上記の 2.3.99pre3 用の LVM パッチに当てられるようにしています。

<!--
For Linux 2.3.99pre5, bert hubert rolled these two patches into one and
ported it to 2.3.99pre5. <url name="Patch"
url="http://ds9a.nl/lvm-howto/2.3.99-pre5.lvm.patch">. Use with care.
-->
Linux 2.3.99pre5 に対しては、bert hubert 氏が上記 2 つのパッチを 1 つに
まとめて、2.3.99pre5 に移植しました。それがこの<url name="パッチ"
url="http://ds9a.nl/lvm-howto/2.3.99-pre5.lvm.patch">です。使用するに当たっ
てはご注意を。

<!--
2.3.99pre6-1, yes, a prerelease of a prepatch, features for the first time
complete LVM support! It stil misses Andreas patch but we have been assured
that it is in the queue to be released real soon.
-->
2.3.99pre6-1 はパッチを統合したプレリリース版です。はじめて LVM の機能を
完全にサポートしました！ まだ Andreas 氏のパッチは取り込まれていませんが、
すぐにでもリリースする予定になっているはずです。

<!--
2.3.99pre4-ac1 has the tiny LVM patch in by default, and working. It does
not contain Andreas patch though.
-->
2.3.99pre4-ac1 はデフォルトで小さなパッチが取り込まれていて、動作します。
まだ Andreas 氏のパッチは取り込まれていません。

<sect2>Linux 2.2
<!-- <p>FIXME: write this -->
<p>FIXME: ここに書いてください。
<sect2>Linux 2.3
<p>
<!-- FIXME: write this -->
FIXME: ここに書いてください。
<!-- <sect1>Userspace -->
<sect1>ユーザ空間
<p>
<!--
You need the tools available from the <url name="LVM site"
url="http://lvm.msede.com/lvm">. Compiling them on glibc2.1 systems requires
a tiny patch, and even then gives errors on Debian 2.2.
-->
ツール類が必要なら、<url name="LVM サイト" url="http://lvm.msede.com/lvm">
から取ってこられます。glibc2.1 でコンパイルするなら、小さなパッチが必要です。
なお Debian 2.2 ではそのパッチを当ててもエラーがでます。

<!-- <sect>Growing your filesystem -->
<sect>ファイルシステムを拡張する
<p>
<!--
You can do this with a provided script which does a lot of work for you, or
you car do it by hand if needed.
-->
色々な設定ができるスクリプトがあって、この作業はそれを使って行えます。必要で
あれば、スクリプトを使わずに 1 つ 1 つ実行もできます。
<!-- <sect1>With e2fsadm -->
<sect1>e2fsadm を使って
<p>
<!--
If there is room within your volume group, and you use the ext2 filesystem
(most people do), you can use this handy tool.
-->
ボリューム・グループ内に空きがあり、ext2 ファイルシステムを使っているなら
(一般的に使用されています)、使い勝手の良いこのツールが使えます。

<!--
The <tt>e2fsadm</tt> command uses the commercial resize2fs tool. While
people feel that this is good software, it is not very widely installed.
-->
<tt>e2fsadm</tt> コマンドは、商用の resize2fs ツールを利用しています。
良いソフトウェアという評判ですが、広く使われているわけではありません。

<!--
If you want to use the FSF's <tt>ext2resize</tt> command, you need to inform
<tt>e2fsadm</tt> of this:
-->
FSF の <tt>ext2resize</tt> を使うなら、
<tt>e2fsadm</tt> に情報を下記のようにして渡す必要があります。

<tscreen><verb> 
# export E2FSADM_RESIZE_CMD=ext2resize 
# export E2FSADM_RESIZE_OPTS=""
</verb></tscreen>

<!--
The rest is easy, <tt>e2fsadm</tt> is a lot like the other LVM commands:
-->
後は簡単です。<tt>e2fsadm</tt> は他の LVM のコマンドと非常によく似ています
ので。

<tscreen><verb>
# e2fsadm /dev/test/HOWTO -L+50M
e2fsadm -- correcting size 102 MB to physical extent boundary 104 MB
e2fsck 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/test/HOWTO: 11/25688 files (0.0% non-contiguous), 3263/102400 blocks
lvextend -- extending logical volume "/dev/test/howto" to 104 MB
lvextend -- doing automatic backup of volume group "test"
lvextend -- logical volume "/dev/test/HOWTO" successfully extended

ext2_resize_fs
ext2_grow_fs
ext2_block_relocate
ext2_block_relocate_grow
ext2_grow_group
ext2_add_group
ext2_add_group
ext2_add_group
ext2_add_group
ext2_add_group
ext2_add_group
direct hits 4096 indirect hits 0 misses 1
e2fsadm -- ext2fs in logical volume "/dev/test/HOWTO" successfully extended to 104 MB
</verb></tscreen>

<!-- <sect1>Growing your Logical Volume -->
<sect1>論理ボリュームを拡張する
<p>
<!--
The <tt>e2fsadm</tt> command takes care of this for you. However, it may be
useful to understand how to do this manually:

If you have room within your Volume Group, this is a one liner:
-->
<tt>e2fsadm</tt> でこの作業は行えますが、<tt>e2fsadm</tt> を使わない方法を
理解しておいても損はないと思います。

<tscreen><verb>
# lvextend -L+12M /dev/test/HOWTO 
lvextend -- rounding size to physical extent boundary
lvextend -- extending logical volume "/dev/test/HOWTO" to 116 MB
lvextend -- doing automatic backup of volume group "test"
lvextend -- logical volume "/dev/test/HOWTO" successfully extended
</verb></tscreen>

<!-- <sect1>Growing your Volume Group -->
<sect1>ボリューム・グループを拡張する
<p>
<!--
This is done with the vgextend utility, and is easy as pie. You first need
to create a physical volume. This is done with the <tt>pvcreate</tt>
utility. With this tool, you convert any block device into a physical
volume.
-->
これは vgextend ユーティリティを使いますが、とても簡単です。まず最初に
物理ボリュームを作ります。これは <tt>pvcreate</tt> ユーティリティを使います。
このツールを使ってブロック・デバイスを物理ボリュームに置き換えます。

<!-- After that is done, <tt>vgextend</tt> does the rest: -->
それが終った後に、<tt>vgextend</tt> を実行します。
<tscreen><verb>
# pvcreate /dev/sda1
pvcreate -- physical volume "/dev/sda1" successfully created
# vgextend webgroup /dev/sda1
vgextend -- INFO: maximum logical volume size is 255.99 Gigabyte
vgextend -- doing automatic backup of volume group "webgroup"
vgextend -- volume group "webgroup" successfully extended
</verb></tscreen>

<!--
Please note that in order to do this, your Volume Group needs to be
active. You can make it by executing 'vgchange -a y webgroup'.
-->
おぼえておいて欲しいことは、これを実行するには、ボリューム・グループが
アクティブである必要があるということです。「vgchange -a y webgroup」を
実行すればアクティブにできます。

<!-- <sect1>Growing your filesystem -->
<sect1>ファイルシステムを拡張する
<p>
<!--
If you want to do this manually, there are a couple of ways to do this.
-->
ツールを使わずに実現したいなら、いくつかの方法があります。
<!-- <sect2>ext2 off-line with ext2resize -->
<sect2>オフライン状態の ext2 を ext2resize を使って
<p>
<!--
By off-line, we mean that you have to unmount the file-system to make
these changes.  The file-system and it's data will be unavailable while
doing this.  Note this means you must use other boot media if extending
the size of the root or other important partitions.
-->
オフラインとは、ファイルシステムのマウントを外して、これから行う変更作業
ができる状態のことを指します。ファイルシステムやその中のデータは、この
状態では利用することができません。つまり、root や他の重要なパーティションの大きさ
を変更する場合は、他にブートできる媒体が必要となることを忘れないでください。
<p>
<!--
The ext2resize tool is available on the GNU ftp size, but most distributions
carry it as a package. The syntax is very straightforward:
-->
ext2resize ツールは、GNU の ftp サイトから取ってこられますが、大抵のディス
トリビューションは、パッケージの 1 つとして用意してあります。使い方はとても簡単
です。
<tscreen><verb>
# ext2resize /dev/HOWTO/small 40000
</verb></tscreen>
<!--
Where 40000 is the number of blocks the filesystem should have after growing
or shrinking.
-->
40000 という数字は、拡張もしくは縮小された後のファイルシステムのブロック数です。

<!-- <sect2>ext2 on-line -->
<sect2>オンライン状態の ext2 
<p>
<!-- FIXME: write this -->
FIXME: ここに書いてください。

<!-- <sect>Replacing disks -->
<sect>ディスクの交換
<p>
<!--
This is one of the benefits of LVM. Once you start seeing errors
on a disk, it is high time to move your data. With LVM this is easy as pie.
We first do the obvious replacement example where you add a disk to the
system that's at least as large as the one you want to replace.
-->
LVM の長所の 1 つにこれが上げられます。あるディスクでエラーが出はじめたら、
データをぼちぼち移動しなければいけません。LVM を利用すると、とても簡単に
実行できます。
まずはじめに典型的な交換作業の例をあげます。少なくとも、交換したいだけの
容量を持つディスクをシステムに追加してみます。

<!--
To move data, we move Physical Extents of a Volume Group to another disk, or
more precisely, to another Physical Volume. For this, LVM offers us the
<tt>pvmove</tt> utility.
-->
データを移動するには、ボリューム・グループの物理エクステントを他のディスク、
より正確には物理ボリュームに移動することになります。これを行うには LVM で
行うには <tt>pvmove</tt> ユーティリティを使用します。

<!--
Let's say that our suspicious disk is called /dev/hda1 and we want to replace
it by /dev/sdb3. We first add /dev/sdb3 to the Volume Group that contains
/dev/hda1. 
-->
おかしなディスクを /dev/hda1 として、これを /dev/sdb3 に置き換えることにしま
しょう。まず /dev/sdb3 を /dev/hda1 が属しているボリューム・グループを追加
します。

<!--
It appears advisable to unmount any filesystems on this Volume Group before
doing this. Having a full backup might not hurt either.
-->
この作業を行う前に、このボリューム・グループに属するファイルシステムのマウント
を外してください。フル・バックアップをとればなお安全です。

<!-- FIXME: is this necessary?  -->
FIXME: これは必要か？

<!--
We then execute <tt>pvmove</tt>. In its simplest invocation, we
just mention the disk we want to remove, like this:
-->
では <tt>pvmove</tt> を実行してみましょう。とても簡単に実行できるので、
外そうとしているディスクに注意を集中してください。実行は下記のように
なります。

<tscreen><verb>
# pvmove /dev/hda1
pvmove -- moving physical extents in active volume group "test1"
pvmove -- WARNING: moving of active logical volumes may cause data loss!
pvmove -- do you want to continue? [y/n] y
pvmove -- doing automatic backup of volume group "test1"
pvmove -- 12 extents of physical volume "/dev/hda1" successfully moved
</verb></tscreen>

<!--
Please heed this warning. Also, it appears that at least some kernels or LVM
versions have trouble with this command. I tested it with 2.3.99pre6-2, and
it works, but be warned.
-->
この警告に注意してください。というのも、カーネルと LVM それぞれいくつかの
バージョンでは、このコマンドで問題が生じます。2.3.99pre6-2 でテストして、
うまく動きましたが、警告が出ました。

<!--
Now that /dev/hda1 contains no Physical Extents anymore, we can reduce it
from the Volume Group:
-->
これで物理エクステントは /dev/hda1 のどこにも存在しなくなったたので、
ボリューム・グループから外すことができます。

<tscreen><verb>
# vgreduce test1 /dev/hda1
vgreduce -- doing automatic backup of volume group "test1"
vgreduce -- volume group "test1" successfully reduced by physical volume:
vgreduce -- /dev/hda1
</verb></tscreen>

<!--
FIXME: we need clarity on a few things. Should the volume group be active?
When do we get data loss?
-->
FIXME:いくつかはっきりさせる必要がある。ボリューム・グループはアクティブ
にしておくべきか？ データが失われるのはどんな場合か？ 

<!-- <sect1>When it's too late -->
<sect1>手遅れになる時
<p>
<!--
If a disk fails without warning and you are unable to move the Physical Extents
off it to a different Physical Volume you will have lost data unless the
Logical Volumes on the PV that failed was mirrored. The correct course of
action is to replace the failed PV with an identical one or at least a 
partition of the same size. 
-->
ディスクか何の警告もなしに壊れて、そのディスクの物理エクステントを他の物理
ボリュームに移行できなかった場合には、壊れてしまった物理ボリュームの論理
ボリュームをミラーしていなければ、データが壊れてしまうでしょう。適切な対応方法
は、壊れた物理ボリュームとまったく同じものと交換するか、最低でも同じ大きさの
パーティションに交換するかのどちらかです。

<!--
The directory /etc/lvmconf contains backups
of the LVM data and structures that make the disks into Physical Volumes and
list which Volume Groups that PV belongs to and what Logical Volumes are
in the Volume Group. 
-->
/etc/lvmconf ディレクトリには LVM に関するデータと構成がバックアップされて
います。構成とは、ディスクの物理ボリュームへの割り当てと物理ボリュームが
属しているボリューム・グループ、どの論理ボリュームがそのボリューム・グループ
に入っているかの一覧から成ります。

<!--
After replacing the faulty disk you can use the
<tt>vgcfgrestore</tt> command to recover the LVM data to the new PV. This
restores the Volume Group and all it's info, but it does not restore the
data that was in the Logical Volumes.  This is why most LVM commands make
backups automatically of the LVM data when doing changes.
-->
壊れたディスクを交換した後、<tt>vgcfgrestore</tt> コマンドを使って LVM の
データを新しい物理ボリュームに復活させます。この作業でボリューム・グループ
をはじめ、すべての情報を復活できますが、論理ボリュームのデータは復活しません。
その理由は、LVM のコマンドの大部分が、変更が加わった時点で自動的に LVM 関連の
データをバックアップしているからです。

<!-- <sect>Making snapshots for consistent backups -->
<sect>確実なバックアップを行うには、スナップショットを取る
<p>
<!--
This is one of the more incredible possibilities. Let's say you have a busy
server, with lots of things happening. For a useful backup, you need to shut
down a large number of programs because otherwise you end up with inconsistencies.
-->
ここにあげるのは、本当に起こるかどうかも疑わしい例の 1 つです。たとえば
様々な処理を次々こなしているサーバを運用しているとします。有効なバック
アップという点からすると、稼働中のあらゆるプログラムを落とす必要があります。
そうしないと、システムが不整合な状態に陥ってしまうからです。

<!--
The canonical example is moving a file from /tmp to /root, where /root was
being backed up first. When /root was read, the file wasn't there yet. By
the time /tmp was backed up, the file was gone.
-->
典型的な例として、あるファイルを /tmp から /root に移す場合を見てみます。
/root がまずバックアップされていました。/root を見た時、まだそのファイルは
ありませんでした。その時までに /tmp がバックアップが完了しましたが、ファイ
ルは移動した後でした。

<!--
Another story goes for saving databases or directories. We have no clue if a
file is in any usable state unless we give the application time to do a
clean shutdown.
-->
データベースやディレクトリの保存では状況が変わります。アプリケーションを
きちんと落とす機会がないと、ファイルがバックアップ可能な状態になるきっかけ
が得られません。

<!--
Which is where another problem pops up. We shut down out applications, make
our backup, and restart them again. This is all fine as long as the backup
only takes a few minutes, but gets to be real painful if it takes hours, or
if you're not even sure how long it takes.
-->
別の問題も出てきます。普通はアプリケーションを落し、バックアップをとってから、
再起動をかけます。これはバックアップが数分で取り終えればまったく問題になりま
せんが、数時間かかったり、いつ終るともわからないなら、ダメージをこうむること
になります。

<!-- LVM to the rescue.   -->
LVM でこの状況を救いましょう。

<!--
With LVM we can make a snapshot picture of a Logical Volume which is
instantaneous, and then mount that and make a backup of it.
-->
LVM を使えば、その時々の論理ボリュームの状況をスナップショットにとること
ができ、それをマウントしたり、バックアップをとることもできます。

<!-- Let's try this out: -->
試してみましょう。

<tscreen><verb>
# mount /dev/test/HOWTO /mnt
# echo > /mnt/a.test.file 
# ls /mnt/  
a.test.file  lost+found
# ls -l /mnt/
total 13
-rw-r--r--    1 root     root            1 Apr  2 00:28 a.test.file
drwxr-xr-x    2 root     root        12288 Apr  2 00:28 lost+found
</verb></tscreen>

<!-- Ok, we now have something to work with. Let's make the snapshot: -->
これで、対象となるファイルができました。スナップショットを作ってみましょう。

<tscreen><verb>
# lvcreate --size 16m --snapshot --name snap /dev/test/HOWTO
lvcreate -- WARNING: all snapshots will be disabled if more than 16 MB are changed
lvcreate -- INFO: using default snapshot chunk size of 64 KB
lvcreate -- doing automatic backup of "test"
lvcreate -- logical volume "/dev/test/HOWTO" successfully created
</verb></tscreen>

<!-- More on the '&#045;&#045;size' parameter later. Let's mount the snapshot: -->
「--size」パラメタについては後で詳しく触れます。スナップショットをマウント
してみます。

<tscreen><verb>
# mount /dev/test/snap /snap
# ls /snap
total 13
-rw-r--r--    1 root     root            1 Apr  2 00:28 a.test.file
drwxr-xr-x    2 root     root        12288 Apr  2 00:28 lost+found
</verb></tscreen>
<!--
Now we erase a.test.file from the original, and check if it's still there in
the snapshot:
-->
元の位置から a.test.file を削除して、まだスナップショットの場所に存在する
かをチェックしてみてください。
<tscreen><verb>
# rm /mnt/a.test.file
# ls /snap
total 13
-rw-r--r--    1 root     root            1 Apr  2 00:28 a.test.file
drwxr-xr-x    2 root     root        12288 Apr  2 00:28 lost+found
</verb></tscreen>

<!-- Amazing Mike!  -->
これはすごい！

<!-- <sect1>How does it work?  -->
<sect1>どのように働く？
<!--
<p>Remember that we had to set the '- -size' parameter? What really happens
is that the 'snap' volume needs to have a copy of all blocks or 'chunks' as
LVM calls them, which are changed in the original.
-->
<p>
「--size」パラメタを設定しなければならなかったことをおぼえていますか？ 
「snap」ボリュームは、ブロックもしくは「チャンク」のすべてのコピーを LVM が
必要とする時、つまり元データが変更されてしまった時になければいけません。

<bf>訳註：</bf>チャンク(chunk)とは、あるデータ構造をいくつかにまとめた単位を
表します。この場合は、ディスク上で物理的に連続している LVM が利用可能な最小
単位を意味しています。

<!--
When we erased a.test.file, it's inode was removed. This caused 64 KB to be
marked as 'dirty' - and a copy of the original data was written to the
'snap' volume.  In this case we allocated 16MB for the snapshot, so if more
than 16MB of "chunks" are modified, the snapshot will be deactivated.
-->
a.test.file を削除した時、その inode は削除されます。すると 64 KB 分(チャンク
の大きさ)が「ダーティー(dirty)な」状態としてマークされ、元データのコピーが
「snap」ボリュームに書かれます。この場合ですと、スナップショットとして 16 MB
確保してありますから、 16 MB 以上の「チャンク」が変更されると、スナップ
ショットは機能しなくなるでしょう。

<!--
To determine the correct size for a snapshot partition, you will have to
guess based on usage patterns of the primary LV, and the amount of time
the snapshot will be active.  For example, an hour-long backup in the
middle of the night when nobody is using the system may require
very little space.
-->
スナップショットのパーティションの大きさを間違いなく決めるには、論理ボリューム
本来の使われ方を考慮して、スナップショットをアクティブにする時間を推測するしか
ありません。たとえば、真夜中に誰も利用していないシステムを数時間かけてバック
アップするなら、ごくわずかな空きしか必要ないと思います。

<!--
Please note that snapshots are not persistent. If you unload LVM or reboot,
they are gone, and need to be recreated.
-->
注意して欲しいのは、スナップショットはずっと存在するものではない、ということ
です。LVM を落したり、リブートしたりすれば、スナップショットは消えてしまい、
再作成することになります。

<!-- <sect>Redundancy &amp; Performance -->
<sect>冗長性とパフォーマンス
<p>
<!--
For performance reasons, it is possible to spread data in a 'stripe' over
multiple disks. This means that block 1 is on Physical Volume A, and block 2
is on PV B, while block 3 may be on PV A again. You can also stripe over
more than 2 disks.
-->
パフォーマンスを上げる点から見た場合、データを複数のディスクに「ストライプ」
して分散できます。
つまりブロック 1 は物理ボリューム A に、ブロック 2 は物理ボリューム B に、
ブロック 3 は再び物理ボリューム A に、というようにです。2 つ以上のディスクにも
ストライプできます。

<!--
This arrangement means that your have more disk bandwidth available. It also
means that more 'spindles' are involved. More on this later.
-->
この処置をとることで、ディスクのバンド幅が広がるとともに、「スピンドル」が
もっと必要になることを意味しています。スピンドルについては後程詳しく説明します。

<bf>訳註：</bf>スピンドル(spindle)は、ハードディスクを構成する部品の 1 つで、
情報を記録する部品である「プラッター」という磁気媒体を回転させている軸を指
します。つまり「スピンドル」が多ければ多いほど、それだけ平行してディスクに
読み書きができ、全体のパフォーマンスが上ることになります。

<!--
Besides increasing performance, it is also possible to have your data in
copies on multiple disks. This is called mirroring. Currently, LVM does not
support this natively but there are ways to achieve this.
-->
パフォーマンスをあげるだけでなく、あるデータを複数ディスク上にコピーして持たす
こともできます。これをミラーリングと呼びます。現状の LVM はそもそもこの機能を
サポートしていませんが、結果的に実現することが可能です。
<!-- <sect1>Why stripe?  -->
<sect1>なぜストライプするのか？
<p>
<!--
Disk performance is influenced by three things, at least. The most obvious
is the speed at which data on a disk can be read or written sequentially.
This is the limiting factor when reading or writing a large file on a
SCSI/IDE bus with only a single disk on it.
-->
ディスクのパフォーマンスに影響を与える要因は、少なくとも 3 つあります。
最も顕著に影響がでるものは、ディスク上のデータを連続して読み書きする速度
です。
SCSI や IDE バス 1 本上に 1 つだけディスクがあり、そこで大きなファイル
を読み書きする時には、これはパフォーマンスを低下させる要因となります。

<!--
Then there is the bandwidth available TO the disk. If you have 7 disks on a
SCSI bus, this may well be less than the writing speed of your disk itself.
If you spend enough money, you can prevent this bottleneck from being a
problem.
-->
ディスクが利用できる帯域幅は限られています。1 本の SCSI バスに 7 つのディス
クを繋げれば、恐らくディスク自体に書き込む速度がバスの速度を越えてしまうで
しょう。
お金さえあれば、このボトルネックを根本的に解決できます。

<!--
Then there is the latency. As the saying goes, latency is always bad news.
And even worse, you can't spend more money to get lower latency! Most disks
these days appear to have a latency somewhere around 7ms. Then there is the
SCSI latency, which used to be something like 25ms.
-->
遅延が発生します。よく言われているように、遅延は以前から厄介な問題です。
なお悪いことに、お金を注ぎ込んでも遅延を減らすことができません！ 近頃のディ
スクはおおよそ 7 ms の遅延が生じます。SCSI の遅延も、25 ms 程度発生して
いました。

<!-- FIXME: need recent numbers!  -->
FIXME: 最近の値が必要！

<!--
What does this mean? The combined latency would be around 30ms in a typical
case. You can therefore perform only around 33 disk operations per second.
If you want to be able to do many thousands of queries per second, and you
don't have a massive cache, you are very much out of luck.
-->
これは何を意味するのでしょうか？ 遅延を合算すると、標準で 30 ms 程度の遅延
が発生することになるでしょう。ということは、1 秒当たりわずか 33 回だけしか
ディスクに対する操作ができないということになります。
秒当たりに多量の問い合わせしたいのに、キャシュも十分でないとなると、それは
不運としか言いようがありません。

<!--
If you have multiple disks, or 'spindles', working in parallel, you can have
multiple commands being performed concurrently, which nicely circumvents
your latency problem. Some applications, like a huge news server, don't even
work anymore without striping or other IO smartness.
-->
並列に動く複数のディスクか「スピンドル」があれば、同時に複数の命令を実行でき
ます。これは遅延の問題を回避する有効な手段です。大規模な news サーバーのよう
な用途では、ストライピングか入出力をスムーズに行う別の手段なしには動作すら
しません。

<!--
This is what striping does. And, if your bus is up to it, even sequential
reading and writing may go faster.
-->
これがストライピングの動作です。バスを最大限に使えれば、連続した読み書きも
もっと速くなるかもしれません。

<!-- <sect1>Why not -->
<sect1>なぜストライピングしないのか
<p>
<!--
Striping without further measures raises your fault chance, on a 'per bit'
basis. If any of your disks dies, your entire Logical Volume is gone. If you
just concatenate data, only part of your filesystem is gone.
-->
ストライピングだけを行うと、「ビット単位」で破壊が起こる危険が出てきます。
ディスクが駄目になると、論理ボリュームの内容がおしゃかになってしまいます。
データを連続して置いてあれば、ファイルシステムの一部だけで済ませられます。

<!-- The ultimate option is the mirrored stripe.  -->
究極の手段は、ミラーリングした上でのストライピングです。

<!-- FIXME: make a mirrored stripe with LVM and md -->
FIXME: LVM と md を使って、ミラーリングした上でストライピングしてみる

<bf>訳註：</bf>md は、ソフトウエア RAID のデバイスです。
<url url="http://www.linux.or.jp/docs/Multi-Disk-HOWTO/Multi-Disk-HOWTO.html" 
name="Multi-Disk-HOWTO の日本語訳">を参考にしてください。
	
<!-- <sect1>LVM native striping -->
<sect1>LVM でのストライピング
<p>
<!--
Specifying stripe configuration is done when creating the Logical Volume
with lvcreate. There are two relevant parameters. With -i we tell LVM how
many Physical Volumes it should use to scatter on. Striping is not really
done on a bit-by-bit basis, but on blocks. With -I we can specify the
granulation in kilobytes. Note that this must be a power of 2, and that the
coarsest granulation is 128Kbyte.
-->
ストライプ構成の設定は、論理ボリュームの作成時に lvcreate を使って済ませます。
関連するパラメタは 2 つあります。-i でいくつの物理ボリュームに分散させるのか
を指定します。実はストライピングはビット単位ではなく、ブロック単位で行われ
ます。-I でキロバイト単位で増減の単位を指定をします。注意点は、指定するのが 
2 の累乗単位で、 最大 128 KB であることです。 

<!-- Example: -->
例です。
<tscreen><verb>
# lvcreate -n stripedlv -i 2 -I 64 mygroup -L 20M
lvcreate -- rounding 20480 KB to stripe boundary size 24576 KB / 6 PE
lvcreate -- doing automatic backup of "mygroup"
lvcreate -- logical volume "/dev/mygroup/stripedlv" successfully created
</verb></tscreen>

<!-- <sect2>Performance notices -->
<sect2>パフォーマンス上の注意点
<p>
<!--
The performance 'gain' may well be very negative if you stripe over 2 partitions
of the same disk - take care to prevent that. Striping with two disks on a
single IDE bus also appears useless - unless IDE has improved beyond what I
remember.
-->
同じディスクの 2 つのパーティション上でストライプすると、パフォーマンスが上る
どころかおそらく逆効果になってしまうでしょう。- くれぐれもそうしないように
してください。1 本の IDE バスに 2 つのディスクを接続してあってもやはり同じ
ことが言えます。- 私が知っている IDE より進化していなければ。

<!-- FIXME: is this still true?  -->
FIXME: これは今でも正しいのか？

<!--
Older motherboards may have two IDE buses, but the second one used to be
castrated, dedicated to serving a slow cdrom drive. You can perform
benchmarks with several tools, the most noteworthy being 'Bonnie'. The
ReiserFS people have released <url name="Bonnie++"
url="http://www.coker.com.au/bonnie++/"> which may be used to measure
performance data.
-->
古めのマザーボードには、2 本の IDE バスがあるかもしれませんが、2 本目は
使い物にならない場合が多く、実質は低速な CD-ROM ドライブを動かすのに使われ
ることになってしまいます。ツールを使ってベンチマークを取ることが可能で、
最も気になるツールは「Bonnie」です。ReiserFS の開発者たちは、
<url name="Bonnie++" url="http://www.coker.com.au/bonnie++/"> をリリース
していて、これでパフォーマンスのデータを計ってもいいかもしれません。

<!-- <sect1>Hardware RAID -->
<sect1>ハードウェア RAID
<p>
<!--
Many high end Intel x86 servers have Hardware RAID controlers. Most of
them have atleast 2 independant SCSI channels. Fortunatly, his has very
little bearing on LVM. Before Linux can see anything on such a controler
the administrator must define a Logical drive within the raid controler
itself. As an example [s]he could choose to stripe together two disks on
SCSI channel A and then mirror them onto two disks on channel B. This
is a typical RAID 0/1 configuration that maximises performance and
data security. When Linux boots on a machine with this configuration
it can only 'see' one disk on the RAID controler and that is the 
Logical drive that contains the four disks in the RAID 0/1 stripeset.
This means, as far as LVM is concerned, that there is just one disk
in the machine and it is to be used as such. If one of the disks 
fails, LVM wont even know. When the administrator replaces the disk
(even on the fly with HotSwap hardware) LVM wont know about that 
either and the controler will resync the mirrored data and all will
be well.
-->
ハイエンドなインテル x86 サーバーの多くには、ハードウェア RAID コントローラ
がついています。その内の大部分には、少なくとも 2 つの独立した SCSI チャネル
があります。幸いなことに LVM でそれ程苦労せずに利用できます。管理者は RAID 
コントローラ自身の機能を使って論理ドライブの構成を決めてから、Linux で RAID 
コントローラを通してディスクを認識させなければいけません。たとえば SCSI 
チャネル A 上の 2 つのディスクでストライプを行い、そのミラーを SCSI チャネル 
B 上の 2 つのディスク にしたとします。これは典型的な RAID 0/1 の構成で、
パフォーマンスとデータの安全性を最大限引出します。この構成のマシンで Linux 
をブートすると、RAID コントローラ上にある 1 つのディスク上にだけ、データ領域
があるように「見えます」。これこそが、 4 つのディスクで構成した RAID 0/1 の
論理ドライブなのです。
つまり LVM から見る限り、マシンはあたかもディスクを 1 つだけ備えていて、1 つ
のディスクを扱うように使用できます。ディスクの 1 つが壊れても、LVM はそれを
知るよしもありません。管理者がディスクを交換しても(ホットスワップ機構を使って、
稼働中に)、LVM はそれを検知しないだけでなく、コントローラはミラーされている
データを再同期させて、すべて元通りにします。
<!--
This is where most people take a step back and ask "Then what good
does LVM do for me with this RAID controler?"
The easy answer is, in most cases, after you define a logical
drive in the RAID controler you cant add more disks to that drive
later. So if you miscalculate the space requirements or you
simply need more space you cant add a new disk or set of disks
into a pre-exsisting stripeset. This means you must create a new
RAID stripset in the controler and then with LVM you can simply
extend the LVM Logical volume so that it seamlessly spans both
stripesets in the RAID controler.
-->
ここでたいていの方はちょっと考えてから、「RAID コントローラを LVM と併用する
と何がいいのだろう？」という疑問が湧きます。
簡潔に説明すると、次のような答えになります。RAID コントローラの元で論理
ドライブを決定してしまうと、そのドライブに対して後でディスクを追加することは
できなくなります。空きをどのくらい取るかの計算を間違ってしまったり、単にもう
少し空きが必要になった場合にも、新しいディスクがいくつであれ、既存のストライプ
構成には追加できません。つまりそのコントローラの元で、新しい RAID のストライプ
構成を作成しなければいけません。そこで LVM を使っていれば、ただ 
LVM の論理ボリュームを拡張すればいいだけなので、RAID コントローラの元で新旧
のストライプ構成をスムーズに拡張できます。

<!-- FIXME: Is there more needed on this subject ?  -->
FIXME: このテーマに追加することはあるか？

<!-- <sect1>Linux software RAID -->
<sect1>Linux のソフトウェア RAID
<p>
<!--
Linux 2.4 comes with very good RAID in place. Linux 2.2 by default, as
released by Alan Cox, features an earlier RAID version that's not well
regarded. The reason that 2.2 still features this earlier release is the the
kernel people don't want to make changes within a stable version that
require userland updates.
-->
Linux 2.4 にはとても素晴らしい RAID がきちんと使える状態でついてきます。
Linux 2.2 にはデフォルトで Alan Cox 氏がリリースした初期バージョンの RAID 
機能がついていますが、出来があまりよくありません。2.2 がまだこの初期のリリース
を採用している訳は、カーネルの開発者が Linux の安定版でユーザランドのアップ
デートをともなう変更を望まなかったためです。

<!--
Most people, which included Red Hat, Mandrake and SuSE, chose to replace it
with the 0.90 version which appears to be excellent. 
-->
Red Hat や Mandrake、SuSE をはじめとするディストリビュータの大部分は、素晴ら
しい出来になると思われるバージョン 0.90 に置き換えることを決めました。

<!-- We will only treat the 0.90 version here.  -->
ここではバージョン 0.90 だけをを扱うことにします。

<!-- FIXME: write more of this -->
FIXME: ここに更に書いてください。

<!-- <sect>Cookbook -->
<sect>詳しい解説
<p>
<!-- <sect1>Moving LVM disks between computers -->
<sect1>コンピュータ間で LVM のディスクを移動する
<p>
<!--
With all this new technology, simple tasks like moving disks from one machine
to another can get a bit tricky. Before LVM users only had to put the disk
into the new machine and mount the filesystems. With LVM there is a bit more
to it. The LVM structures are saved both on the disks and in the /etc/lvmconf
directory so the only thing that has to be done to move a disk or a set of
disks that contain a Volume Group is to make sure the machine that the
VG belonged to will not miss it.  That is accomplished with the <tt>vgexport</tt>
command. <tt>vgexport</tt> simply removes the structures for the VG from
/etc/lvmconf, but does not change anything on the disks. Once the disks are
in the new machine (they don't have to have the same ID's) the only thing
that has to be done is to update /etc/lvmconf. Thats done with <tt>vgimport</tt>.
-->
この新しい技術を利用すると、単純な作業、たとえばあるマシンから他のマシンに
ディスクを移すような作業が、やや手の混んだものになるかもしれません。LVM を
使用する以前であれば、やるべきことは、そのディスクを新しいマシンに取り付け
て、ファイルシステムをマウントすることだけでした。LVM を用いると少しやること
が増えます。LVM の構造は両方のディスク上と /etc/lvmconf に保存されています。
したがって唯一確認しなければいけないことは、ボリューム・グループが含まれている
ディスクがいくつあっても、ボリューム・グループが属することになるマシン上で
認識できるかということです。これを行うのが、<tt>vgexport</tt> コマンドです。
<tt>vgexport</tt> は単純に /etc/lvmconf にあるボリューム・グループの構成から
削除するだけですので、ディスク上では何も変更ありません。後は、ディスクを新しい
マシンに接続して(同じ ID であってはならない)、/etc/lvmconf をアップデートする
だけです。それは <tt>vgimport</tt> を使って行います。

<!--
Example:

On machine #1:
-->
例

マシン No 1 で、
<tscreen><verb>
vgchange -a n vg01
vgexport vg01
</verb></tscreen>
<!-- On machine #2: -->
マシン No 2 で、
<tscreen><verb>
vgimport vg01 /dev/sda1 /dev/sdb1
vgchange -a y vg01
</verb></tscreen>

<!--
Notice that you don't have to use the same name for the Volume Group. If the
vgimport command did not save a configuration backup use <tt>vgcfgbackup</tt>
to do it.
-->
注意すべき点は、同名のボリューム・グループを用いてはいけないということです。
もし vgimport コマンドが設定のバックアップを上げなければ、<tt>vgcfgbackup</tt> 
を使って上げてください。

<!-- <sect1>Rebuilding /etc/lvmtab and /etc/lvmtab.d -->
<sect1>/etc/lvmtab and /etc/lvmtab.d の再構成
<p>

<!-- FIXME: write about more neat stuff -->
FIXME: もっときちんとした内容を書く

<!-- <sect>Further reading -->
<sect>さらに詳しく
<p>
<descrip>
<tag><url name="LVM site" url="http://lvm.msede.com/lvm/"></tag>
<!-- The main LVM resource available -->
主要な LVM 関連リソースが利用できる
<tag><url name="German LVM HOWTO" url="http://litefaden.com/lite00/lvm/"></tag>
<!-- If you can read German, this already contains a lot of information -->
ドイツ語が読めるなら、既にたくさんの情報が記述してある
<tag><url name="Translation of the German HOWTO" url=
"ftp://linux.msede.com/lvm/howto/en/"></tag>
<!--
Peter.Wuestefeld@resnova.de is translating the German HOWTO into English. It
appears that they will soon be investing lots of time in it. If you doubt
our HOWTO or miss something, please try their effort. 
-->
Peter.Wuestefeld@resnova.de 氏は、ドイツ語の HOWTO を英語に翻訳中。もうすぐ
この HOWTO に多くの時間を割く模様。我々の HOWTO が疑わしかったり、間違って
いたりしたなら、参考にすることをお勧めする

<tag><url name="HP/UX Managing Disks Guide"
url="http://docs.hp.com/cgi-bin/omcgi/omdoc?action=getcon&amp;ID=7425"></tag>
<!--
Since the Linux LVM is almost an exact workalike of the HP/UX
implementation, their documentation is very useful to us as well. Very good
stuff.
-->
Linux の LVM は HP/UX の実装とほぼ間違いなく同様に機能するので、HP/UX の
ドキュメントがとても役に立つ。とても良い内容である。
</descrip>

<!-- <sect>Acknowledgements &amp; Thanks to -->
<sect>謝辞と感謝
<p>
<!--
We try to list everybody here who helped make this HOWTO. This includes
people who send in updates, fixes or contributions, but also people who
have aided our understanding of the subject.
-->
この HOWTO を書くのに当たって、助けていただいたすべての方々を記載しようと
心がけました。
アップデートや訂正、寄稿をしていただいた方々だけでなく、このテーマを我々が
理解できるように助言いただいた方々もあげさせていただきました。
<itemize>
<item> Axel Boldt &lt;axel@uni-paderborn.de&gt;</item>
<item> Sean Reifschneider &lt;jafo@tummy.com&gt;
<item> Alexander Talos &lt;at@atat.at&gt;
<item> Eric Maryniak &lt;e.maryniak@pobox.com&gt;
</itemize>
<sect>日本語版謝辞
<p>
この翻訳を行うに当たって、JF プロジェクトの武井さんよりアドバイスを
いただきました。この場を借りてお礼申し上げます。
</article>
