在VirtualBox中遷移CentOS虛擬機的步驟如下:
源主機的啟動命令示例:
./qemu-system-x86_64 -m 512 -hda /home/yangguang/nfs_mnt/images/debian_lenny_i386_small.qcow2 -net tap -net nic,model=rtl8139 -vnc :1 -monitor stdio
目的虛擬機的啟動命令示例:
./qemu-system-x86_64 -m 512 -hda /home/yangguang/nfs_mnt/images/debian_lenny_i386_small.qcow2 -net tap -net nic,model=rtl8139 -vnc :1 -monitor stdio -incoming tcp:0:8888
(qemu) help migratemigrate [-d] [-b] [-i] uri -- migrate to URI (using -d to not wait for completion)
-b for migration without shared storage with full copy of disk
-i for migration without shared storage with incremental copy of disk (base image shared between src and destination)
(qemu) migrate -d tcp:10.60.1.92:8888
paused
,目的虛擬機狀態會變為running
。此時,遷移完成,源虛擬機可以退出。以上就是在VirtualBox中遷移CentOS虛擬機的基本步驟,需要注意的是,在進行虛擬機遷移時,應確保虛擬機內部服務的中間時間以及整個虛擬機遷移的時間盡可能短,以減少服務中斷時間。