Ploop/Backup

From OpenVZ Virtuozzo Containers Wiki
< Ploop
Revision as of 02:43, 12 June 2013 by Kir (talk | contribs) (Kir moved page Ploop/backup to Ploop/Backup)
Jump to: navigation, search

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.