понедельник, 5 июля 2010 г.

backup by tar

http://wiki.openvz.org/Physical_to_container


Tar

Another approach is using tar and excluding some dirs, you could do it like this:
Create a file /tmp/excludes.excl with these contents:
 
.bash_history
/dev/*
/mnt/*
/tmp/*
/proc/*
/sys/*
/usr/src/*

Then create the tar. But remember, when the system is 'not' using udev, you have to look into /proc/ after creating your container because some devices might not exist. (/dev/ptmx or others)

# tar --numeric-owner -cjpf /tmp/mysystem.tar.bz2 / -X /tmp/excludes.excl

Naturally, you can only do this when the critical services (MySQL, apache, ..) are stopped and your /tmp filesystem is big enough to contain your tar.