Description
1) The VMware ESXi virtualization platform also supports this online extended disk feature.
2) The KVM virtual machine also supports the online extended disk function, which is extended to a specific usage environment, primarily for production environments that cannot be deactivated.
3) Tested KVM Online Extended disk function only for rhel/centos/oel6.x environment, 5.x does not support online expansion disk, other Ubuntu and other Linux I did not test, do not comment.
This article originates from: http://koumm.blog.51cto.com
To test this article, a OEL6.3 virtual machine is installed specifically.
1. Install the oel6.3 virtual machine
Installing oeltest02 virtual machines
# qemu-img Create-f Qcow2/data/test02.qcow2 7G
# virt-install--name=oeltest02--os-variant=rhel6.3--ram--vcpus=1--disk path=/data/test01.qcow2,format=qcow2, Size=7,bus=virtio--accelerate--cdrom/data/iso/oel63x64.iso--vnc--vncport=5911--vnclisten=0.0.0.0--network Bridge=br0,model=virtio--noautoconsole
The goal is to use the experimental environment disk to change to a VDA disk under the Virtio drive, which can be hot-swappable and dynamically added.
The entire installation process slightly, virtual machine configuration slightly, you can refer to the article in front of the series of content.
2. Add disk to oeltest02 virtual machine online
(1) View existing disks
[Email protected] data]# Virsh domblklist oeltest02
(2) Create a qcow2 virtual disk
[Email protected] data]# qemu-img create-f qcow2 test02_add01.qcow2 4G
(3) Add this qcow2 virtual disk online
# Virsh Attach-disk oeltest02/data/test02_add01.qcow2 vdb--cache=none--subdriver=qcow2
(4) Enter the oeltest02 virtual machine to view the added disk condition
[Email protected] data]#
[Email protected] data]# Virsh console oeltest02
Connect to the domain oeltest02
Escape character is ^]
Oracle Linux Server Release 6.3
Kernel 2.6.32-279.el6.x86_64 on an x86_64
test02 Login:root
Password:
Last Login:thu Sep 00:46:27 on ttyS0
[Email protected] ~]#
[Email protected] ~]# fdisk–l
You can see that the disk you just added has been adapted by the virtual machine.
You can see that there are two SCSI storage devices.
Note: Once again, only the rhel/centos/oel6.x version of the online add disk, the virtual machine can be directly recognized online.
(5) Modify the virtual machine configuration file Add new disk configuration
1) View the current virtual machine configuration file
The virtual machine configuration file you see here is a memory-stored configuration that disappears after a reboot and saves the newly added disk configuration to the configuration file.
[Email protected] data]# Virsh dumpxml oeltest02
<domain type= ' KVM ' id= ' 5 ' >
<name>oeltest02</name>
<uuid>2dfb812d-703c-3d5b-68b7-516f618e7944</uuid>
<memory unit= ' KiB ' >1048576</memory>
<currentmemory unit= ' KiB ' >1048576</currentMemory>
<vcpu placement= ' static ' >2</vcpu>
<os>
<type arch= ' x86_64 ' machine= ' rhel6.4.0 ' >hvm</type>
<boot dev= ' HD '/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset= ' UTC '/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type= ' file ' device= ' disk ' >
<driver name= ' qemu ' type= ' qcow2 ' cache= ' None '/>
<source file= '/data/test02.qcow2 '/>
<target dev= ' Vda ' bus= ' Virtio '/>
<alias name= ' Virtio-disk0 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x04 ' function= ' 0x0 '/>
</disk>
<disk type= ' file ' device= ' disk ' >
<driver name= ' qemu ' type= ' qcow2 ' cache= ' None '/>
<source file= '/data/test02_add01.qcow2 '/>
<target dev= ' vdb ' bus= ' Virtio '/>
<alias name= ' Virtio-disk1 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x06 ' function= ' 0x0 '/>
</disk>
<disk type= ' block ' device= ' cdrom ' >
<driver name= ' qemu ' type= ' raw '/>
<target dev= ' hdc ' bus= ' IDE '/>
<readonly/>
<alias name= ' ide0-1-0 '/>
<address type= ' drive ' controller= ' 0 ' bus= ' 1 ' target= ' 0 ' unit= ' 0 '/>
</disk>
<controller type= ' usb ' index= ' 0 ' >
<alias name= ' usb0 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x01 ' function= ' 0x2 '/>
</controller>
<controller type= ' IDE ' index= ' 0 ' >
<alias name= ' ide0 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x01 ' function= ' 0x1 '/>
</controller>
<interface type= ' bridge ' >
<mac address= ' 52:54:00:ff:2f:70 '/>
<source bridge= ' br0 '/>
<target dev= ' Vnet1 '/>
<model type= ' Virtio '/>
<alias name= ' net0 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x03 ' function= ' 0x0 '/>
</interface>
<serial type= ' pty ' >
<source path= '/dev/pts/3 '/>
<target port= ' 0 '/>
<alias name= ' serial0 '/>
</serial>
<console type= ' pty ' tty= '/DEV/PTS/3 ' >
<source path= '/dev/pts/3 '/>
<target type= ' serial ' port= ' 0 '/>
<alias name= ' serial0 '/>
</console>
<input type= ' mouse ' bus= ' ps2 '/>
<graphics type= ' vnc ' port= ' 5911 ' autoport= ' no ' listen= ' 0.0.0.0 ' >
<listen type= ' address ' address= ' 0.0.0.0 '/>
</graphics>
<video>
<model type= ' Cirrus ' vram= ' 9216 ' heads= ' 1 '/>
<alias name= ' Video0 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x02 ' function= ' 0x0 '/>
</video>
<memballoon model= ' Virtio ' >
<alias name= ' Balloon0 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x05 ' function= ' 0x0 '/>
</memballoon>
</devices>
<seclabel type= ' None '/>
</domain>
[Email protected] data]#
2) Save new disk configuration
[Email protected] data]# Virsh edit oeltest02
Description: Add a disk to the rhel/centos/oel5.x version of the virtual machine online in accordance with section 4th.
3. Merging the new disks into the virtual machine logical volumes
(1) The partitioning process is as follows
[Email protected] ~]# FDISK/DEV/VDB
[Email protected] ~]# Partprobe
(2) The process of creating a logical volume is as follows
To this oeltest02 virtual machine add disk online and expand the disk online successfully.
Revised on 2014-03-14, thank xiaoli110 for providing the following solutions.
4. oel/rhel/centos5.x virtual machine Add disk process online
Description: The oel/rhel/centos5.x virtual machine follows the above procedure to add a disk online, the disk is not recognized, you need to add a disk, after modifying the configuration file restart, can not be recognized online disk. It needs to be handled in the following way, that is, the ability to add disks online is possible.
(1) First log in to the virtual machine to execute two times the following command
Modprobe acpiphp
Modprobe acpiphp
(2) Create a disk on a virtual host and add a disk
Kvm--linux virtual Machine Online expansion disk