KVM virtual storage management

kvm storage virtualization

KVM storage virtualization through storage pool (Storage Pool) and volume (Volume) to manage.

Storage Pool on the host is a storage space can be seen, it may be various type;

Volume is divided in a Storage Pool in space, will host the virtual machine is assigned to Volume, Volume seen in the virtual machine is a hard drive.

Directory type Storage Pool

File directory is the most common type of Storage Pool. The KVM host directory / var / lib / libvirt / images / Storage Pool as the default

Volume is the directory of files, a file is a Volume.

 

KVM should know how it is / var / lib / libvirt / images directory as the default Storage Pool it?

Storage Pool KVM practically all may be used are defined in the host's / etc / libvirt the / storage directory, each Pool an xml file, as follows:

 

There is a recognized default.xml, which reads as follows: Note: The type of the path Storage Pool "dir", the directory is / var / lib / libvirt / images

 

Create a Storage Pool

Open a virtual machine, add a hard disk (add storage) for virtual machines

After two good size setting, select Manage

Three pop-up dialog box, click on the lower left corner of the + sign, and the name of the setting you select the type of storage pool

Four for the selected path storage pool, which can be customized, you can choose the default

Five first stopped delete a storage pool storage pool, click on the dot, then click inside the circle pulling ×

Virtual Machine Additions volume

First select a storage pool, and then click next to the word + Volume No.

Two pop-up dialog box, set the volume name, formatting, setting the volume size

Volume created above named .qcow2 is a file path / custom or default. Use a file to make Volume has many advantages: easy storage, portability, and can be copied.

Volume KVM supports a variety of file formats:

raw: is the default format that the original disk image format, portability, and performance is good, but the size is fixed, can not save disk space.

qcow2:是推荐使用的格式,cow 表示 copy on write,能够节省磁盘空间,支持 AES 加密,支持 zlib 压缩,支持多快照,功能很多。

vmdk:是 VMWare 的虚拟磁盘格式,也就是说 VMWare 虚机可以直接在 KVM上 运行。

kvm冷迁移

如何做冷迁移(就是说必须在关机的状态下做)

迁移磁盘和配置文件

第一步 先查看你的虚拟机保存在哪

虚拟磁盘源路径就是他的保存位置

第二步 cd /nfsdate(进入此路径)

第三步 scp 磁盘名 另一台ip:/var/lib/libvirt/images(资源池)

第四步 cd /etc/lib/libvirt/qemu (虚拟机配置文件保存路径)

第五步 scp 配置文件名 ip:/root

第六步 virsh define /root/文件名 (这是从新定义虚拟机)

virsh undefined vm1 删除域

第七步 vim /root/文件名

找到磁盘配置段

<devices>

<source file=’/var/lib/libvirt/images/vm1.qcow2’/>

第八步 定义域

第九步 修边虚拟机的网络源要一致 改NIC 将网络源选择另一台虚拟机有的网络源,另一台也选择此网络源,两

第十步 virsh start vm1 (启动虚拟机)

virsh list(只显示开机的虚拟机)

virsh list  - - all (开机关机的都显示)

第二台管理第一台,与之前一样,点击文件,添加,而后会提示下载一个软件包,下载就可以。选择强制安装。(切记,安装的时候,本地要配好源)

如果系统用的是7.3以下。要做以下操作

 

Guess you like

Origin www.cnblogs.com/shuaiyin/p/10953387.html