How to Backup OpenVZ Container using vzdump Command

In OpenVZ, containers also known as Virtual Machine or VPS. OpenVZ is a Linux based Kernel virtualization technology developed by SWSoft for its commercial product Virtuozzo. 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.

In this tutorial I will show how you can backup OpenVZ container using vzdump command.

Follow the below steps to backup OpenVZ container.

Step #1 : Download and Install vzdump command

First of all install vzdump command on your system if not installed. Follow the below download and install vzdump rpm packages.

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

Step #2 : Backup OpenVZ Virtual Machine (Container)

Now, find the container ID of the virtual machine. Follow the below command to find the container ID.

Find Container ID

# vzlist -a

You will get some output like below:

 101  338   running
 102   -    stopped
 103   -    stopped

You can find the container ID in line CTID as shown above.

Next create the directory where you want to store backup. In my case I have created in /home/backup. You can use another directory, just make sure you have enough space in that partitions where you want to store backup.

Create Backup Directory

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

Create Container Backup

Now create backup of your virtual machine (container) with ID 101 as shown below.

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

Create All Containers Backup

If you want to create all containers backup use –all option with vzdump command as shown below.

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


compress – Dump the backup in compress format such as tar.gz to save space.
dumpdir – Directory location where you want to store backup.

Step #3 : Restore Backup Using vzrestore Command

After backup created successfully now restore with the backup using vzrestore command as shown below.

# vzrestore
usage: /usr/sbin/vzrestore [OPTIONS]  

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

Command Example

I am going to restore virtual machine 101 from out backup under the new ID 104.

# vzrestore /home/backup/vzdump-101.tgz 104
Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment