OpenVZ Forum


Home » General » Discussions » Container backup on remote host (How to do it?)
Container backup on remote host [message #41406] Mon, 17 January 2011 08:17 Go to next message
aluputi is currently offline  aluputi
Messages: 5
Registered: January 2011
Junior Member
Hello!

I have a machine running multiple containers. Some are big, having a lot of files.
How can I do a network backup, and what is the recommended method?
I have a backup server with enough space. But there isn't enough space on the HN to backup locally and then move the files to the backup server. I used vzdump when I had enough space, but now I can't anymore. And on the big containers it also takes a lot of time.

I do backups daily, so I think that a synchronization would be prefered instead of a complete backup.

Please provide me with some information on how to do these backups. I want complete container backup, with easy restoration (vzdump is perfect).

Thank you very much!
Re: Container backup on remote host [message #42618 is a reply to message #41406] Sat, 07 May 2011 08:34 Go to previous messageGo to next message
aluputi is currently offline  aluputi
Messages: 5
Registered: January 2011
Junior Member
Nobody can help?

I was thinking of making vzdumps over sshfs, but it gives errors on making mknods and symlinks.

How do you do backups on remote locations?
Re: Container backup on remote host [message #42931 is a reply to message #42618] Mon, 20 June 2011 14:17 Go to previous messageGo to next message
azagzin is currently offline  azagzin
Messages: 38
Registered: May 2008
Location: Vilnius
Member
try to use NFS
Re: Container backup on remote host [message #42943 is a reply to message #41406] Wed, 22 June 2011 08:59 Go to previous messageGo to next message
rimote is currently offline  rimote
Messages: 2
Registered: June 2011
Junior Member
Why dont you use LVM snapshots and rsync? It works like a charm without the need of much space (actually only the space requiered to write down the filesystemchanges during backup, so often 100mb is enough).

Give it a try, you'll love it.
Re: Container backup on remote host [message #42971 is a reply to message #42943] Thu, 23 June 2011 09:04 Go to previous messageGo to next message
aluputi is currently offline  aluputi
Messages: 5
Registered: January 2011
Junior Member
I'm working on rsync-ing directly to the backup server.
I don't mind I have to suspend the machine for a few seconds.

Does anybody have a rsync script available?
Re: Container backup on remote host [message #42972 is a reply to message #42971] Thu, 23 June 2011 09:17 Go to previous messageGo to next message
rimote is currently offline  rimote
Messages: 2
Registered: June 2011
Junior Member
you can use backupninja or tons of script available on the net

I would recommend you write a loader, listfile and a backupscript yourself.

Loader is the one you call through cron once a day or so:

#!/bin/bash

source /root/backuplist >> /varlog/backuplog

exit 0

The list /root/backuplist is the file where you echo every VPS in. You can do that with (example VEID 1102):

# echo "/root/backup.sh 1102" >> /root/backuplist

Then the backup.sh file itself:

#!/bin/bash
backupserverip=77.77.77.77

vzctl stop $1
rsync /var/lib/vz/private/$1 backup@${backupserverip}
vzctl start $1

exit 0

You should look at the details of this pseudo script. My system mayb different. I encourage you to fix your problem this way. A good sysadmin has to know how this works.

adding to cron can be done with # crontab -e

good luck
Re: Container backup on remote host [message #42973 is a reply to message #42972] Thu, 23 June 2011 09:21 Go to previous message
aluputi is currently offline  aluputi
Messages: 5
Registered: January 2011
Junior Member
I've already done the script, it is more complicated than this one. It uses arrays for the containers and all the settings are configurable.

I was just asking for scripts to view how others do it, especially to see what rsync options are used. I checked the vzdump script, and took the rsync options from there.

By the way, the rsync must be done twice, once with the machine running, then the machine is suspended (and not stopped), rsynced again and unsuspended.

Thanks for your kindness!
Previous Topic: Breaking Out of Openvz.
Next Topic: Few Questions
Goto Forum:
  


Current Time: Thu Jul 18 14:19:41 GMT 2024

Total time taken to generate the page: 0.02614 seconds