Restore using the CLI

Although the same command can be used to perform a backup for both KVM and LXC, there are two separate commands available to restore the KVM and LXC virtual machines:

  • qm restore: To restore KVM-based VMs
  • pct restore: To restore LXC containers

The following command format will restore KVM VMs through the command line:

#qmrestore <backup_file> <new/old_vmid> <options>  

Based on the previous command, if we want to restore our example KVM #100 from a backup onto local storage, it will appear as follows:

#qmrestore /var/lib/vz/dump/vzdump-qemu-110-2017_08_13-20_24_26.vma.lzo 110 -storage local  

The following options can be used with the qmrestore command:

Options

Description

-force <int>

The Boolean value is 0 or 1. This option allows for overwriting the existing VM. Use this option with caution.

-unique <int>

The Boolean value is 0 or 1. This assigns a unique, random Ethernet address to the virtual network interface.

-pool <string>

This is the name of the pool to add the VM to.

-storage <string>

This is the storage ID of the destination storage where the VM disk image will be restored.

 

The following command format will restore LXC containers through the command line:

#pct restore <ct_id> <backupfile> <options>  

Based on the previous command, if we want to restore our example container #101 onto local storage, it will appear as follows:

#pct restore 101 /var/lib/vz/dump/vzdump-lxc-101-2017_08_25-18_49_04.tar.lzo -storage local  

The following options can be used with the pct restore command:

Options

Description

-force <int>

The default value is 0 or 1. This option allows overwriting the existing VM. Use this option with caution.

-cpulimit <int>

The value range is from 0 to 128 with the default value as 0. This defines the number of CPUs or CPU time. Value 0 defines no CPU limit.

-cpuunits <int>

The value range is from 0 to 500,000, with the default value as 1,024. This defines the CPU weight of the VM in relation to other VMs.

-console <int>

The default value is 1. This defines the number of consoles to be attached to the container.

-force <int>

The Boolean value is 0 or 1. This allows overwriting of the existing container with the restored one.

-hostname <string>

This sets the hostname of the container after a restore.

-memory <int>

The default value is 512. This defines the amount of memory allocated for the container.

-swap <int>

The default value is 512. This defines the amount of swap space for the container.

-password <string>

This sets the root password in the container after a restore.

-storage <string>

This defines the destination storage ID where the container will be restored.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.131.110.169