常用指令
Logical Volume - LV
# 顯示所有 LV 使用狀況
lvdisplay -C
# 新增 LV
lvcreate -L 10G -n LV_name VG_name
# 刪除 LV
lvremove /dev/VG_name>/LV_name
# 更名 LV
lvrename /dev/VG-name/old-LV-name /dev/VG-name/new-LV-name
# 顯示 LV 狀況
lvs
lvs -a -o name,copy_percent,devices
lvs -a -o name,copy_percent,devices <vg-name>
lvs -a --segments -o +devices
# 擴充 LV 使用空間
lvextend -L +2G /dev/vg/lv
lvextend -l +100%FREE /dev/vg_db2v9/lv_root 將剩餘空間都加上
ext2online /dev/vg/lv (RHEL v4)
resize2fs /dev/vg/lv (RHEL v5,6)
xfs_growfs /dev/vg/lv (RHEL v7 with XFS filesystem)
# 縮小 LV 空間 (RHEL v4)
#說明:445GB -> 2GB
umount /worktmp
e2fsck -f /dev/rootVG/worktmpLV
resize2fs /dev/rootVG/worktmpLV 1843M
lvreduce -L 2GB /dev/rootVG/worktmpLV
resize2fs /dev/rootVG/worktmpLV
mount /worktmp
#註:1843MB 大約是要 2GB 的 90%,這裡的指令也能使用單位 GB
# Shrinking LV (RHEL 5/6)
#100 GB -> 5GB
umount /opt/oracle/arclog
resize2fs /dev/VolGroup00/arclogLV 5G
lvreduce -L 5G /dev/VolGroup00/arclogLV
e2fsck -f /dev/VolGroup00/arclogLV
mount /opt/oracle/arclog