2016年3月27日日曜日

/varの空き領域を増やす_centos6

# df -h /***既存の/varの空き容量を確認***/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos6-lv_root
                       69G   59G  6.4G  91% /
tmpfs                 2.9G   80K  2.9G   1% /dev/shm
/dev/sda1             477M  142M  310M  32% /boot
/dev/mapper/vg_centos6-lv_home
                      174G   61M  165G   1% /home
/dev/mapper/vg_centos6-lvol0
                       60G   32G   25G  57% /var

kvmのイメージファイルを/var/kvm/image以下に保存したい。

# ls /var/kvm/images/
template1.img  www1.img

# du -h /var/kvm/images/
32G     /var/kvm/images/

/varの空き容量を40G増やすことにする。

# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_centos6/lv_root
  LV Name                lv_root
  VG Name                vg_centos6
  LV UUID                0GHTft-n48J-prcX-hV1O-fZ1R-ZlL2-dvdAWG
  LV Write Access        read/write
  LV Creation host, time centos6, 2015-12-05 22:27:49 +0900
  LV Status              available
  # open                 1
  LV Size                70.00 GiB
  Current LE             17920
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  --- Logical volume ---
  LV Path                /dev/vg_centos6/lv_home
  LV Name                lv_home
  VG Name                vg_centos6
  LV UUID                F6FT0Y-TKse-zeMy-dEwc-JBMW-66fG-x9GxGW
  LV Write Access        read/write
  LV Creation host, time centos6, 2015-12-05 22:28:16 +0900
  LV Status              available
  # open                 1
  LV Size                176.58 GiB
  Current LE             45205
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
  --- Logical volume ---
  LV Path                /dev/vg_centos6/lv_swap
  LV Name                lv_swap
  VG Name                vg_centos6
  LV UUID                9OSVwv-wmEa-CYcA-aYn0-q3Br-0CmH-tUliqW
  LV Write Access        read/write
  LV Creation host, time centos6, 2015-12-05 22:29:42 +0900
  LV Status              available
  # open                 1
  LV Size                5.81 GiB
  Current LE             1488
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
  --- Logical volume ---
  LV Path                /dev/vg_centos6/lvol0
  LV Name                lvol0
  VG Name                vg_centos6
  LV UUID                aeIEuE-jj2a-pDTV-N2pL-BCSG-W8e5-NX3gw7
  LV Write Access        read/write
  LV Creation host, time centos6, 2016-03-24 12:18:36 +0900
  LV Status              available
  # open                 1
  LV Size                60.00 GiB
  Current LE             15360
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
# vgdisplay /***空き容量があることを確認***?
  --- Volume group ---
  VG Name               vg_centos6
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               2.05 TiB
  PE Size               4.00 MiB
  Total PE              536424
  Alloc PE / Size       79973 / 312.39 GiB
  Free  PE / Size       456451 / 1.74 TiB
  VG UUID               l7l1Qm-1a6k-aLuo-f6as-Ad9W-fKUb-rlSp0Q

# lvextend -L +40G /dev/vg_centos6/lvol0 /***/varに割り当てられた論理ボリュームを40G増やす***/
  Size of logical volume vg_centos6/lvol0 changed from 60.00 GiB (15360 extents) to 100.00 GiB (25600 extents).
  Logical volume lvol0 successfully resized

# df -h /***/varはまだ増えていない***/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos6-lv_root
                       69G   59G  6.4G  91% /
tmpfs                 2.9G   80K  2.9G   1% /dev/shm
/dev/sda1             477M  142M  310M  32% /boot
/dev/mapper/vg_centos6-lv_home
                      174G   61M  165G   1% /home
/dev/mapper/vg_centos6-lvol0
                       60G   32G   25G  57% /var

# vgdisplay /***Freeの値は減っている***/
  --- Volume group ---
  VG Name               vg_centos6
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  10
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               2.05 TiB
  PE Size               4.00 MiB
  Total PE              536424
  Alloc PE / Size       90213 / 352.39 GiB
  Free  PE / Size       446211 / 1.70 TiB
  VG UUID               l7l1Qm-1a6k-aLuo-f6as-Ad9W-fKUb-rlSp0Q

[root@centos6 ~]# resize2fs /dev/vg_centos6/lvol0 /***論理ボリュームの容量を/varに反映させる***/
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_centos6/lvol0 is mounted on /var; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 7
Performing an on-line resize of /dev/vg_centos6/lvol0 to 26214400 (4k) blocks.
The filesystem on /dev/vg_centos6/lvol0 is now 26214400 blocks long.

# df -h /***/varの空き容量が増えている***/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos6-lv_root
                       69G   59G  6.4G  91% /
tmpfs                 2.9G   80K  2.9G   1% /dev/shm
/dev/sda1             477M  142M  310M  32% /boot
/dev/mapper/vg_centos6-lv_home
                      174G   61M  165G   1% /home
/dev/mapper/vg_centos6-lvol0
                       99G   32G   62G  34% /var

#

0 件のコメント:

コメントを投稿