OpenVZ is a Linux based Kernel virtualization technology developed by SWSoft for its commercial product Virtuozzo. The modified Linux Kernel and the system utilities are released under an OpenSource license. Vzdump is a shell based backup program for OpenVZ virtual machines. It is made for containers that use the traditional "simfs" filesystem, it can not be used for containers with "ploop" filesystem.

Installation of vzdump

Run the following commands to download and install the RPM packages.

rpm -Uvh
rpm -Uvh
rpm -Uvh
ln -s /usr/share/perl5/PVE/ /usr/lib/perl5/5.8.8/PVE

Backup an OpenVZ virtual machine

First we will have to find the container ID of the virtual machine. You can get a list of all virtual machines on the local server with the vzlist command:

vzlist -a

The output will be similar to this:

vzlist -a
 101 338 running
 102 - stopped
 103 - stopped

Now create the directory where the backup shall be stored. I will use /home/backup in this case. You may use any directory, just ensure that you have enough free space on the partitions where the backup directory resides.

mkdir /home/backup
chmod 700 /home/backup
chown root:root /home/backup

Finally, I will create a backup of the virtual machine with ID 101:

vzdump --compress --dumpdir /home/backup 101

The option "--compress" instructs vzdump to store the backup as tar.gz format to save space. To create a backup of all virtual machines, use this command instead:

vzdump --compress --dumpdir /home/backup --all

Restore a vzdump Backup

The backup that we created with vzdump can be restored with the vzrestore command. the Syntax is as follows:

usage: /usr/sbin/vzrestore [OPTIONS] <ARCHIVE> <VMID>

 --force overwrite existing conf file, private and root directory

Vzdump restore example

Restore the virtual machine 101 from our backup under the new ID 104:

vzrestore /home/backup/vzdump-101.tgz 104
How to Backup OpenVZ Containers with vzdump on CentOS 6
Tagged on:

3 thoughts on “How to Backup OpenVZ Containers with vzdump on CentOS 6

  • Avatar
    February 10, 2016 at 4:14 am

    good tutorial, keep it up i learned.

  • Avatar
    August 3, 2016 at 11:22 pm

    where i found vzrestore?

    [[email protected] backups]# vzrestore
    -bash: vzrestore: command not found

    Is there an install file to download? or there is an alias from other command?


    • Avatar
      September 17, 2018 at 5:40 pm

      I do not have the vzrestore command, I used the command:
      vzdump –restore FILENAME new_container_id


Leave a Reply

Your email address will not be published. Required fields are marked *