Senin, 24 Agustus 2020

RHV-clone vm terminal

 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_virtualization/cloning-virtual-machines_configuring-and-managing-virtualization

8.3. Cloning a virtual machine using the command-line interface

To quickly create a new virtual machine (VM) with a specific set of properties, for example for testing purposes, you can clone an existing VM. To do so using the CLI, follow the instructions below.

Prerequisites

  • The source VM is shut down.
  • Ensure that there is sufficient disk space to store the cloned disk images.
  • Optional: When creating multiple VM clones, remove unique data and settings from the source VM to ensure the cloned VMs work properly. For instructions, see Section 8.2, “Creating a virtual machine template”.

Procedure

  1. Use the virt-clone utility with options that are appropriate for your environment and use case.

    Sample use cases

    • The following command clones a local VM named doppelganger and creates the doppelganger-clone VM. It also creates the doppelganger-clone.qcow2 disk image in the same location as the disk image of the original VM, and with the same data:

      # virt-clone --original doppelganger --auto-clone
      Allocating 'doppelganger-clone.qcow2'                            | 50.0 GB  00:05:37
      
      Clone 'doppelganger-clone' created successfully.
    • The following command clones a VM named kal-el located on the remote system 10.0.0.1, and creates a local VM named bizarro, which uses only two of kal-el's multiple disks. Note that running this command also requires root privileges for 10.0.0.1.

      # virt-clone --connect qemu+ssh://root@10.0.0.1/system --original kal-el --name bizarro --file /var/lib/libvirt/images/solitude1.qcow2 --file /var/lib/libvirt/images/solitude2.qcow2
      Allocating 'solitude1.qcow2'                                      | 78.0 GB  00:05:37
      Allocating 'solitude2.qcow2'                                      | 80.0 GB  00:05:37
      
      Clone 'bizzaro' created successfully.

Verification

To verify the VM has been successfully cloned and is working correctly:

  1. Confirm the clone has been added to the list of VMs on your host.

    # virsh list --all
    Id   Name                  State
    ---------------------------------------
    -    doppelganger          shut off
    -    doppelganger-clone    shut off
  2. Start the clone and observe if it boots up.

    # virsh start doppelganger-clone
    Domain doppelganger-clone started

Additional resources

  • For additional options for cloning VMs, see the virt-clone man page.

Tidak ada komentar:

Posting Komentar