next up previous contents
Next: 放大 LV 標準作法 Up: 邏輯捲軸管理 Previous: 邏輯捲軸管理   Contents

縮小 LV 標準作法

  1. 查看要縮小 LV vg_kvm7home-vo 掛載在 /home,大小為 74M ( 80M )。
    [root@kvm7 ~]# df -h
    Filesystem                   Size  Used Avail Use% Mounted on
    /dev/mapper/vg_kvm7usb-root  3.1G  1.1G  1.8G  37% /
    devtmpfs                     487M     0  487M   0% /dev
    tmpfs                        497M     0  497M   0% /dev/shm
    tmpfs                        497M  6.6M  491M   2% /run
    tmpfs                        497M     0  497M   0% /sys/fs/cgroup
    /dev/vda1                    197M  107M   90M  55% /boot
    /dev/mapper/vg_kvm7home-vo    74M  1.6M   68M   3% /home
    /dev/mapper/vg_mnt-pub        24M     0   24M   0% /mnt/pub
    
  2. 卸載 LV vg_kvm7home-vo
    [root@kvm7 ~]# umount /dev/vg_kvm7home/vo
    
  3. 先 resize LV vg_kvm7home-vo 檔案系統為 30M。
    [root@kvm7 ~]# resize2fs -f /dev/vg_kvm7home/vo 30M
    resize2fs 1.42.9 (28-Dec-2013)
    Resizing the filesystem on /dev/vg_kvm7home/vo to 30720 (1k) blocks.
    The filesystem on /dev/vg_kvm7home/vo is now 30720 blocks long.
    
  4. 再 resize LV vg_kvm7home-vo 為 30M, 縮小時此命令一定要在 resize2fs 命令之後執行,放大時則順序相反。
    [root@kvm7 ~]# lvresize -L 30M /dev/vg_kvm7home/vo 
      WARNING: Reducing active logical volume to 30.00 MiB
      THIS MAY DESTROY YOUR DATA (filesystem etc.)
    Do you really want to reduce vo? [y/n]: y
      Size of logical volume vg_kvm7home/vo changed from 80.00 MiB (40 extents) to 30.00 MiB (15 extents).
      Logical volume vo successfully resized
    
  5. 再檢查 LV vg_kvm7home-vo 大小為 24M ( 30M )。
    [root@kvm7 ~]# df -h
    Filesystem                   Size  Used Avail Use% Mounted on
    /dev/mapper/vg_kvm7usb-root  3.1G  1.1G  1.8G  37% /
    devtmpfs                     487M     0  487M   0% /dev
    tmpfs                        497M     0  497M   0% /dev/shm
    tmpfs                        497M  6.6M  491M   2% /run
    tmpfs                        497M     0  497M   0% /sys/fs/cgroup
    /dev/vda1                    197M  107M   90M  55% /boot
    /dev/mapper/vg_mnt-pub        24M     0   24M   0% /mnt/pub
    /dev/mapper/vg_kvm7home-vo    25M  784K   23M   4% /home
    



2017-07-10