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虚拟机的硬盘添加方法 http://www.linuxidc.com/Linux/2013-02/80067.htm
Linux入门学习教程:虚拟机体验之KVM篇 http://www.linuxidc.com/Linux/2015-03/114462.htm
RHEL6 KVM虚拟化创建桥接网卡-网桥 http://www.linuxidc.com/Linux/2013-08/88517.htm
RedHat Linux KVM虚拟机桥接 http://www.linuxidc.com/Linux/2013-02/79934.htm
CentOS 5.6下KVM的安装/桥接设置/虚拟机创建及运行 http://www.linuxidc.com/Linux/2012-12/76883.htm
Ubuntu下用libvirt安装KVM虚拟机时找不到/bin/qemu-kvm问题解决 http://www.linuxidc.com/Linux/2013-08/88985.htm
RedHat6.5下安装配置KVM虚拟机 http://www.linuxidc.com/Linux/2014-10/107972.htm
————————————–分割线 ————————————–
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-03/115005.htm