-   Linux - Virtualization and Cloud (
-   -   OpenVZ Container Backup (

vzxen 09-18-2010 02:20 AM

OpenVZ Container Backup

Is it ok if I TAR the /vz/root/101/ directory ?
Will it be a valid backup ?
Also to restore I will need to stop the VPS and restore it in /vz/private/101 directory right ?

I dont want to stop the VPS while its running.


jmc1987 09-18-2010 02:34 AM

you may need to use the exclude option to exclude /sys /dev

like this

tar cvzpf /path/to/backup.tar.gz --exclude=/vz/root/101/sys --exclude=/vz/root/101/dev /vz/root/101/*

c create archive
v verbose
z filter through gunzip for compressing you can use j option for bzip
p tell tar to preserve files permissions
f your backup file /path/to/backup.tar.gz
--exclude tells tar to not backup these directories

It should backup with it still running. While restoring your backup you would have to shut your vps down

vzxen 09-19-2010 01:29 AM

So its ok if we backup directly right ?
And what about the /proc files.

When I archieve in this method, there are errors of files size shrinking in the /proc files.

jmc1987 09-19-2010 06:06 AM

Yes it is. Sorry I forgot about /proc. Exclude it also. Just remember when you restore your backup, you will have to create the /proc, /dev, and /sys or any other file you may have excluded such as /mnt or /media.

ashlyjay 09-21-2010 02:43 AM

you can also use vzdump command to backup containers

vzxen 09-22-2010 01:53 AM

Whats the harm if I backup the /proc, /dev, and /sys directories as well ?
All these directories are virtual files and whenever the OS restarted they are made again right ? Correct me if I am wrong !

All times are GMT -5. The time now is 04:23 AM.