Practical Tips for Linux: Use snapshots to create virtual machines

Source: Internet
Author: User

Practical Tips for Linux: Use snapshots to create virtual machines

In daily learning, if you encounter cluster and load balancing experiments, you need to use a large number of virtual machines. If you create one by one, it is obviously very cost-effective and inefficient. So how can we use snapshots to create virtual machines today. The number of bytes _ ^ you want. As long as the memory is enough!

To create a snapshot of a VM, perform the following steps:

1. First, we need to create a stored logical volume to generate the template and snapshot file;
2. Create a snapshot template;
3. Create a snapshot.

1. Create a logical volume:

(1) fdisk/dev/sda (create an LVM logical volume and then re-scan the disk ;)


(2) partx-d/dev/sda
Partx-a/dev/sda

(3) create an lv file:

Pvcreate/dev/sda
Vgcreate-s 4 M vg1/dev/sda5
Lvcreate-L 10G-n base vg1

(4) Then you can create a virtual machine template:





In this case, you can install an ordinary virtual machine. After the restart, perform the following operations (because you have created a template, the template must be universal)

2. Create a template:

In the template virtual machine, perform the following operations:

1. Disable firewall and selinux (File Modification ):



Vim/etc/sysconfig/selinux


2. Modify the network configuration file and delete the NIC information:

Vim/etc/sysconfig/network-script/ifcfg-eth0




3. Modify the yum source to a stable address:

Vim/etc/yum. repos. d/yum. repo




For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.