1、安装环境时一不小心,centos安装完成后,发现,/分区分的很小,如下:
看来KVM存储池只能建到/home分区了
[root@nova ~]# df -h
Filesystem Size Used Avail Use% Mounted on/dev/mapper/vg_nova-lv_root 50G 23G 24G 49% /tmpfs 7.8G 392K 7.8G 1% /dev/shm/dev/sda1 485M 40M 420M 9% /boot/dev/mapper/vg_nova-lv_home 631G 5.0G 594G 1% /home2、KVM存储池创建
a)查看default 池的XML文件
virsh # pool-dumpxml default
<pool type='dir'> <name>default</name> <uuid>3d773824-cd2f-46b1-0c3b-62fd63c9ed6f</uuid> <capacity unit='bytes'>52844687360</capacity> <allocation unit='bytes'>24434704384</allocation> <available unit='bytes'>28409982976</available> <source> </source> <target> <path>/var/lib/libvirt/p_w_picpaths</path> <permissions> <mode>0755</mode> <owner>-1</owner> <group>-1</group> </permissions> </target></pool>b)在/home目录创建一个XML文件,并参照default.xml进行修改
[root@nova ~]# cp default.xml /home/poolB.xml
以下是修改好的文件。
<pool type='dir'>
<name>poolB</name> <uuid>43ac79d5-48c2-a9d8-0066-13562a2d192d</uuid> <capacity unit='bytes'>676712177664</capacity> <allocation unit='bytes'>4950196224</allocation> <available unit='bytes'>671761981440</available> <source> </source> <target> <path>/home/libvirt/p_w_picpaths</path> <permissions> <mode>0700</mode> <owner>-1</owner> <group>-1</group> </permissions> </target></pool>c)创建存储池poolB,并启动之
virsh # pool-create /home/poolB.xml
virsh # pool-start poolB #激活存储池
virsh # pool-autostart poolB #存储池自动启动
virsh # pool-info poolB #查看pool池信息
名称: poolB
UUID: 43ac79d5-48c2-a9d8-0066-13562a2d192d状态: runningPersistent: no自动启动: no容量: 630.24 GiB分配: 4.61 GiB可用: 625.63 GiB
3、virsh下命令行直接创建
a) 创建存储路径
mkdir -p /home/pool
#virsh pool-define-as poolB --type dir --target /home/pool
# #virsh pool-build poolB
#virsh pool-start poolB #激活存储池
#virsh pool-autostart poolB #存储池自动启动
4、创建存储卷并安装系统
a)创建卷
[root@nova ~]# virsh vol-create-as poolB linux3.qcow2 20G --format qcow2
[root@nova ~]#virt-install --name=linux3 --os-variant=RHEL6 --ram 1024 --vcpus=1 --disk path=/home/libvirt/p_w_picpaths/linux3.qcow2,format=qcow2,size=20,bus=virtio --accelerate --cdrom /home/iso/EMOS_1.6_x86_64.iso --vnc --vncport=5910 --vnclisten=0.0.0.0 --network bridge=br0,model=virtio -noautoconsol