Difference between revisions of "Backup of a running container with vzdump"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Synopsis: VPS, VE -> container, remove empty lines, fixed | sign, no pre (use indentation))
(Examples: VE -> CT, container, use template:note)
Line 41: Line 41:
  
 
= Examples =
 
= Examples =
Use a running VE, for example install this: http://wiki.openvz.org/Proxmox_Mail_Gateway_in_VE
+
Use a running container, for example install this: [[Proxmox Mail Gateway in VE]]
  
 
== Backup ==  
 
== Backup ==  
  
Simply dump VE 777 - no snapshot, just archive the VE private area and configuration files to the default dump directory (usually /vz/dump/).
+
Simply dump CT 777 - no snapshot, just archive the container private area and configuration files to the default dump directory (usually /vz/dump/).
  
 
<pre>vzdump 777</pre>
 
<pre>vzdump 777</pre>
Line 53: Line 53:
 
<pre>vzdump --suspend 777</pre>
 
<pre>vzdump --suspend 777</pre>
  
Backup all VEs and send notification mails to root.
+
Backup all containers and send notification mails to root.
  
 
<pre>vzdump --suspend --all --mailto root</pre>
 
<pre>vzdump --suspend --all --mailto root</pre>
Line 60: Line 60:
  
 
<pre>vzdump --dumpdir /space/backup --snapshot 777</pre>
 
<pre>vzdump --dumpdir /space/backup --snapshot 777</pre>
* Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG as [http://weblogs.amtex.nl/index.php?blog=2&title=using_vzdump_snapshot_to_backup_without_downtime&more=1&c=1&tb=1&pb=1 described here]
+
 
 +
{{Note|using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG as [http://weblogs.amtex.nl/index.php?blog=2&title=using_vzdump_snapshot_to_backup_without_downtime&more=1&c=1&tb=1&pb=1 described here]}}
  
 
== Restore ==  
 
== Restore ==  
  
Restore above backup to VE 600
+
Restore above backup to CT 600
  
 
<pre>vzdump --restore /space/backup/vzdump-777.tar 600</pre>
 
<pre>vzdump --restore /space/backup/vzdump-777.tar 600</pre>
  
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]

Revision as of 21:50, 1 March 2008

Vzdump

Vzdump is an utility to make consistent snapshots of running OpenVZ VEs. It basically creates a tar archive of the VE private area, which also includes the VE configuration files.

There are several ways to provide consistency:

- Stop the VE during backup (very long downtime)

- Use rsync and suspend/resume (minimal downtime)

- Use LVM2 (no downtime)

Vzdump stores the backup on the disk in a single file. This file should go to a tape backup for archiving.

Download

Download vzdump rpm or deb packages from http://download.openvz.org/contrib/utils/vzdump/ or for newest version, check http://www.proxmox.com/cms_proxmox/en/technology/oss-software/openvz/

For rpm based systems:

wget http://www.proxmox.com/cms_proxmox/cms/upload/vzdump/vzdump-1.0-2.noarch.rpm

For Debian based systems:

wget http://www.proxmox.com/cms_proxmox/cms/upload/vzdump/vzdump_1.0-2_all.deb

Installation

For rpm based systems:

rpm -i vzdump-1.0-2.noarch.rpm

For Debian based systems:

dpkg -i vzdump_1.0-2_all.deb

Synopsis

vzdump OPTIONS [--all | <CTID>]
      --compress              compress dump file (gzip)
      --dumpdir DIR           store resulting files in DIR
      --xdelta                create a differential backup using xdelta
      --mailto EMAIL          send notification mail to EMAIL
      --stop                  stop/start container if running
      --suspend               suspend/resume container when running
      --snapshot              use LVM snapshot when running
      --restore FILENAME      restore FILENAME

Examples

Use a running container, for example install this: Proxmox Mail Gateway in VE

Backup

Simply dump CT 777 - no snapshot, just archive the container private area and configuration files to the default dump directory (usually /vz/dump/).

vzdump 777

Use rsync and suspend/resume to create a snapshot (minimal downtime).

vzdump --suspend 777

Backup all containers and send notification mails to root.

vzdump --suspend --all --mailto root

Use LVM2 to create snapshots (no downtime).

vzdump --dumpdir /space/backup --snapshot 777
Yellowpin.svg Note: {{{1}}}

Restore

Restore above backup to CT 600

vzdump --restore /space/backup/vzdump-777.tar 600