kvm添加虛擬磁盤

  1. 經過圖形界面「虛擬機管理器」添加虛擬磁盤
    vim

 

wKiom1TRmZDz_9FaAADINL5Z678293.jpgwKiom1TRmUbQSMjjAANwVNCMAws457.jpg


2.字符界面:centos

添加一塊qcow2bash

[root@localhost ~]# qemu-img create -f qcow2 kvm-clone.qcow2 2G
Formatting 'kvm-clone.qcow2', fmt=qcow2 size=2147483648 encryption=off cluster_size=65536


在配置文件添加磁盤:ide

[root@localhost ~]# virsh edit centos-virt-clone 
virsh edit centos-virt-clone 
   <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/root/kvm-clone-add.qcow2' />
      <target dev='vdb' bus='virtio'/>
    </disk>


開啓虛擬機,發生錯誤:rest

[root@localhost ~]# virsh start centos-virt-clone 
錯誤:開始域 centos-virt-clone 失敗
錯誤:internal error Process exited while reading console log output: char device redirected to /dev/pts/2
2015-02-02T11:13:45.039620Z qemu-kvm: -drive file=/root/kvm-clone.qcow2,if=none,id=drive-virtio-disk3,format=qcow2,cache=none: could not open disk p_w_picpath /root/kvm-clone.qcow2: Permission denied



重啓「libvirtd」orm

vim /etc/libvir
user = "root"
# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
group = "root"
dynamic_ownership = 0
[root@localhost ~]# /etc/init.d/libvirtd restart


開啓虛擬機:blog

[root@localhost ~]# virsh start centos-virt-clone 
域 centos-virt-clone 已開始


3.在線添加虛擬磁盤:ip

 virsh attach-disk oeltest02 /data/test02_add01.qcow2 sdb --cache=none --subdriver=qcow2



查看磁盤分區:ci

wKioL1TRnPSj3JSFAACmLBEkWF0131.jpg

相關文章
相關標籤/搜索