Some time ago I published in this same blog an article in which it explained how to install a server OpenVZ. In it he mentioned how to install the program vzdump, which allows Backups containers and restore them later.
However, as a result of a reader's comment, I have found that the process is no longer so easy and requires a few additional steps. Since the online documentation in this regard is scarce and, almost always, erroneous, I have decided to make this small post explaining the process. I hope it is useful to you.
Vzdump installation
The first thing to do is satisfy the dependencies of the program. To get started, you have to install cstream. You can download it from here: http://pkgs.repoforge.org/cstream/
Find the latest version corresponding to your architecture and download it to your computer. If you are like me and refuse to use the graphical interface, use:
wget (url del paquete)
Once downloaded, touch install. We can install it with:
yum install (nombre_paquete)
Then you have to install the library Simple Locking file I / O for perl. These are the commands:
wget http://dag.wieers.com/rpm/packages/perl-LockFile-Simple/perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm
rpm -ivh perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm
If you go to the download page (http://dag.wieers.com/rpm/packages/perl-LockFile-Simple) you will see that there are more recent versions. I haven't tried them, but if you want to give it a try, they should work anyway.
Now it's time to add the path so that OpenVZ knows where to look for the library. This varies depending on the version. In the end, it is best to search the library throughout the system and get the path by hand. For this we execute:
find /usr -name Simple.pm
It will return multiple files, the one that imports is the first. In my case it is "/usr/lib/perl5/vendor_perl/5.8.8/LockFile/Simple.pm".
We take the path, forgetting the part of "LockFile / Simple.pm" and edit our file .bashrc.
vim ~/.bashrc
We add:
export PERL5LIB=(ruta)
In my case:
export PERL5LIB=/usr/lib/perl5/vendor_perl/5.8.8/
We save and load the new variable:
source ~/.bashrc
Now we can install vzdump. First we download it:
wget http://download.openvz.org/contrib/utils/vzdump/vzdump-1.2-4.noarch.rpm
And then we install it using yum (so we also check the dependencies):
yum install http://download.openvz.org/contrib/utils/vzdump/vzdump-1.2-4.noarch.rpm
It shouldn't give any problem. In the event that it does, check that you have installed procmail (or any other MDA). You should have it by default, but you may have uninstalled it. After the installation is complete, you should now be able to run vzdump and vzrestore. If doing so shows you some strange error, make sure the variable is exported:
echo $PERL5LIB
And that the route is correct.
That's it. Long life and prosperity.
Excellent article 😉
Thank you! 🙂
Well, for these purposes I recommend Proxmox, based on Debian, supports KVM and Openvz, and has a web interface and an API that can do wonders, it works for me like a silk. Scheduled backups, iscsi, nfs, etc ..
http://www.proxmox.com/es/proxmox-ve
Proxmox VE is a complete server virtualization solution based on open source systems. It enables virtualization over both KVM and containers and manages virtual machines, storage, virtualized networks, and HA clusters.
The truth is that proxmox looks very good. In fact, I think they are the ones developing (or developing) vzdump. But, in my opinion, it is always useful to know how the underlying technologies work. In my experience, graphical interfaces sooner or later fall short. And at that moment it's you against the terminal.
Long life and prosperity.
I second you, but proxmox gives you full access to vzdump and vzctl and everything, plus a REST api that is a dream, I currently have plans to do something like a status center with the python [1] interface and Flask.
https://github.com/swayf/proxmoxer
You don't need to say more. With the REST api you have already convinced me XD.
I am the reader who made the comment, and the truth is that I greatly appreciate this post.
I just followed the steps, and I was able to get the backups of the containers without any problems. Thank you for not letting me die trying
Now we go with another query, I imagine that this tool is not installed, because currently other types of backups must be used in OpenVZ and another tool must be used to lift them. I am right? I think that's a good topic for a future post 😉
regards
I clarify again that I end up using what you comment in this post, but since this I pass the link that the same people from OpenVZ gave me on Twitter, I did not use it 😛
https://openvz.org/Migration_from_one_HN_to_another
They told me about using vzmigrate
Well, it is clear that they did not understand you, because migrating to you was not of much use to you. Your problem was that you had the containers in backups made with vzdump. What vzmigrate does is take care of migrating an active container (cold or hot) from one machine to another. If you had done that from the beginning, yes. But once you wanted to remove the container from the backup, vzmigrate was of no use to you. They had to be removed from the backup and for that vzrestore was needed. But hey, for the next time use this that you will get rid of problems and suffering.
Well, no. I know, it seems strange to me too, but that's life. I also tell you that what vzdump really does (in offline mode) is simply compress the directory where the container root and its configuration files reside in a single file. And then unzip it and put everything in place. This could be done by hand. But technically, although it is not in official repositories (and it is a mess of noses to install it), vzdump is the official tool to make backup, at least in cold.
Why isn't it in the repositories then? That I would like to know. From what I see on the developers' blog, in recent times they are involved with ploop, which is what they like now. But hey, that's the way it is.
In any case, the backup (cold, hot and even ready if necessary) I have thought for a future article. Although I first plan to talk about networking, that people get involved with the types of virtual adapters and it is the easiest thing in the world. When they explain it to you in conditions, of course. Let's see if I can make some time this week.
Long life and prosperity
Now that I have done some reading about vzmigrate, I see that you are absolutely right, they did not understand me 😛 I also find networking interesting.
Thanks again 😉
I know this is an old post but for people who want it, I leave the repository to install it with a simple yum install vzdump.
Remember: this goes in the /etc/yum.repos.d/solusvm.repo directory
[soluslabs]
name = Soluslab Repo
# baseurl = http: //repo.soluslabs.com/centos/$releasever/os/$basearch
mirrorlist = http: //repo.soluslabs.com/centos/mirrors-soluslabs
gpgcheck = 0
enabled = 1
Once created just do
yum update
and then install:
yum install vzdump