KVM虚拟机经常使用操做(2)

1、建立虚拟机linux

命令行建立
virt-install --graphics none --name=centos2 --ram=1024 --disk path=/home/kvm/centos2.img,format=qcow2,size=20 --vcpus 1 --os-type linux --os-variant rhel6 --network bridge=br0 --console pty,target_type=serial --location /home/iso/CentOS-6.8-x86_64-bin-DVD1.iso --extra-args 'console=ttyS0,115200n8 serial'
图形界面建立
1.
KVM虚拟机经常使用操做(2)
2.
KVM虚拟机经常使用操做(2)
3.
KVM虚拟机经常使用操做(2)
4.
KVM虚拟机经常使用操做(2)
5.
KVM虚拟机经常使用操做(2)centos

2、 重命名虚拟机ide

  1. 中止虚拟机
    [root@localhost qemu]# virsh shutdown moban1
    Domain moban1 is being shutdown测试

  2. 更改配置文件
    [root@localhost qemu]# virsh dumpxml moban1 > test1.xml
    [root@localhost qemu]# sed -i 's/>moban1</>test1</g' test1.xml

[root@localhost qemu]# virsh undefine moban1
Domain moban1 has been undefined命令行

[root@localhost qemu]# virsh define test1.xml
Domain test1 defined from test1.xmlorm

[root@localhost qemu]# virsh start test1xml

4.图形界面,关机直接更名字blog

3、虚拟机快照管理get

  1. 虚拟机建立快照,快照必定须要qcow2格式
  2. 建立测试文件
    [root@moban1 ~]# ls
    anaconda-ks.cfg install.log install.log.syslog
    [root@moban1 ~]# touch snapshotfortest
    [root@moban1 ~]# echo "hello world" > snapshotfortest
    [root@moban1 ~]# cat snapshotfortest
    hello world
    KVM虚拟机经常使用操做(2)

3.建立快照、查看快照、恢复快照、删除快照
建立快照
[root@localhost qemu]# virsh snapshot-create test1
Domain snapshot 1515234198 created
查看快照
KVM虚拟机经常使用操做(2)
恢复快照
[root@localhost qemu]# virsh snapshot-revert test1 1515234198
验证
KVM虚拟机经常使用操做(2)虚拟机

删除快照
KVM虚拟机经常使用操做(2)

相关文章
相关标签/搜索