lvm_-_thin_provisioning
This is an old revision of the document!
~~TOC~~
LVM - Thin provisioning
# create thin pool lvcreate -L 200G vg_kvm1/thinpool # create thin lv lvcreate -V32G -T vg_kvm1/thinpool -n thin_vmpxe # create thin pool and lv in one command lvcreate -L 200G -T vg_kvm1/thinpool -V32G -n thin_vmpxe
Convert thick LV to thin LV in use by KVM guest
- Shutdown access to lv, for example shut down KVM guest using that thick LV.
virsh shutdown vmpxe
- Create thin lv.
lvcreate -V16G -T vg_kvm1/thinpool -n thin_vmpxe
- Copy contents from thick to thin lv.
dd if=/dev/vg_kvm1/vmpxe of=/dev/vg_kvm1/thin_vmpxe ##or use 'pv' to monitor progress. dd if=/dev/vg_kvm1/vmpxe | pv -s 32g | dd of=/dev/vg_kvm1/thin_vmpxe ## free space not yet available: lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert thin_vmpxe vg_kvm1 Vwi-aotz-- 32.00g thinpool 100.00
- Edit KVM guest disk location.
virsh edit vmpxe
- Start KVM guest.
virsh start vmpxe --console
- Enable issue discards in lvm.conf, 'discard' in /etc/fstab, regenerate initramfs (dracut -f)
create file xml:
<controller type='scsi' model='virtio-scsi' index='0'/> # virsh attach-device --config Guest1 ~/virtio-scsi-controller.xml
make sure discard=unmap, bus = scsi and address type is altered to scsi instead of pci:
<disk type='file' device='disk'> <driver name='qemu' type='raw' discard='unmap'/> <source file='/guests/Fedora19.img'/> <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk>
lvm_-_thin_provisioning.1403525537.txt.gz · Last modified: 2014/06/23 12:12 by admin