トップ 差分 一覧 ソース 検索 ヘルプ PDF RSS ログイン

lvm (Logical Volume Manager)

[カテゴリ:Linux]

概要

物理的な存在であるハードディスクのパーティションは、一度設定するとこれを変更するのは容易ではなく、OSの再インストールが必要となる。
Logical Volume Manager を使うことで、パーティションを動的に扱うことができる。
また、スナップショット機能を使うことでダウンタイムを最小限に抑えたバックアップができる。

  • メリット
    • パーティションを動的に扱うことができる。
    • スナップショット機能も付随している。
  • デメリット
    • OS→LVM→ファイルシステム(ext3,ReiserFS)となるので複雑化する。

debian etch で lvm

概要

  1. OSインストールしてから、
  2. lvm用パーティション作成&lvm構築

でやってみる。

debian etch インストール

CDイメージダウンロード

以下から入手した。

etch RC1:netinst CD イメージ
134,139,904 バイト
http://cdimage.debian.org/cdimage/etch_di_rc1/i386/iso-cd/debian-testing-i386-netinst.iso

SCSI1 (sda) 2.1GB
1.基本  131.6MB B ext3     /boot
5.論理  501.7MB   reiserfs /
  論理    1.4GB   空き領域
6.論理  131.6MB   スワップ

ベースシステムのみインストール

vi /etc/aptsource.list

deb http://ftp.jp.debian.org/debian/ etch main
deb-src http://ftp.jp.debian.org/debian/ etch main

deb http://security.debian.org/ etch/updates main
deb-src http://security.debian.org/ etch/updates main

apt-get update
apt-get install ssh

# ベータのときにはなかったのだけど
署名のチェックが行われるようになってる。
以下に情報あるけど。。。また後で読む・・・
http://kmuto.jp/d/index.cgi/debian/apt-secure.htm

apt-get install screen

vi ~/.screenrc

apt-get install sudo

visudo

:
Host_Alias LOCAL = 192.168.0.0/24
:
goun    LOCAL=(ALL) ALL

こんな感じ

