$ virsh list --all
Id Name State
----------------------------------
1 vmlinux running
$ virsh snapshot-list vmlinux
Name Creation Time State
------------------------------------------------------------
接著嘗試建立 snapshot:
$ sudo virsh snapshot-create vmlinux
error: Requested operation is not valid: Disk '/var/lib/libvirt/images/vmlinux.img' does not support snapshotting
發現目前的格式不支援,接著登入 vmlinux 把機器關掉,進行格式轉換並且更新原本 VM 的敘述檔:
$ sudo qemu-img convert -f raw -O qcow2 /var/lib/libvirt/images/vmmail.img /var/lib/libvirt/images/vmmail.qcow2
$ virsh dumpxml vmlinux
...
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/vmlinux.img'/>
...
$ sudo virsh edit vmlinux
...
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/vmlinux.qcow2'/>
...
重新啟動VM:
$ sudo virsh start vmlinux
$ virsh list --all
Id Name State
----------------------------------
1 vmlinux running
建立 snapshot:
$ sudo virsh snapshot-create vmlinux
Domain snapshot 1382549415 created
$ virsh snapshot-list vmlinux
Name Creation Time State
------------------------------------------------------------
1382549415 2013-10-23 20:30:15 +0800 running
指定回復:
$ sudo virsh snapshot-revert vmlinux
error: --snapshotname or --current is required
$ sudo virsh snapshot-revert vmlinux --snapshotname 1382549415
$ virsh list --all
Id Name State
----------------------------------
1 vmlinux running
上述操作過程中,沒有把 VM 關掉,唯一的差別是連到 VM 的 putty 斷線了而已,也算挺方便的。
沒有留言:
張貼留言