I. VM snapshots
1. Make sure that the VG on your physical machine has enough space to spare.
[[Email protected] ~] # Vgs
VG # PV # LV # Sn ATTR vsize vfree
Vg_hacker 1 6 4 WZ -- n-95.80g57.80 GB
2. Create an LV logical volume of at least 4 GB (8 GB here as an example) and install the virtual machine in this logical volume
[[Email protected] ~] # Lvcreate-L 8g-N vserver vg_hacker
[[Email protected] ~] # Ll/Dev/vg_hacker/vserver
3. encapsulate virtual machines
[[Email protected] ~] # Vim/etc/yum. Repos. d/rhel-source.repo
[RHEL-source]
Name = Red Hat Enterprise Linux $ releasever-$ basearch-Source
Baseurl = ftp: // 192.168.122.1/pub/yum
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG-key-RedHat-release
[Highavailability]
Name = instructor server Repository
Baseurl = ftp: // 192.168.122.1/pub/Yum/highavailability
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG-key-RedHat-release
Enabled = 1
[Loadbalancer]
Name = instructor server Repository
Baseurl = ftp: // 192.168.122.1/pub/Yum/loadbalancer
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG-key-RedHat-release
Enabled = 1
[Resilientstorage]
Name = instructor server Repository
Baseurl = ftp: // 192.168.122.1/pub/Yum/resilientstorage
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG-key-RedHat-release
Enabled = 1
[Scalablefilesystem]
Name = instructor server Repository
Baseurl = ftp: // 192.168.122.1/pub/Yum/scalablefilesystem
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG-key-RedHat-release
Enabled = 1
[Extra]
Name = localextra
Baseurl = ftp: // 192.168.122.1/pub/extra
Gpgcheck = 0
Enabled = 1
[[Email protected] ~] # Yum install lftp Vim openssh-clients-y
[[Email protected] ~] # Vim/etc/udev/rules. d/70-persistent-net.rules
# This file was automatically generated by the/lib/udev/write_net_rules
# Program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# Line, and change only the value of the name = key.
# PCI device 0x10ec: 0x8139 (8139cp)
# PCI device 0x10ec: 0x8139 (8139cp)
Subsystem = "Net", Action = "add", drivers = "? * ", ATTR {address} =" 52: 54: 00: 31: 46: E8 ", ATTR {type} =" 1 ", kernel = "ETH *", name = "eth0" (delete the next row, save and Exit)
[[Email protected] ~] #/Etc/init. d/iptables stop
[[Email protected] ~] # Chkconfig iptables off
[[Email protected] ~] # Vim/etc/sysconfig/SELinux
# This file controls the state of SELinux on the system.
# SELinux = can take one of these three values:
# Enforcing-SELinux security policy is enforced.
# Permissive-SELinux prints warnings instead of enforcing.
# Disabled-No SELinux policy is loaded.
SELinux =Disabled
# Selinuxtype = can take one of these two values:
# Targeted-targeted processes are protected,
# MLS-multi level security protection.
Selinuxtype = targeted
[[Email protected] ~] # Rm-RF/etc/ssh/ssh_host _*
[[Email protected] ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Device = eth0
Onboot = Yes
Bootproto = DHCP
[[Email protected] ~] # Halt encapsulation is complete. Shut down the Virtual Machine
4. Create a snapshot, delete the original disk of the VM, and add the snapshot to the VM. Each VM corresponds to a snapshot.
[[Email protected] ~] # Lvcreate-L 5G-N vserver1-snap/dev/vg_hacker/vserver-S
5. Create snapshots of other virtual machines on the original logical volume. You do not need to install the Virtual Machine multiple times!
[[Email protected] ~] # Lvcreate-L 5G-N vserver2-snap/dev/vg_hacker/vserver-S
Ii. Image Encapsulation
When your system VG has no space available, you can use another quick way to quickly Install multiple virtual machines
1. You do not need to recommend logical volumes. You only need to install a virtual machine according to the normal process.
2. Enter the default Virtual Machine storage path, find the imgfile (ISO. IMG here) corresponding to the virtual machine you just installed, and then execute the following command
[[Email protected] ~] # Cd/var/lib/libvirt/images/
[[Email protected] images] # ls
ISO. img
[[Email protected] images] # qemu-IMG create-F qcow2-O backing_file = ISO. img iso. voll1
3. Add the generated ISO. voll1 file to the virtual machine, and so on when multiple virtual machines are required.
------- End ---------
How to create virtual machine snapshots and image encapsulation in redhat6.x