goun@vm-etch2:~$ df -H
Filesystem             Size   Used  Avail Use% マウント位置
/dev/sda5              502M   308M   195M  62% /
udev                    11M    58k    11M   1% /dev
devshm                 265M      0   265M   0% /dev/shm
/dev/sda1              128M    17M   105M  14% /boot
goun@vm-etch2:~$ cat /proc/version
Linux version 2.6.17-2-686 (Debian 2.6.17-9) (waldi@debian.org) (gcc version 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)) #1 SMP Wed Sep 13 16:34:10 UTC 2006
goun@vm-etch2:~$ dpkg -l
要望=(U)不明/(I)インストール/(R)削除/(P)完全削除/(H)維持
| 状態=(N)無/(I)インストール済/(C)設定/(U)展開/(F)設定失敗/(H)半インストール
|/ エラー=(空欄)無/(H)維持/(R)要再インストール/X=両方(状態,エラーの大文字=異常)
||/ 名前         バージョ   説明
+++-==============-==============-============================================
ii  acpid          1.0.4-5        Utilities for using ACPI power management
ii  adduser        3.99           Add and remove users and groups
ii  apt            0.6.46.2       Advanced front-end for dpkg
ii  apt-utils      0.6.46.2       APT utility programs
ii  aptitude       0.4.3-1        terminal-based apt frontend
ii  base-files     4              Debian base system miscellaneous files
ii  base-passwd    3.5.11         Debian base system master password and group
ii  bash           3.1-5          The GNU Bourne Again SHell
ii  binutils       2.17-3         The GNU assembler, linker and binary utiliti
ii  bsdmainutils   6.1.4          collection of more utilities from FreeBSD
ii  bsdutils       2.12r-12       Basic utilities from 4.4BSD-Lite
ii  busybox        1.1.3-3        Tiny utilities for small and embedded system
ii  console-common 0.7.66         Basic infrastructure for text console config
ii  console-data   1.01-1         Keymaps, fonts, charset maps, fallback table
ii  console-tools  0.2.3dbs-65    Linux console and font utilities
ii  coreutils      5.97-5         The GNU core utilities
ii  cpio           2.6-17         GNU cpio -- a program to manage archives of
ii  cpp-4.1        4.1.1-19       The GNU C preprocessor
ii  cron           3.0pl1-99      management of regular background processing
ii  debconf        1.5.8          Debian configuration management system
ii  debconf-i18n   1.5.8          full internationalization support for debcon
ii  debian-archive 2006.01.18     GnuPG archive keys of the Debian archive
ii  debianutils    2.17           Miscellaneous utilities specific to Debian
ii  dhcp3-client   3.0.4-10       DHCP Client
ii  dhcp3-common   3.0.4-10       Common files used by all the dhcp3* packages
ii  diff           2.8.1-11       File comparison utilities
ii  dmidecode      2.8-2          Dump Desktop Management Interface data
ii  dpkg           1.13.22        package maintenance system for Debian
ii  dselect        1.13.22        user tool to manage Debian packages
ii  e2fslibs       1.39+1.40-WIP- ext2 filesystem libraries
ii  e2fsprogs      1.39+1.40-WIP- ext2 file system utilities and libraries
ii  ed             0.2-20         The classic unix line editor
ii  eject          2.1.4-2.1      ejects CDs and operates CD-Changers under Li
ii  findutils      4.2.28-1       utilities for finding files--find, xargs, an
ii  gcc-4.1        4.1.1-19       The GNU C compiler
ii  gcc-4.1-base   4.1.1-19       The GNU Compiler Collection (base package)
ii  gettext-base   0.14.6-1       GNU Internationalization utilities for the b
ii  gnupg          1.4.5-1        GNU privacy guard - a free PGP replacement
ii  grep           2.5.1.ds2-6    GNU grep, egrep and fgrep
ii  groff-base     1.18.1.1-12    GNU troff text-formatting system (base syste
ii  grub           0.97-18        GRand Unified Bootloader
ii  gzip           1.3.5-15       The GNU compression utility
ii  hostname       2.92           utility to set/show the host name or domain
ii  ifupdown       0.6.8          high level tools to configure network interf
ii  info           4.8.dfsg.1-3   Standalone GNU Info documentation browser
ii  initramfs-tool 0.85a          tools for generating an initramfs
ii  initscripts    2.86.ds1-20    Scripts for initializing and shutting down t
ii  installation-r 2.23           system installation report
ii  iptables       1.3.6.0debian1 administration tools for packet filtering an
ii  iputils-ping   20020927-3.1   Tools to test the reachability of network ho
ii  klibc-utils    1.4.27-1       small statically-linked utilities built with
ii  klogd          1.4.1-18       Kernel Logging Daemon
ii  laptop-detect  0.12.1         attempt to detect a laptop
ii  libacl1        2.2.41-1       Access control list shared library
ii  libapt-pkg-per 0.1.20         Perl interface to libapt-pkg
ii  libattr1       2.4.32-1       Extended attribute shared library
ii  libblkid1      1.39+1.40-WIP- block device id library
ii  libbz2-1.0     1.0.3-6        high-quality block-sorting file compressor l
ii  libc6          2.3.6.ds1-7    GNU C Library: Shared libraries
ii  libc6-i686     2.3.6.ds1-7    GNU C Library: Shared libraries [i686 optimi
ii  libcap1        1.10-14        support for getting/setting POSIX.1e capabil
ii  libcomerr2     1.39+1.40-WIP- common error description library
ii  libconfig-inif 2.39-2         Read .ini-style configuration files
ii  libconsole     0.2.3dbs-65    Shared libraries for Linux console and font
ii  libdb4.2       4.2.52+dfsg-1  Berkeley v4.2 Database Libraries [runtime]
ii  libdb4.3       4.3.29-6       Berkeley v4.3 Database Libraries [runtime]
ii  libdb4.4       4.4.20-8       Berkeley v4.4 Database Libraries [runtime]
ii  libdevmapper1. 1.02.08-1      The Linux Kernel Device Mapper userspace lib
ii  libedit2       2.9.cvs.200505 BSD editline and history libraries
ii  libgcc1        4.1.1-19       GCC support library
ii  libgcrypt11    1.2.3-2        LGPL Crypto library - runtime library
ii  libgdbm3       1.8.3-3        GNU dbm database routines (runtime version)
ii  libgnutls13    1.4.4-2        the GNU TLS library - runtime library
ii  libgpg-error0  1.4-1          library for common error values and messages
ii  libklibc       1.4.27-1       minimal libc subset for use with initramfs
ii  libkrb53       1.4.4-3        MIT Kerberos runtime libraries
ii  libldap-2.3-0  2.3.27-1       OpenLDAP libraries
ii  libldap2       2.1.30-13+b1   OpenLDAP libraries
ii  liblocale-gett 1.05-1         Using libc functions for internationalizatio
ii  liblzo1        1.08-3         data compression library (old version)
ii  liblzo2-2      2.02-2         data compression library
ii  libncurses5    5.5-5          Shared libraries for terminal handling
ii  libncursesw5   5.5-5          Shared libraries for terminal handling (wide
ii  libnewt0.52    0.52.2-8       Not Erik's Windowing Toolkit - text mode win
ii  libopencdk8    0.5.9-2        Open Crypto Development Kit (OpenCDK) (runti
ii  libpam-modules 0.79-4         Pluggable Authentication Modules for PAM
ii  libpam-runtime 0.79-4         Runtime support for the PAM library
ii  libpam0g       0.79-4         Pluggable Authentication Modules library
ii  libpopt0       1.10-3         lib for parsing cmdline parameters
ii  libreadline5   5.2-1          GNU readline and history libraries, run-time
ii  libsasl2       2.1.19.dfsg1-0 Authentication abstraction library
ii  libselinux1    1.32-3         SELinux shared libraries
ii  libsepol1      1.14-1         Security Enhanced Linux policy library for c
ii  libsigc++-1.2- 1.2.7-2        type-safe Signal Framework for C++ - runtime
ii  libsigc++-2.0- 2.0.17-2       type-safe Signal Framework for C++ - runtime
ii  libslang2      2.0.6-4        The S-Lang programming library - runtime ver
ii  libss2         1.39+1.40-WIP- command-line interface parsing library
ii  libssl0.9.8    0.9.8c-3       SSL shared libraries
ii  libssp0        4.1.1-19       GCC stack smashing protection library
ii  libstdc++6     4.1.1-19       The GNU Standard C++ Library v3
ii  libtasn1-3     0.3.6-2        Manage ASN.1 structures (runtime)
ii  libtasn1-3-bin 0.3.6-2        Manage ASN.1 structures (binaries)
ii  libtext-charwi 0.04-4         get display widths of characters on the term
ii  libtext-iconv- 1.4-3          converts between character sets in Perl
ii  libtext-wrapi1 0.06-5         internationalized substitute of Text::Wrap
ii  libusb-0.1-4   0.1.12-2       userspace USB programming library
ii  libuuid1       1.39+1.40-WIP- universally unique id library
ii  libvolume-id0  0.100-2.2      libvolume_id shared library
ii  libwrap0       7.6.dbs-11     Wietse Venema's TCP wrappers library
ii  linux-image-2. 2.6.17+2       Linux kernel 2.6 image on PPro/Celeron/PII/P
ii  linux-image-2. 2.6.17-9       Linux 2.6.17 image on PPro/Celeron/PII/PIII/
ii  locales        2.3.6.ds1-7    GNU C Library: National Language (locale) da
ii  localization-c 1.0~rc2        configures different programs' locale settin
ii  login          4.0.18.1-5     system login tools
ii  logrotate      3.7.1-3        Log rotation utility
ii  lsb-base       3.1-15         Linux Standard Base 3.1 init script function
ii  makedev        2.3.1-83       creates device files in /dev
ii  man-db         2.4.3-3        The on-line manual pager
ii  manpages       2.39-1         Manual pages about using a GNU/Linux system
ii  mawk           1.3.3-11       a pattern scanning and text processing langu
ii  mktemp         1.5-2          Makes unique filenames for temporary files
ii  module-init-to 3.2.2-3        tools for managing Linux kernel modules
ii  modutils       2.4.27.0-6     Linux module utilities
ii  mount          2.12r-12       Tools for mounting and manipulating filesyst
ii  nano           1.9.99pre3-1   free Pico clone with some new features
ii  ncurses-base   5.5-5          Descriptions of common terminal types
ii  ncurses-bin    5.5-5          Terminal-related programs and man pages
ii  net-tools      1.60-17        The NET-3 networking toolkit
ii  netbase        4.27           Basic TCP/IP networking system
ii  netcat         1.10-32        TCP/IP swiss army knife
ii  openbsd-inetd  0.20050402-3   The OpenBSD Internet Superserver
ii  openssh-client 4.3p2-8        Secure shell client, an rlogin/rsh/rcp repla
ii  openssh-server 4.3p2-8        Secure shell server, an rshd replacement
ii  passwd         4.0.18.1-5     change and administer password and group dat
ii  perl-base      5.8.8-6.1      The Pathologically Eclectic Rubbish Lister
ii  procps         3.2.7-3        /proc file system utilities
ii  readline-commo 5.2-1          GNU readline and history libraries, common f
ii  reiserfsprogs  3.6.19-4       User-level tools for ReiserFS filesystems
ii  screen         4.0.3-0.2      a terminal multiplexor with VT100/ANSI termi
ii  sed            4.1.5-1        The GNU sed stream editor
ii  ssh            4.3p2-8        Secure shell client and server (transitional
ii  sudo           1.6.8p12-4     Provide limited super user privileges to spe
ii  sysklogd       1.4.1-18       System Logging Daemon
ii  sysv-rc        2.86.ds1-20    System-V-like runlevel change mechanism
ii  sysvinit       2.86.ds1-20    System-V-like init utilities
ii  tar            1.16-1         GNU tar
ii  tasksel        2.56           Tool for selecting tasks for installation on
ii  tasksel-data   2.56           Official tasks used for installation of Debi
ii  tcpd           7.6.dbs-11     Wietse Venema's TCP wrapper utilities
ii  traceroute     1.4a12-20      traces the route taken by packets over a TCP
ii  tzdata         2006l-1        Time Zone and Daylight Saving Time Data
ii  udev           0.100-2.2      /dev/ and hotplug management daemon
ii  unifont        1.0-3          X11 dual-width GNU Unicode font
ii  update-inetd   4.27           inetd.conf updater
ii  usbutils       0.72-7         USB console utilities
ii  util-linux     2.12r-12       Miscellaneous system utilities
ii  vim-common     7.0-122+1      Vi IMproved - Common files
ii  vim-tiny       7.0-122+1      Vi IMproved - enhanced vi editor - compact v
ii  wget           1.10.2-2       retrieves files from the web
ii  whiptail       0.52.2-8       Displays user-friendly dialog boxes from she
ii  zlib1g         1.2.3-13       compression library - runtime

lvm2 インストール から LVフォーマット、マウントまで

インストール

lvm2パッケージをインストールする。

goun@vm-etch2:~$ sudo apt-cache show lvm2
Package: lvm2
Priority: optional
Section: admin
Installed-Size: 844
Maintainer: Debian LVM Team <pkg-lvm-maintainers@lists.alioth.debian.org>
Architecture: i386
Version: 2.02.06-3
Provides: lvm-binaries
Depends: libc6 (>= 2.3.6-6), libdevmapper1.02 (>= 2:1.02.02-2), libncurses5 (>= 5.4-5), libreadline5 (>= 5.1), libselinux1 (>= 1.30.28), libsepol1 (>= 1.12.26), lvm-common (>> 1.5.8)
Pre-Depends: debconf (>= 1.4.69) | debconf-2.0
Suggests: dmsetup
Filename: pool/main/l/lvm2/lvm2_2.02.06-3_i386.deb
Size: 309988
MD5sum: fb7f8cffca3e85655f3764a4fbdfa9aa
SHA1: 881d7ce2cb2004e7d7406904418448ecd67d4952
SHA256: f0ca6d93684336aea47452892970964e4bdfd7f08c59401bc8e987a2654503ea
Description: The Linux Logical Volume Manager
This is LVM2, the rewrite of The Linux Logical Volume Manager.  LVM
supports enterprise level volume management of disk and disk subsystems
by grouping arbitrary disks into volume groups. The total capacity of
volume groups can be allocated to logical volumes, which are accessed as
regular block devices.
Tag: admin::filesystem, interface::commandline, role::program, scope::utility, uitoolkit::ncurses

goun@vm-etch2:~$
goun@vm-etch2:~$ sudo apt-get install lvm2

新規パーティション /dev/sda6, /dev/sda7 を作る。

現状

/dev/sda
  /dev/sda1 --- /boot
  /dev/sda5 --- /

LVMパーティション追加後

/dev/sda
  /dev/sda1 --- /boot
  /dev/sda5 --- /
  /dev/sda6 --- 
  /dev/sda7 --- 

/sbin/fdisk 又は /sbin/cfdisk で、
パーティション /dev/sda6, /dev/sda7 を追加する。

                                 cfdisk 2.12r
                             Disk Drive: /dev/sda
                       Size: 2147483648 bytes, 2147 MB
             Heads: 255   Sectors per Track: 63   Cylinders: 261
   Name        Flags      Part Type  FS Type          [Label]        Size (MB)
------------------------------------------------------------------------------
   sda1        Boot        Primary   Linux ext3                         131.61
   sda5                    Logical   Linux ReiserFS                     501.75
   sda6                    Logical   Linux LVM                          501.75
   sda7                    Logical   Linux LVM                          501.75
                           Logical   Free Space                         378.37
   sda8                    Logical   Linux swap / Solaris               131.61

パーティション情報を書き込むと、カーネルが古いパーティション情報を使っていると警告される。

↓ってことでリブート

goun@vm-etch2:~$ sudo shutdown -r now

/dev/sda6, /dev/sda7 を PV(物理ボリューム) とする。

意味としては、
パーティション /dev/sda6, /dev/sda7 を LVM用として使う」
という指示を出します。

↓pvcreate する。

goun@vm-etch2:~$ sudo pvcreate /dev/sda6
 Physical volume "/dev/sda6" successfully created
goun@vm-etch2:~$ sudo pvcreate /dev/sda7
 Physical volume "/dev/sda7" successfully created

↓確認する。

goun@vm-etch2:~$ sudo pvscan
 PV /dev/sda6         lvm2 [478.28 MB]
 PV /dev/sda7         lvm2 [478.28 MB]
 Total: 2 [956.56 MB] / in use: 0 [0   ] / in no VG: 2 [956.56 MB]

/dev/sda6, /dev/sda7 が PV として認識されるようになっているのでおっけー

/dev/sda6, /dev/sda7 を VG(ボリュームグループ) とする。

意味としては、
「/dev/sda6, /dev/sda7 を 1つのVG として使う」
という指示を出します。
(物理パーティションを束ねて、論理パーティションを作る)

↓vgcreate する。

goun@vm-etch2:~$ sudo vgcreate Vg01 /dev/sda6 /dev/sda7
 Volume group "Vg01" successfully created

↓確認する。

goun@vm-etch2:~$ sudo vgscan
 Reading all physical volumes.  This may take a while...
 Found volume group "Vg01" using metadata type lvm2

これでは、束ねられたということが分からないので・・・

↓違う方法でも確認してみる。

goun@vm-etch2:~$ sudo pvscan
 PV /dev/sda6   VG Vg01   lvm2 [476.00 MB / 476.00 MB free]
 PV /dev/sda7   VG Vg01   lvm2 [476.00 MB / 476.00 MB free]
 Total: 2 [952.00 MB] / in use: 2 [952.00 MB] / in no VG: 0 [0   ]

PV(/dev/sda6, /dev/sda7) が束ねられて、1つのVG(Vg01) になってるのでおっけー

Vg01 を LV(論理ボリューム) に割り当てる。

↓Vg01 のうち 100M を Lv01 に割り当て。
↓Vg01 のうち 200M を Lv02 に割り当て。
↓Vg01 のうち 500M を Lv03 に割り当て。

goun@vm-etch2:/$ sudo lvcreate -L 100M -n Lv01 Vg01
 Logical volume "Lv01" created
goun@vm-etch2:/$ sudo lvcreate -L 200M -n Lv02 Vg01
 Logical volume "Lv02" created
goun@vm-etch2:/$ sudo lvcreate -L 500M -n Lv03 Vg01
 Logical volume "Lv03" created

↓確認する。

goun@vm-etch2:/$ sudo lvscan
 ACTIVE            '/dev/Vg01/Lv01' [100.00 MB] inherit
 ACTIVE            '/dev/Vg01/Lv02' [200.00 MB] inherit
 ACTIVE            '/dev/Vg01/Lv03' [500.00 MB] inherit

できてるのでおっけー

↓別の方法でも確認してみる。

goun@vm-etch2:/$ sudo pvscan
 PV /dev/sda6   VG Vg01   lvm2 [476.00 MB / 0    free]
 PV /dev/sda7   VG Vg01   lvm2 [476.00 MB / 152.00 MB free]
 Total: 2 [952.00 MB] / in use: 2 [952.00 MB] / in no VG: 0 [0   ]

/dev/sda6 は使い切ってるということが分かる。

作ったLVのデバイスを確認

goun@vm-etch2:~$ sudo ls -al /dev/Vg01/
合計 0
drwx------  2 root root   100 2007-02-09 11:03 .
drwxr-xr-x 15 root root 13600 2007-02-09 11:03 ..
lrwxrwxrwx  1 root root    21 2007-02-09 11:03 Lv01 -> /dev/mapper/Vg01-Lv01
lrwxrwxrwx  1 root root    21 2007-02-09 11:03 Lv02 -> /dev/mapper/Vg01-Lv02
lrwxrwxrwx  1 root root    21 2007-02-09 11:03 Lv03 -> /dev/mapper/Vg01-Lv03

ここまでに作った PV,VG,LV を確認

goun@vm-etch2:/$ sudo pvscan
 PV /dev/sda6   VG Vg01   lvm2 [476.00 MB / 0    free]
 PV /dev/sda7   VG Vg01   lvm2 [476.00 MB / 152.00 MB free]
 Total: 2 [952.00 MB] / in use: 2 [952.00 MB] / in no VG: 0 [0   ]
goun@vm-etch2:/$ sudo vgscan
 Reading all physical volumes.  This may take a while...
 Found volume group "Vg01" using metadata type lvm2
goun@vm-etch2:/$ sudo lvscan
 ACTIVE            '/dev/Vg01/Lv01' [100.00 MB] inherit
 ACTIVE            '/dev/Vg01/Lv02' [200.00 MB] inherit
 ACTIVE            '/dev/Vg01/Lv03' [500.00 MB] inherit
goun@vm-etch2:/$ sudo pvdisplay
 --- Physical volume ---
 PV Name               /dev/sda6
 VG Name               Vg01
 PV Size               476.00 MB / not usable 0
 Allocatable           yes (but full)
 PE Size (KByte)       4096
 Total PE              119
 Free PE               0
 Allocated PE          119
 PV UUID               RQiPx4-xTXx-Lq1o-ubfh-veRy-FUPT-QVU0C8
 --- Physical volume ---
 PV Name               /dev/sda7
 VG Name               Vg01
 PV Size               476.00 MB / not usable 0
 Allocatable           yes
 PE Size (KByte)       4096
 Total PE              119
 Free PE               38
 Allocated PE          81
 PV UUID               7imIxj-gvzp-7o8z-YCrM-SbnS-npvH-lZ7z9E
goun@vm-etch2:/$ sudo vgdisplay
 --- Volume group ---
 VG Name               Vg01
 System ID
 Format                lvm2
 Metadata Areas        2
 Metadata Sequence No  16
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                3
 Open LV               0
 Max PV                0
 Cur PV                2
 Act PV                2
 VG Size               952.00 MB
 PE Size               4.00 MB
 Total PE              238
 Alloc PE / Size       200 / 800.00 MB
 Free  PE / Size       38 / 152.00 MB
 VG UUID               nnHQwW-QtDI-SHMN-SwtB-GlI7-iyDo-PNaNf4
goun@vm-etch2:/$ sudo lvdisplay
 --- Logical volume ---
 LV Name                /dev/Vg01/Lv01
 VG Name                Vg01
 LV UUID                oEEM1C-FPG5-k9YK-uzyx-HAAz-56T5-f7OQf4
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                100.00 MB
 Current LE             25
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           254:0
 --- Logical volume ---
 LV Name                /dev/Vg01/Lv02
 VG Name                Vg01
 LV UUID                0ZUv8q-VzSc-oZO3-fDAR-6HB2-3yJv-DmUASc
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                200.00 MB
 Current LE             50
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           254:1
 --- Logical volume ---
 LV Name                /dev/Vg01/Lv03
 VG Name                Vg01
 LV UUID                BHcNQk-mcAw-BoLO-RDzW-eNjm-b8tm-ZphJaf
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                500.00 MB
 Current LE             125
 Segments               2
 Allocation             inherit
 Read ahead sectors     0
 Block device           254:2

LVのフォーマット

goun@vm-etch2:~$ sudo mkfs.reiserfs -f /dev/Vg01/Lv01
mkfs.reiserfs 3.6.19 (2003 www.namesys.com)

A pair of credits:
Alexander Zarochentcev  (zam)  wrote the high low priority locking code, online
resizer for V3 and V4, online repacker for V4, block allocation code, and major
parts of  the flush code,  and maintains the transaction manager code.  We give
him the stuff  that we know will be hard to debug,  or needs to be very cleanly
structured.

Elena Gryaznova performed testing and benchmarking.


Guessing about desired format.. Kernel 2.6.17-2-686 is running.
Format 3.6 with standard journal
Count of blocks on the device: 25600
Number of blocks consumed by mkreiserfs formatting process: 8212
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: 1daca563-c802-4f85-ae0f-ca55e114f79d
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/Vg01/Lv01.
goun@vm-etch2:~$ sudo mkfs.reiserfs -f /dev/Vg01/Lv02
:
goun@vm-etch2:~$ sudo mkfs.reiserfs -f /dev/Vg01/Lv03
:
goun@vm-etch2:~$ sudo mount /dev/Vg01/Lv01 /mnt
goun@vm-etch2:~$
goun@vm-etch2:~$ cd /mnt
goun@vm-etch2:/mnt$ ls -al
合計 1
drwxr-xr-x  4 root root  80 2007-02-09 11:28 .
drwxr-xr-x 22 root root 592 2007-02-09 09:53 ..

ここまでのまとめ。

PV            VG       LV               
+---------+   +----+   +--------------+
|/dev/sda6|===|Vg01|===|/dev/Vg01/Lv01| --- /var とか
|         |   |    |   +--------------+
+---------+   |    |===|/dev/Vg01/Lv02| --- /home とか
|/dev/sda7|===|    |   +--------------+
|         |   |    |===|/dev/Vg01/Lv03| --- /usr とか
+---------+   +----+   +--------------+

PV:fdisk or cfdisk と pvcreate で作る。
VG:vgcreate で作る。
LV:lvcreate で作る。

ハードディスクのパーティション(物理的なもの)を、
PV,VGという概念を用いて仮想ハードディスクに束ねなおして、
LVで仮想パーティションに再分割する。

仮想化することで、VG増減、LV増減 が行えるようになる。

やり残し・・・

VG増減、LV増減
スナップショット

debian etch で lvm (インストーラからのlvm作成)

概要

  • Etchインストーラからlvmでインストールする。
  • HDD全てをlvmで使うようインストーラに指示する。
  • 以上でどんなlvm環境になるか調べる。

Etchインストーラ

パーティショニング

  1. ガイドによるパーティショニング
  2. ガイド−ディスク全体を使いLVMをセットアップする
  3. すべてのファイルを1つのパーティションに(初心者ユーザには推奨)

/dev/sda を丸ごと使う。
では、インストールされたlvm環境を調べてみよう。

fdisk /dev/sda

goun@DebianEtch2:~$ sudo fdisk /dev/sda

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          31      248976   83  Linux
/dev/sda2              32         261     1847475    5  Extended
/dev/sda5              32         261     1847443+  8e  Linux LVM

Command (m for help): q

goun@DebianEtch2:~$

df -HT

全部lvmかと思ったら、
さすがに /boot は、/dev/sda1、ext3

goun@DebianEtch2:~$ df -HT
Filesystem    Type     Size   Used  Avail Use% マウント位置
/dev/mapper/DebianEtch2-root
              ext3     1.8G   331M   1.4G  21% /
udev         tmpfs      11M    54k    11M   1% /dev
devshm       tmpfs     199M      0   199M   0% /dev/shm
/dev/sda1     ext3     247M    14M   221M   6% /boot
goun@DebianEtch2:~$

/etc/fstab

goun@DebianEtch2:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/mapper/DebianEtch2-root /               ext3    defaults,errors=remount-ro 0       1
/dev/sda1       /boot           ext3    defaults        0       2
/dev/mapper/DebianEtch2-swap_1 none            swap    sw              0       0
/dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0

goun@DebianEtch2:~$

ls -al /dev/mapper/

goun@DebianEtch2:~$ sudo ls -al /dev/mapper/
合計 0
drwxr-xr-x  2 root root     100 2007-02-21 08:56 .
drwxr-xr-x 15 root root   13540 2007-02-21 08:56 ..
brw-rw----  1 root disk 254,  0 2007-02-21 08:56 DebianEtch2-root
brw-rw----  1 root disk 254,  1 2007-02-21 08:56 DebianEtch2-swap_1
crw-rw----  1 root root  10, 63 2007-02-21 08:56 control
goun@DebianEtch2:~$

ls -al /dev/DebianEtch2/

/dev/ホスト名/
でlvmが作られている。

goun@DebianEtch2:~$ sudo ls -al /dev/DebianEtch2/
合計 0
drwx------  2 root root    80 2007-02-21 08:56 .
drwxr-xr-x 15 root root 13540 2007-02-21 08:56 ..
lrwxrwxrwx  1 root root    28 2007-02-21 08:56 root -> /dev/mapper/DebianEtch2-root
lrwxrwxrwx  1 root root    30 2007-02-21 08:56 swap_1 -> /dev/mapper/DebianEtch2-swap_1
goun@DebianEtch2:~$

/etc/lvm* あたり

goun@DebianEtch2:~$ sudo ls -al /etc/lvm*
-rw-r--r-- 1 root root    0 2007-02-21 08:54 /etc/lvmtab

/etc/lvm:
合計 32
drwxr-xr-x  3 root root  4096 2007-02-21 08:54 .
drwxr-xr-x 45 root root  4096 2007-02-21 09:06 ..
-rw-------  1 root root   676 2007-02-21 08:56 .cache
drwx------  2 root root  4096 2007-02-21 08:54 backup
-rw-r--r--  1 root root 13771 2006-10-15 21:14 lvm.conf
goun@DebianEtch2:~$
goun@DebianEtch2:~$ sudo ls -al /etc/lvm/backup/
合計 12
drwx------ 2 root root 4096 2007-02-21 08:54 .
drwxr-xr-x 3 root root 4096 2007-02-21 08:54 ..
-rw------- 1 root root 1316 2007-02-21 08:54 DebianEtch2
goun@DebianEtch2:~$

cat /etc/lvmtab

goun@DebianEtch2:~$ cat /etc/lvmtab
goun@DebianEtch2:~$

cat /etc/lvm/lvm.conf

goun@DebianEtch2:~$ cat /etc/lvm/lvm.conf
# 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.


# 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" ]

    # 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 any name matches any 'a'
    # pattern, the device is accepted; otherwise if any name matches any 'r'
    # pattern 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/.*/" ]

    # 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 file is hidden in the /etc/lvm directory.
    # It is safe to delete this file: the tools regenerate it.
    cache = "/etc/lvm/.cache"

    # 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 components of
    # software RAID (md) devices by looking for md superblocks.
    # 1 enables; 0 disables.
    md_component_detection = 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

    # 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
}

# 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

    # 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 "lvm1" if compiled in, else "lvm2".
    # format = "lvm1"

    # Location of proc filesystem
    proc = "/proc"

    # Type of locking to use. Defaults to file-based locking (1).
    # Turn locking off by setting to 0 (dangerous: risks metadata corruption
    # if LVM2 commands get run concurrently).
    locking_type = 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"

    # 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/lvm2"

    # Enable these three for cluster LVM when clvmd is running.
    # Remember to remove the "locking_type = 1" above.
    #
    #   locking_library = "liblvm2clusterlock.so"
    #   locking_type = 2
    #   library_dir = "/lib/lvm2"
}

activation {
    # Device used in place of missing stripes if activating incomplete volume.
    # For now, you need to set this up yourself first (e.g. with 'dmsetup')
    # For example, you could make it return I/O errors using the 'error'
    # target or make it return zeros.
    missing_stripe_filler = "/dev/ioerror"

    # How much stack (in KB) to reserve for use while devices suspended
    reserved_stack = 256

    # 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
    #
    # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]

    # Permissions to use for new devices
    # device_permissions = [ 0, 6, 0660 ]

    # Size (in KB) of each copy operation when mirroring
    mirror_region_size = 512

    # 'mirror_image_fault_policy' and 'mirror_log_fault_policy' define
    # how a device failure affecting a mirror 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:
    #
    # "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.
    #            Currently this is not implemented properly and behaves
    #            similarly to:
    #
    # "allocate_anywhere" - Operates like "allocate", but it does not
    #            require that the new space being allocated be on a
    #            device is not part of the mirror.  For a log device
    #            failure, this could mean that the log is allocated on
    #            the same device as a mirror device.  For a mirror
    #            device, this could mean that the mirror device is
    #            allocated on the same device as another mirror device.
    #            This policy would not be wise for mirror devices
    #            because 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_device_fault_policy = "remove"
}


####################
# 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

    # 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.
    #
    # mirror_library = "libdevmapper-event-lvm2mirror.so"
#}

goun@DebianEtch2:~$

cat /etc/lvm/backup/DebianEtch2

ここがlvm設定の本丸っぽい

goun@DebianEtch2:~$ sudo cat /etc/lvm/backup/DebianEtch2
# Generated by LVM2: Tue Feb 20 23:54:07 2007

contents = "Text Format Volume Group"
version = 1

description = "Created *after* executing '/sbin/vgcfgbackup'"

creation_host = "DebianEtch2"   # Linux DebianEtch2 2.6.17-2-486 #1 Wed Sep 13 15:56:30 UTC 2006 i686
creation_time = 1172015647      # Tue Feb 20 23:54:07 2007

DebianEtch2 {
        id = "Ik13L9-STrk-BvtN-sVT5-ThcZ-rPES-f6z5rF"
        seqno = 3
        status = ["RESIZEABLE", "READ", "WRITE"]
        extent_size = 8192        # 4 Megabytes
        max_lv = 0
        max_pv = 0

        physical_volumes {

             pv0 {
                id = "Pndsb2-uvbP-Oud8-8REA-UKlu-MGh3-zB8hu3"
                device = "/dev/sda5"  # Hint only

                status = ["ALLOCATABLE"]
                pe_start = 384
                pe_count = 450  # 1.75781 Gigabytes
             }
        }

        logical_volumes {

             root {
                id = "r47sGl-DU0t-2Gwk-oQxT-7RFO-t9iB-xZ9cgw"
                status = ["READ", "WRITE", "VISIBLE"]
                segment_count = 1

                segment1 {
                        start_extent = 0
                        extent_count = 422  # 1.64844 Gigabytes

                        type = "striped"
                        stripe_count = 1    # linear

                        stripes = [
                                "pv0", 0
                        ]
                }
             }

             swap_1 {
                id = "I04eT8-yY0T-BDho-oJWx-jvFe-1RSQ-Znj27V"
                status = ["READ", "WRITE", "VISIBLE"]
                segment_count = 1

                segment1 {
                        start_extent = 0
                        extent_count = 28   # 112 Megabytes

                        type = "striped"
                        stripe_count = 1    # linear

                        stripes = [
                                "pv0", 422
                        ]
                }
             }
        }
}
goun@DebianEtch2:~$

cat /boot/grub/menu.lst

goun@DebianEtch2:~$ cat /boot/grub/menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.
:

title        Debian GNU/Linux, kernel 2.6.17-2-686
root         (hd0,0)
kernel       /vmlinuz-2.6.17-2-686 root=/dev/mapper/DebianEtch2-root ro
initrd       /initrd.img-2.6.17-2-686
savedefault

title        Debian GNU/Linux, kernel 2.6.17-2-686 (single-user mode)
root         (hd0,0)
kernel       /vmlinuz-2.6.17-2-686 root=/dev/mapper/DebianEtch2-root ro single
initrd       /initrd.img-2.6.17-2-686
savedefault

### END DEBIAN AUTOMAGIC KERNELS LIST
goun@DebianEtch2:~$

lvm の pv, vg, lv

pvscan, vgscan, lvscan

goun@DebianEtch2:~$ sudo pvscan
  PV /dev/sda5   VG DebianEtch2   lvm2 [1.76 GB / 0    free]
  Total: 1 [1.76 GB] / in use: 1 [1.76 GB] / in no VG: 0 [0   ]
goun@DebianEtch2:~$ sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "DebianEtch2" using metadata type lvm2
goun@DebianEtch2:~$ sudo lvscan
  ACTIVE            '/dev/DebianEtch2/root' [1.65 GB] inherit
  ACTIVE            '/dev/DebianEtch2/swap_1' [112.00 MB] inherit
goun@DebianEtch2:~$

pvdisplay, vgdisplay, lvdisplay

goun@DebianEtch2:~$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               DebianEtch2
  PV Size               1.76 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              450
  Free PE               0
  Allocated PE          450
  PV UUID               Pndsb2-uvbP-Oud8-8REA-UKlu-MGh3-zB8hu3

goun@DebianEtch2:~$
goun@DebianEtch2:~$ sudo vgdisplay
  --- Volume group ---
  VG Name               DebianEtch2
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.76 GB
  PE Size               4.00 MB
  Total PE              450
  Alloc PE / Size       450 / 1.76 GB
  Free  PE / Size       0 / 0
  VG UUID               Ik13L9-STrk-BvtN-sVT5-ThcZ-rPES-f6z5rF

goun@DebianEtch2:~$
goun@DebianEtch2:~$ sudo lvdisplay
  --- Logical volume ---
  LV Name                /dev/DebianEtch2/root
  VG Name                DebianEtch2
  LV UUID                r47sGl-DU0t-2Gwk-oQxT-7RFO-t9iB-xZ9cgw
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.65 GB
  Current LE             422
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:0

  --- Logical volume ---
  LV Name                /dev/DebianEtch2/swap_1
  VG Name                DebianEtch2
  LV UUID                I04eT8-yY0T-BDho-oJWx-jvFe-1RSQ-Znj27V
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                112.00 MB
  Current LE             28
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:1

goun@DebianEtch2:~$

ここまでのまとめ。

etchインストーラから /dev/sda を「ガイド−ディスク全体を使いLVMをセットアップする」としたとき。

  • /dev/sda1 に /boot(ext3) が作られる。
  • VG名は、ホスト名 で作られる。

物理パーティション

/dev/sda1 Linux      /boot(ext3)
/dev/sda5 Linux-LVM

LVM

PV            VG              LV               
+---------+   +-----------+   +-----------------------+
|/dev/sda5|===|DebianEtch2|===|/dev/DebianEtch2/root  | --- / へ マウント
|         |   |           |   +-----------------------+
|         |   |           |===|/dev/DebianEtch2/swap_1|
+---------+   +-----------+   +-----------------------+

最終更新時間:2007年02月21日 09時24分48秒