Re: VZ container migration

Solar Designer <[email protected]>
Newsgroups gmane.linux.openwall.user
Message-ID <[email protected]>
On Sat, Dec 18, 2010 at 10:21:26AM +0300, [email protected] wrote:
> Backup your containers in Proxmox:
> 0. vzctl stop 1234
> 1. tar -C /path/to/ve/roots/1234 -czf ve-1234-`date +%Y%m%d`-backup.tgz .
> 2. cp /etc/vz/conf/1234.conf .
> 
> Then transfer these two files to Owl server and restore them:
> 4. mkdir -p /new/path/to/ve/roots/1234
> 5. tar -C /new/path/to/ve/roots/1234 -xzf ve-1234-*-backup.tgz
> 6. cp 1234.conf /etc/vz/conf/
> 7. Edit /etc/vz/conf/1234.conf if necessary
> 8. vzctl start 1234
> 
> (Of course, you have to edit commands as necessary)

A minor correction: the options to tar when creating the archive should
preferably include "S" ("handle sparse files efficiently"), and when
extracting the archive they should include "p" ("extract all protection
information") and "--numeric-owner" (don't try to resolve user and group
names stored in the tarball using the new host system's /etc/passwd
entries, which are not valid for the container's system being restored).
So the commands may be like:

tar -C /vz/private -cSf 1234.tar 1234

and:

tar -C /vz/private --numeric-owner -xpf 1234.tar

It is also possible to avoid creating this temporary tarball, such as by
running tar-over-ssh.

Alexander
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.