KVM添加虛擬磁碟

來源:互聯網
上載者:User

KVM添加虛擬磁碟

1.通過圖形介面“虛擬機器管理器”添加虛擬磁碟

2.字元介面:
添加一塊qcow2
 [root@localhost ~]# qemu-img create -f qcow2 kvm-clone.qcow2 2G
Formatting 'kvm-clone.qcow2', fmt=qcow2 size=2147483648 encryption=off cluster_size=65536

在設定檔添加磁碟:
[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>

開啟虛擬機器,發生錯誤:
[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 image /root/kvm-clone.qcow2: Permission denied


重啟“libvirtd”
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

開啟虛擬機器:
[root@localhost ~]# virsh start centos-virt-clone 
域 centos-virt-clone 已開始

3.線上添加虛擬磁碟:
virsh attach-disk oeltest02 /data/test02_add01.qcow2 sdb --cache=none --subdriver=qcow2

查看磁碟分割:

--------------------------------------分割線 --------------------------------------

KVM中Linux虛擬機器的硬碟添加方法

Linux入門學習教程:虛擬機器體驗之KVM篇   

RHEL6 KVM虛擬化建立橋接網卡-橋接器

RedHat Linux KVM虛擬機器橋接

CentOS 5.6下KVM的安裝/橋接設定/虛擬機器建立及運行

Ubuntu下用libvirt安裝KVM虛擬機器時找不到/bin/qemu-kvm問題解決

RedHat6.5下安裝配置KVM虛擬機器

--------------------------------------分割線 --------------------------------------

本文永久更新連結地址:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.