lvm 筆記

在 kickstart 的範例

# System bootloader configuration
bootloader –append=” crashkernel=auto” –location=mbr –boot-drive=sda
# Partition clearing information
clearpart –all –initlabel –drives=sda

part /boot –fstype ext4 –size=1024
part pv.01 –size=1000 –grow –ondisk=sda
volgroup vg00 pv.01
logvol / –vgname=vg00 –fstype=xfs –size=40960 –name=lv_root
logvol swap –vgname=vg00 –fstype=swap –size=32768 –name=lv_swap
logvol /data –vgname=vg00 –fstype=xfs –size=10000 –name=lv_data –grow

# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 node2 lvm2 a– <79.00g 4.00m

# vgs
VG #PV #LV #SN Attr VSize VFree
node2 1 3 0 wz–n- <79.00g 4.00m

# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data node2 -wi-ao—- 23.33g
root node1 -wi-ao—- <47.79g swap node1 -wi-ao---- <7.88g

# vgrename node1 node2
Volume group “node1” successfully renamed to “node2”

# lvrename node2 home data
Renamed “home” to “data” in volume group “node2”

# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data node2 -wi-ao—- 23.33g
root node2 -wi-ao—- <47.79g swap node2 -wi-ao---- <7.88g

改完之後記得去編輯一下 /etc/grub2.cfg 要不然無法開機

linux16 /vmlinuz-3.10.0-862.el7.x86_64 root=/dev/mapper/node2-root ro crashkernel=auto rd.lvm.lv=node2/root rd.lvm.lv=node2/swap rhgb quiet LANG=en_US.UTF-8

還有要編輯 /etc/fstab

/dev/mapper/node2-root / xfs defaults 0 0
UUID=8d6dec77-95e2-4cde-8e4b-35742cd6623b /boot xfs defaults 0 0
/dev/mapper/node2-data /data xfs defaults 0 0
/dev/mapper/node2-swap swap swap defaults 0 0

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.