libvirt:libvirt
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| libvirt:libvirt [2014/08/07 09:36] – [Store] deva | libvirt:libvirt [2016/09/15 21:18] (current) – deva | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ======Libvirt====== | ======Libvirt====== | ||
| + | =====Resize qcov2 image===== | ||
| + | < | ||
| + | # Shut down vm | ||
| + | |||
| + | # On host (to grow 8GB): | ||
| + | qemu-img resize / | ||
| + | |||
| + | # Start vm | ||
| + | # Assuming lvm logical volume inside extended partition... | ||
| + | # fdisk -l should now show the new disk size. | ||
| + | # run parted | ||
| + | (parted) resizepart 2 | ||
| + | 16GB | ||
| + | (parted) resizepart 5 | ||
| + | 16GB | ||
| + | (parted) quit | ||
| + | |||
| + | # resize volume group | ||
| + | pvresize /dev/sda5 # on lvm partition | ||
| + | |||
| + | # extend lvm | ||
| + | lvextend -l +100%FREE / | ||
| + | |||
| + | # finally resize file system | ||
| + | resize2fs / | ||
| + | </ | ||
| + | |||
| + | =====List VMs===== | ||
| + | < | ||
| + | virsh list --all | ||
| + | </ | ||
| =====Copy a VM===== | =====Copy a VM===== | ||
| Line 32: | Line 63: | ||
| cd / | cd / | ||
| - | # Pause the VM | + | # Dump the state (memory, network etc...) |
| - | virsh suspend | + | virsh save foobar |
| # Dump the VM configuration | # Dump the VM configuration | ||
| Line 42: | Line 73: | ||
| virsh dumpxml foobar | grep ' | virsh dumpxml foobar | grep ' | ||
| cp / | cp / | ||
| + | </ | ||
| - | # Dump the state (memory, network etc...) | + | At this point the complete VM state has been stored but the VM is stopped. |
| - | virsh save foobar | + | In order to resume the VM from the point where it left off, it must be resumed from the just saved state: |
| + | < | ||
| + | virsh restore | ||
| </ | </ | ||
| + | **IMPORTANT**: | ||
| + | |||
| + | **NOTE**: Using ntpd to sync a clock that is more than a matter of seconds out-of-sync might require special attention to its config file as it might refuse to synchronize the clock because it is too much out of sync. | ||
| + | |||
| + | FIXME: Use "virsh blockcopy" | ||
| ====Restore==== | ====Restore==== | ||
| < | < | ||
| Line 60: | Line 99: | ||
| # Restore the state (memory, network etc...) | # Restore the state (memory, network etc...) | ||
| virsh restore foobar.state | virsh restore foobar.state | ||
| - | |||
| - | # Resume the VM | ||
| - | virsh resume | ||
| </ | </ | ||
| + | **WARNING**: | ||
libvirt/libvirt.1407396972.txt.gz · Last modified: by deva
