LVMでMirror

ソフトウェアRAIDもメンドイな。と思ったので、LVMのMirrorに挑戦。

# lvcreate -m1 -L10G vg はできない。

Not enough PVs with free space available for parallel allocation.
Consider --alloc anywhere if desperate.

とかいわれる。

でも、# lvcreate -m1 -L10G --alloc anywhere vg とやったらやったで、

Insufficient suitable allocatable extents for logical volume : 5120 more required

とかいわれる。

解決方法

# lvcreate -m0 -L10G vg                          ---(A)
# lvconvert -m1 --alloc anywhere /dev/vg/lvol1    ---(B)

成功(?)

(A)の時点でのPhysical Volume状態

--- Physical volumes ---
PV Name               /dev/hde1
PV UUID               VDCbqp-oWz7-ffD8-abb2-kM2y-Asdq-B3XLyG
PV Status             allocatable
Total PE / Free PE    76310 / 73750

PV Name               /dev/hdg1
PV UUID               P1eNlY-nZzW-T0js-36uU-ZDH7-iZS1-WHowz1
PV Status             allocatable
Total PE / Free PE    76310 / 76310

(B)の時点でのPhysical Volume状態

--- Physical volumes ---
PV Name               /dev/hde1
PV UUID               VDCbqp-oWz7-ffD8-abb2-kM2y-Asdq-B3XLyG
PV Status             allocatable
Total PE / Free PE    76310 / 73749

PV Name               /dev/hdg1
PV UUID               P1eNlY-nZzW-T0js-36uU-ZDH7-iZS1-WHowz1
PV Status             allocatable
Total PE / Free PE    76310 / 73750

ミラーはされてるようだ。。。

vgdisplayの結果

# vgdisplay -v
  Finding all volume groups
  Finding volume group "vg"
--- Volume group ---
  VG Name               vg
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  17
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               596.17 GB
  PE Size               4.00 MB
  Total PE              152620
  Alloc PE / Size       5121 / 20.00 GB
  Free  PE / Size       147499 / 576.17 GB
  VG UUID               Hvv743-wyL4-FnqB-yXA9-rmHa-DZ4A-AwxVJz

--- Logical volume ---
  LV Name                /dev/vg/lvol0
  VG Name                vg
  LV UUID                DtpLWw-rcDR-UEBy-j0EO-IpGq-86KN-I71m6B
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                10.00 GB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

--- Logical volume ---
  LV Name                /dev/vg/lvol0_mlog
  VG Name                vg
  LV UUID                q7OZ1E-0ZVC-Nfg1-VpQs-nU1K-LLa9-Tvr8CJ
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                4.00 MB
  Current LE             1
  Segments               1
  Allocation             anywhere
  Read ahead sectors     0
  Block device           253:1

--- Logical volume ---
  LV Name                /dev/vg/lvol0_mimage_0
  VG Name                vg
  LV UUID                zXHu0W-24XH-SW7j-wYUQ-DtgP-v3HP-tEfzZ2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.00 GB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:2

--- Logical volume ---
  LV Name                /dev/vg/lvol0_mimage_1
  VG Name                vg
  LV UUID                QqgXbr-dzD5-7Lf7-2vc2-avpd-PVxH-oOtMqc
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.00 GB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:3

--- Physical volumes ---
  PV Name               /dev/hde1
  PV UUID               VDCbqp-oWz7-ffD8-abb2-kM2y-Asdq-B3XLyG
  PV Status             allocatable
  Total PE / Free PE    76310 / 73749

  PV Name               /dev/hdg1
  PV UUID               P1eNlY-nZzW-T0js-36uU-ZDH7-iZS1-WHowz1
  PV Status             allocatable
  Total PE / Free PE    76310 / 73750

システム情報

# lvm version
  LVM version:     2.02.28 (2007-08-24)
  Library version:  1.02.22 (2007-08-21)
  Driver version:   4.11.0
# uname -a
Linux localhost 2.6.23-gentoo-r9 #7 SMP Wed Mar 19 01:06:44 Local time zone must be set--see zic i686 Intel(R) Pentium(R) 4 CPU 2.60GHz GenuineIntel GNU/Linux