ナビゲーション

LVM操作

サイズ拡張

LVサイズを拡張する

サイズの縮小と違い、動的に変更することが可能

拡張するファイルシステムをマウントしたまま以下実行する。

  • 今回testというlvを作成して拡張してみる
    [root@localhost /]# df -h
    Filesystem サイズ 使用 残り 使用% マウント位置
    /dev/mapper/vg00-test
    62M 5.3M 54M 9% /test

    [root@localhost test]# lvdisplay
    --- Logical volume ---
    LV Name /dev/vg00/test
    VG Name vg00
    LV UUID k8ye0h-uDEY-Cgzm-bWX6-hQw8-ty1Y-yVqHzB
    LV Write Access read/write
    LV Status available
    # open 1
    LV Size 64.00 MB
    Current LE 2
    Segments 1
    Allocation inherit
    Read ahead sectors 0
    Block device 253:6

    ↑64Mのサイズ

  • さらに64M追加してみる
    [root@localhost test]# lvextend -L+64m /dev/vg00/test
    Extending logical volume test to 128.00 MB
    Logical volume test successfully resized

    [root@localhost test]# lvdisplay
    --- Logical volume ---
    LV Name /dev/vg00/test
    VG Name vg00
    LV UUID k8ye0h-uDEY-Cgzm-bWX6-hQw8-ty1Y-yVqHzB
    LV Write Access read/write
    LV Status available
    # open 1
    LV Size 128.00 MB
    Current LE 4
    Segments 1
    Allocation inherit
    Read ahead sectors 0
    Block device 253:6

    ↑128Mに増えている

  • このままではサイズがかわっていないのでresize2fsコマンドを実行する
    [root@localhost test]# resize2fs /dev/vg00/test
    resize2fs 1.39 (29-May-2006)
    Filesystem at /dev/vg00/test is mounted on /share; on-line resizing required
    Performing an on-line resize of /dev/vg00/test to 28835840 (4k) blocks.
    The filesystem on /dev/vg00/test is now 28835840 blocks long.

    [root@localhost test]# df -h
    Filesystem サイズ 使用 残り 使用% マウント位置
    /dev/mapper/vg00-test
    124M 6.3M 112M 6% /test

    以上でマウントしたままファイルシステムの拡張ができた。