既存のLVMにHDDを追加する方法



・現状の状態を確認してみよう!

# df -h
Filesystem          サイズ  使用  残り 使用% マウント位置
/dev/mapper/VolGroup00-LogVol01
                      141G  2.1G  132G   2% /
/dev/cciss/c0d0p1      99M   18M   77M  19% /boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm


# pvdisplay -C
  PV                VG         Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p2 VolGroup00 lvm2 a-   148.91G    0


# vgdisplay -C
  VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   2   0 wz--n- 148.91G    0


・新しく追加したHDD(RAID1)の確認

# dmesg
~ 略 ~

 cciss/c0d1: unknown partition table
      blocks= 175815360 block_size= 512
      heads= 255, sectors= 32, cylinders= 21546

      blocks= 175815360 block_size= 512
      heads= 255, sectors= 32, cylinders= 21546

 cciss/c0d1: unknown partition table


※これを見ると/dev/cciss/c0d1が新しいパーティションとなる

・PVを作成する
<code> # pvcreate /dev/cciss/c0d1 Physical volume ”/dev/cciss/c0d1” successfully created </code>
・確認する <code> # pvdisplay — Physical volume — PV Name /dev/cciss/c0d0p2 VG Name VolGroup00 PV Size 148.91 GB / not usable 4.15 MB Allocatable yes (but full) PE Size (KByte) 32768 Total PE 4765 Free PE 0 Allocated PE 4765 PV UUID dK0Ziw-wK4Q-SU4X-h32L-Ltqf-pi51-EVf57c ”/dev/cciss/c0d1” is a new physical volume of “83.84 GB” — NEW Physical volume — PV Name /dev/cciss/c0d1 VG Name PV Size 83.84 GB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID uAhBla-NdGP-LXrz-L1Mi-ykzu-F02f-eJ3zUc </code>

<code> # pvdisplay -C PV VG Fmt Attr PSize PFree /dev/cciss/c0d0p2 VolGroup00 lvm2 a- 148.91G 0 /dev/cciss/c0d1 lvm2 – 83.84G 83.84G </code>
※新しいvolume(83.84GB)が追加されたのがわかる


・既存のVGに追加する
<code> # vgextend VolGroup00 /dev/cciss/c0d1 Volume group “VolGroup00” successfully extended </code>
・確認する
<code> # vgdisplay -C VG #PV #LV #SN Attr VSize VFree VolGroup00 2 2 0 wz–n- 232.72G 83.81G </code>

<code> # vgdisplay — Volume group — VG Name VolGroup00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 232.72 GB PE Size 32.00 MB Total PE 7447 Alloc PE / Size 4765 / 148.91 GB Free PE / Size 2682 / 83.81 GB VG UUID uV50Sq-CEwR-3YVM-wI3c-yV9H-k1lO-mhn1z2 </code>
※VolGroup00のフリー領域が増えているのが確認できる


・LogVol01領域を広げる
<code> # lvextend -L +83.81GB /dev/VolGroup00/LogVol01 Extending logical volume LogVol01 to 228.00 GB Logical volume LogVol01 successfully resized </code>

<code> # lvdisplay — Logical volume — LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID Zhs42f-022I-RRbD-DeVQ-7SV0-L153-kBSq2B LV Write Access read/write LV Status available # open 1 LV Size 228.00 GB Current LE 7296 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 — Logical volume — LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID aTgEQ7-qgP8-2Qib-fnVM-NEvY-F96y-eutLTT LV Write Access read/write LV Status available # open 1 LV Size 4.00 GB Current LE 128 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 </code>
※LVのサイズが増えているのが確認できる


・ちゃんと全て増えているか確認
<code> # vgdisplay — Volume group — VG Name VolGroup00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 232.72 GB PE Size 32.00 MB Total PE 7447 Alloc PE / Size 7447 / 232.72 GB Free PE / Size 0 / 0 VG UUID uV50Sq-CEwR-3YVM-wI3c-yV9H-k1lO-mhn1z2 </code>

<code> # lvdisplay — Logical volume — LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID Zhs42f-022I-RRbD-DeVQ-7SV0-L153-kBSq2B LV Write Access read/write LV Status available # open 1 LV Size 228.72 GB Current LE 7319 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 — Logical volume — LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID aTgEQ7-qgP8-2Qib-fnVM-NEvY-F96y-eutLTT LV Write Access read/write LV Status available # open 1 LV Size 4.00 GB Current LE 128 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 </code>

・最後にファイルシステムの拡張をする
<code> # resize2fs /dev/VolGroup00/LogVol01 resize2fs 1.39 (29-May-2006) Filesystem at /dev/VolGroup00/LogVol01 is mounted on /; on-line resizing required Performing an on-line resize of /dev/VolGroup00/LogVol01 to 59957248 (4k) blocks. The filesystem on /dev/VolGroup00/LogVol01 is now 59957248 blocks long. </code>
※10分くらいすると拡張が完了する。


・ちゃんと拡張が完了したか確認する
<code> # df -h Filesystem サイズ 使用 残り 使用% マウント位置 /dev/mapper/VolGroup00-LogVol01 222G 2.1G 209G 1% / /dev/cciss/c0d0p1 99M 18M 77M 19% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm </code>
って事でオンライン拡張完了(^^)

linux/lvm.txt · 最終更新: 2009/03/03 03:06 by miyako
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0