标签:alt mic 最大 bytes pat conf 磁盘格式 关闭 cpu
[root@k8s-01 ~]# virsh shutdown vm01-centos7 域 vm01-centos7 被关闭 [root@k8s-01 ~]# virsh edit vm01-centos7 <domain type=‘kvm‘> <name>vm01-centos7</name> <uuid>c2784b15-5feb-4b5a-b768-a0b55bbb7c54</uuid> <memory unit=‘KiB‘>524288</memory> <currentMemory unit=‘KiB‘>524288</currentMemory> #修改当前内存 <vcpu placement=‘static‘>1</vcpu> #修改当前CPU数 <os>
[root@k8s-01 ~]# virsh create /etc/libvirt/qemu/vm01-centos7.xml 域 vm01-centos7 被创建(从 /etc/libvirt/qemu/vm01-centos7.xml) #从配置文件加载启动虚机。 [root@k8s-01 ~]# virsh dominfo vm01-centos7 Id: 10 名称: vm01-centos7 UUID: c2784b15-5feb-4b5a-b768-a0b55bbb7c54 OS 类型: hvm 状态: running CPU: 1 CPU 时间: 23.0s 最大内存: 524288 KiB 使用的内存: 524288 KiB 持久: 是 自动启动: 禁用 管理的保存: 否 安全性模式: none 安全性 DOI: 0
virsh setmaxmem vm01-centos6.8 4G #需要关闭此虚机 虚机内存调整 virsh setmem UAKVM2 2G --config #关机状态下调整 virsh setmem UAKVM2 2G #开机状态下调整
[root@k8s-01 ~]# virsh edit vm01-centos7 <disk type=‘file‘ device=‘disk‘> <driver name=‘qemu‘ type=‘qcow2‘/> <source file=‘/data/images/vm01-centos7.img‘/> #磁盘路径 <target dev=‘vda‘ bus=‘virtio‘/> <address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x06‘ function=‘0x0‘/> </disk>
[root@k8s-01 ~]# qemu-img info /data/images/vm01-centos7.img image: /data/images/vm01-centos7.img file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.2G cluster_size: 65536 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1580475507 0 2020-01-31 20:58:27 00:00:00.000 Format specific information: compat: 1.1 lazy refcounts: true
[root@k8s-01 ~]# virsh edit vm01-centos7
[root@k8s-01 ~]# qemu-img info /data/images/vm01-centos7.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
标签:alt mic 最大 bytes pat conf 磁盘格式 关闭 cpu
原文地址:https://www.cnblogs.com/liujunjun/p/12246929.html