[Users] File-tree CT backup

Martin Dobrev martin at dobrev.eu
Thu Apr 29 09:08:44 EDT 2010


Hi
On 29.4.2010 г. 15:28 ч., Marc Olive wrote:
> Hello,
>
> I have a pretty backup script that takes care about files, only about files,
> using commands like "cp" and "rsync". There's no tar.gz nor snapshots about
> the filesystem as a whole and takes no care about partitions tables or LVM,
> it only copies files.
> And I don't want an image-like file, as a tar made by vzdump or LVM snapshop
> would be, so I can't not use them.
>
> To use it to backup OpenVZ containers it's enought to copy the files
> inside /var/lib/vz/private/$CID and /etc/vz/conf/$CID.conf, suspending
> previsously the CT? What about the files inside /var/lib/vz/root/$CID?
>    
If the VE is still running, you must use the files inside 
/var/lib/vz/root/$CID. Actually every single folder inside 
/var/lib/vz/root/ is "bind-mounted" to /var/lib/vz/private/$CID, so 
there isn't any difference between them. Though if you want to change 
something from CT0 inside a VE, use the /var/lib/vz/root/$CID path. This 
way vzquota is aware of the changes you make "inside" the VE and the 
VE-quota is measured correctly.
> Something like this simplified commands:
>
> ]$ CID=XYZ
> ]$ vzctl chkpnt $CID --dumpfile<path>
>    
This command saves a complete state of a running VE to a dump file, and 
stops the VE. If an option --dumpfile is not set, default dump file 
name  /vz/dump/Dump.veid  is  used.
> ]$ backup /var/lib/vz/private/$CID (¿vz/root/$CID?)
>    
There is no need to backup files from the private folder, if you already 
chkpnt-ed the VE
> ]$ vzctl restore $CID --dumpfile<path>
>    
This command restores a VE from dump file created by the chkpnt command.
> ]$ backup /etc/vz/conf/$CID.conf
>    
It's always a good idea to backup the configuration too. In my 
environment all VEs are using different configuration.
> In case my server was completly lost, will I have enought information to
> restore the CT? how should I restore them? Maybe with a process similar as
> when I create them from a template?
>
>    
If you backup the dumpfiles from the containers, you can vzctl restore 
the VE in case of a server failure (data loss).
> Any other tip or advise besides to test the whole process?
>
> Thanks,
>
>    

Best regards,
Martin Dobrev

Chief System Administrator
Amotera BG Ltd.

Sofia, Bulgaria



More information about the Users mailing list