Editing Backup of a running container with vzdump

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 13: Line 13:
  
 
For Debian based systems:
 
For Debian based systems:
<pre>wget http://download.proxmox.com/debian/dists/lenny/pve/binary-amd64/vzdump_1.2-16_all.deb</pre>
+
<pre>wget http://download.proxmox.com/debian/dists/lenny/pve/binary-amd64/vzdump_1.2-10_all.deb</pre>
  
  
Line 23: Line 23:
  
 
For Debian based systems:
 
For Debian based systems:
<pre>dpkg -i vzdump_1.2-16_all.deb</pre>
+
<pre>dpkg -i vzdump_1.2-14_all.deb</pre>
  
 
== Synopsis ==
 
== Synopsis ==
Line 80: Line 80:
  
 
Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG as described  [http://weblogs.amtex.nl/index.php?blog=2&title=using_vzdump_snapshot_to_backup_without_downtime&more=1&c=1&tb=1&pb=1 here].
 
Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG as described  [http://weblogs.amtex.nl/index.php?blog=2&title=using_vzdump_snapshot_to_backup_without_downtime&more=1&c=1&tb=1&pb=1 here].
 
=== Set-up LVM ===
 
While the LVM solution is the cleanest, since it allows to create an online backup without having to stop or suspend the virtual machine, it is also the hardest to set up. There are a few dependencies you should be aware of before setting up your LVM:
 
 
* You need to have at least 512MB free in your LVM volume group, to be able to create snapshots
 
* The directory where you are writing your backup dumps to (usually <code>/vz/dump</code>) should be on a different volume group than the one you are taking a backup from (usually <code>/vz/private</code>)
 
* There is a bug in <code>VZDump.pm</code> that can make the snapshot creation fail
 
 
==== Partitioning ====
 
As described above, you need to keep a few things in mind when creating your LVM partitions. In the example setup below, there are a total of 4 partitions:
 
 
* <code>/</code>, which is hosting the default OS files, on a 10GB LVM logical volume
 
* <code>/boot</code>, which is hosting the kernel and bootloader config, on a 512MB standard Linux partition
 
* <code>/opt</code>, which is hosting the backup dump files, on a 100GB LVM logical volume
 
* <code>/vz</code>, which is hosting all virtual machine files, on a 1.6TB LVM logical volume
 
 
All logical volumes are hosted on a 1.8TB volume group of which only 1.7TB is used by the above partitions and 100GB is unallocated.
 
 
In this setup the 100GB of free volume group space and 100GB of backup directory have been chosen to hold the snapshots and tar files that will be created when the virtual machine will be backed up. As specified above, only 512MB of snapshot space is needed, but it's better to be safe than having to resize your volumes at a later stage when disk space is not an issue. The same holds for the backup directory.
 
 
==== Fixing VZDump.pm ====
 
When trying to backup a virtual machine, creation of the snapshot can fail. This is because of a bug in <code>VZDump.pm</code>. In CentOS (and other RHEL derivatives), this file is located in <code>/usr/share/perl5/PVE/VZDump.pm</code>.
 
 
On line 622, you will find the following:
 
 
if ($line =~ m|^\s*(\S+):(\S+):(\d+(\.\d+))M$|) {
 
 
Replace this with:
 
 
if ($line =~ m|^\s*(\S+):(\S+):(\d+([\.,]\d+))[mM]$|) {
 
 
Save and close the file. Snapshots will now work with <code>vzdump</code>
 
 
==== Example ====
 
Since in the above example we have relocated the dump directory, you will need to run backups with a command similar to the following:
 
 
vzdump --dumpdir /opt/backupdir --snapshot 101
 
  
 
=== Restore ===
 
=== Restore ===
Line 162: Line 125:
 
Other distributions or versions may be affected, too.
 
Other distributions or versions may be affected, too.
  
<!--
 
link dead
 
 
== Hooks ==
 
== Hooks ==
  
 
http://nachtmann.it/blog/vzdump-hook-ftp-backup-script - Backup to FTP with limited capacity
 
http://nachtmann.it/blog/vzdump-hook-ftp-backup-script - Backup to FTP with limited capacity
-->
+
 
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)