标签:orm 磁盘配置 开始 white images inf OLE 磁盘格式 虚拟
1 [root@kvm-host ~]# virsh shutdown vm01-centos6.8 2 [root@kvm-host ~]# virsh edit vm01-centos6.8 3 …… 4 <memory unit=‘KiB‘>4194304</memory> 5 <currentMemory unit=‘KiB‘>4194304</currentMemory> #修改当前内存 6 <vcpu placement=‘static‘>4</vcpu> #修改当前CPU数 7 …… 8 [root@kvm-host ~]# virsh create /etc/libvirt/qemu/vm01-centos6.8.xml 9 #从配置文件加载启动虚机。 10 [root@kvm-host ~]# virsh dominfo vm01-centos6.8 #查看最大内存
1 virsh setmaxmem vm01-centos6.8 4G #需要关闭此虚机 2 虚机内存调整 3 virsh setmem UAKVM2 2G --config #关机状态下调整 4 virsh setmem UAKVM2 2G #开机状态下调整
1 [root@kvm-host ~]# virsh edit vm01-centos6.8 2 <disk type=‘file‘ device=‘disk‘> 3 <driver name=‘qemu‘ type=‘qcow2‘/> 4 <source file=‘/data/images/vm01-centos6.8.img‘/> #磁盘路径 5 <target dev=‘vda‘ bus=‘virtio‘/> 6 <address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x04‘ function=‘0x0‘/> 7 </disk> 8 [root@kvm-host ~]# qemu-img info /data/images/vm01-centos6.8.img
1 [root@kvm-host ~]# virsh edit vm01-centos6.8 2 <disk type=‘file‘ device=‘disk‘> 3 <driver name=‘qemu‘ type=‘qcow2‘/> 4 <source file=‘/data/images/vm01-centos6.8.img‘/> #磁盘路径 5 <target dev=‘vda‘ bus=‘virtio‘/> 6 <address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x04‘ function=‘0x0‘/> 7 </disk> 8 [root@kvm-host ~]# qemu-img info /data/images/vm01-centos6.8.img
1 [root@kvm-host ~]# virsh console 2
1 [root@localhost ~]# vgcreate -s 16m vg01 /dev/vdb1 2 [root@localhost ~]# lvcreate -L 1g -n lv01 vg01 3 [root@localhost ~]# mkfs.ext4 /dev/vg01/lv01 4 [root@localhost ~]# mkdir /data 5 [root@localhost ~]# mount /dev/vg01/lv01 /data/
1 [root@kvm-host ~]# virsh edit vm01-centos6.8 2 <disk type=‘file‘ device=‘disk‘> 3 <driver name=‘qemu‘ type=‘qcow2‘/> 4 <source file=‘/data/images/vm01-centos6.8.img‘/> #磁盘路径 5 <target dev=‘vda‘ bus=‘virtio‘/> 6 <address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x04‘ function=‘0x0‘/> 7 </disk> 8 [root@kvm-host ~]# qemu-img info /data/images/vm01-centos6.8.img
1 [root@kvm-host ~]# qemu-img resize /data/images/vm01-centos6.8.img +1G
1 [root@kvm-host ~]# qemu-img info /data/images/vm01-centos6.8.img
1 [root@kvm-host ~]# virsh start vm01-centos6.8 2 [root@localhost ~]# fdisk -l
1 [root@localhost ~]# fdisk /dev/vda 2 …… 3 Command (m for help): p
1 Command (m for help): d 2 Partition number (1-4): 3 3 Command (m for help): n 4 p 5 Partition number (1-4): 3
1 Command (m for help): w
1 [root@kvm-host ~]# resize2fs /dev/vda3 2 [root@kvm-host ~]# shutdown -r now
1 [root@kvm-host ~]# dd if=/dev/zero bs=1024M count=2 > /data/images/vm01-centos6.8-02.img 2 [root@kvm-host ~]# qemu-img info /data/images/vm01-centos6.8-02.img
1 [root@kvm-host ~]# qemu-img create -f qcow2 /data/images/vm01-centos6.8-02.img 1G 2 [root@kvm-host ~]# virsh attach-disk vm01-centos6.8 /data/images/vm01-centos6.8-02.img vdb --cache=none --subdriver=qcow2 3 [root@kvm-host ~]# virsh domblklist vm01-centos6.8
标签:orm 磁盘配置 开始 white images inf OLE 磁盘格式 虚拟
原文地址:https://www.cnblogs.com/itzgr/p/9893522.html