swap Size

現在のLVMの構成情報を表示

[root@falcon21 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_falcon21/lv_root
  LV Name                lv_root
  VG Name                vg_falcon21
  LV UUID                MytzRV-4QGS-E9OH-yF24-5sxP-znfg-5TwFFf
  LV Write Access        read/write
  LV Creation host, time falcon21.space, 2017-04-15 16:32:47 +0900
  LV Status              available
  # open                 1
  LV Size                213.02 GiB
  Current LE             54532
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/vg_falcon21/lv_home
  LV Name                lv_home
  VG Name                vg_falcon21
  LV UUID                QsSN3F-tejn-0zoI-3gXw-N4sw-jX8M-S1UTqc
  LV Write Access        read/write
  LV Creation host, time falcon21.space, 2017-04-15 16:33:05 +0900
  LV Status              available
  # open                 1
  LV Size                234.38 GiB
  Current LE             60001
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
   
  --- Logical volume ---
  LV Path                /dev/vg_falcon21/lv_swap
  LV Name                lv_swap
  VG Name                vg_falcon21
  LV UUID                Z8UBhp-wbYs-2z0J-3AQn-nWz0-l3Fi-MwkVUp
  LV Write Access        read/write
  LV Creation host, time falcon21.space, 2017-04-15 16:34:10 +0900
  LV Status              available
  # open                 1
  LV Size                17.88 GiB
  Current LE             4576
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   


LVM領域の変更する
LVMの領域を確認

[root@falcon21 ~]# lvscan
  ACTIVE            '/dev/vg_falcon21/lv_root' [213.02 GiB] inherit
  ACTIVE            '/dev/vg_falcon21/lv_home' [234.38 GiB] inherit
  ACTIVE            '/dev/vg_falcon21/lv_swap' [17.88 GiB] inherit


「lv_root」領域のサイズ(-1GB)を変更

[root@falcon21 ~]# lvresize -L -1G /dev/vg_falcon21/lv_root
  WARNING: Reducing active and open logical volume to 212.02 GiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vg_falcon21/lv_root? [y/n]: y
  Size of logical volume vg_falcon21/lv_root changed from 213.02 GiB (54532 extents) to 212.02 GiB (54276 extents).
  Logical volume lv_root successfully resized.


「lv_swap」領域のサイズ(+1GB)を変更
変更後のLVMの領域を確認

[root@falcon21 ~]# lvscan
  ACTIVE            '/dev/vg_falcon21/lv_root' [212.02 GiB] inherit
  ACTIVE            '/dev/vg_falcon21/lv_home' [234.38 GiB] inherit
  ACTIVE            '/dev/vg_falcon21/lv_swap' [18.88 GiB] inherit

 

スワップ領域の変更を反映
反映前のスワップ領域を確認

[root@falcon21 ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       4095996 257232  -1


スワップ領域を無効化

[root@falcon21 ~]# swapoff /dev/dm-1

しばらく時間がかかる。
※この状態では、スワップ領域が無効化されているため、スワップ領域の情報が表示されなくなる。


スワップ領域を再作成

[root@falcon21 ~]# mkswap /dev/vg_falcon21/lv_swap
mkswap: /dev/vg_falcon21/lv_swap: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
スワップ空間バージョン1を設定します、サイズ = 19791868 KiB
ラベルはありません, UUID=6427492d-98f6-4c76-adc8-16b2f8147a18


スワップ領域を有効化
[root@falcon21 ~]# swapon /dev/vg_falcon21/lv_swap


スワップ領域の情報を確認

[root@falcon21 ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       19791868        0       -1

swap Size が増えている。
*** lv_xxxx と fdisk -l で表示されるディスクサイズとは異なるので、注意。***


******************************************************************************************************


 

投票数:2 平均点:10.00

 
Back to Top