Skip to content

Instantly share code, notes, and snippets.

@alexbartsch
Last active September 24, 2016 19:36
Show Gist options
  • Save alexbartsch/3ce0dfe6a1b39c14b109fffeec5a818d to your computer and use it in GitHub Desktop.
Save alexbartsch/3ce0dfe6a1b39c14b109fffeec5a818d to your computer and use it in GitHub Desktop.
Resize vm guest disk space
# http://libguestfs.org/virt-resize.1.html
virt-filesystems --long --parts --blkdevs -h -a /home/libvirt-images/cloud-01_default.img
# Name Type MBR Size Parent
# /dev/sda1 partition 83 40G /dev/sda
# /dev/sda device - 40G -
# truncate -s 128G cloud-01_default-resized.img
qemu-img create -f qcow2 -o preallocation=metadata cloud-01_default-resized.img 128G
virt-resize --expand /dev/sda1 cloud-01_default.img cloud-01_default-resized.img
virsh edit cloud-01_default
# <devices>
# <emulator>/usr/bin/kvm-spice</emulator>
# <disk type='file' device='disk'>
# <driver name='qemu' type='qcow2'/>
# <source file='/home/libvirt-images/cloud-01_default-resized.img'/>
virsh start cloud-01_default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment