Difference between revisions of "Ploop/Backup"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
m (Kir moved page Ploop/backup to Ploop/Backup)
(add pic)
Line 1: Line 1:
 +
[[File:Ploop-backup.png|300px|right|thumb|How backup via snapshot is done]]
 
This article explains how to do consistent file-based backups for [[ploop]] containers, using ploop snapshot feature.
 
This article explains how to do consistent file-based backups for [[ploop]] containers, using ploop snapshot feature.
  

Revision as of 02:51, 12 June 2013

How backup via snapshot is done

This article explains how to do consistent file-based backups for ploop containers, using ploop snapshot feature.

Assuming you have a running container identified by $CTID. The following needs to be done:

# Known snapshot ID
ID=$(uuidgen)

# Directory used to mount a snapshot
MNTDIR=./mnt
mkdir $MNTDIR

# Take a snapshot without suspending a CT and saving its config
vzctl snapshot $CTID --id $ID --skip-suspend --skip-config

# Mount the snapshot taken
vzctl snapshot-mount $CTID --id $ID --target $MNTDIR

# Perform a backup using your favorite backup tool
# (tar is just an example)
tar cf backup.tar.xz $MNTDIR

# Unmount the snapshot
vzctl snapshot-umount $CTID --id $ID

# Delete (merge) the snapshot
vzctl snapshot-delete $CTID --id $ID

For more information, see vzctl(8), section Snapshotting.