Backup/Restore from one install to another

I am not sure if this would be a question for the FreePBX forum or the Trixbox forum, so I’ll ask here first and then move on to the other one if need be.

I am working with two Trixbox installations - both running FreePBX 2.2.0rc1. On the primary installation, I have a set of Backups from the last month or so, which is the exact way I want the secondary system configured. Each backup is a complete backup, from what I can tell. I have all five radials set to Yes in the Backup options screen. Anyway, I created a new Backup scheme on the secondary machine, called Backup. I then copied the most recent backup file from the primary machine to /var/lib/asterisk/backups/Backup on the secondary machine. I then went into the Backup and Restore section of FreePBX on the secondary machine, chose to restore from a backup and selected Backup. The new file is listed there, so I choose it and tell it to do a full restore from this backup set.

Once it’s finished, I click the red bar and, just to be safe, I log into the console and issue a reboot command. At this point, I turn the old machine off, so there is no conflict in registering with Teliax for my IAX trunk. When the machine completes the rebooting process, I try to call in on my voip line but I get silence and then it disconnects. I watch the Asterisk terminal window and I see where my call is coming in. The system seems to be routing the call correctly, but the audio file I had selected shows up as being a 0 second file now. I check the file in the directory listing and it’s the right file-size, so I don’t see how it can be a 0 second WAV file now.

So, basically, my question is two-fold: (1) Is this a viable way to copy a configuration from one machine to another? (2) Is this a question for this forum or Trixbox.org? :smiley:

[quote=“Undrhil”]michegantelephone: I am leery of using ‘yum’ on the install because it is a VMWare Trixbox install from nerdvittles. If it’s ok for me to run the ‘yum’ commands then I’ll install Midnight Commander and see if that helps me any.

As it is right now, I use WinSCP from my Windows XP machine to copy between the two Trixboxes (one is a shared drive on my Windows machine, the other is the VMWare system.)[/quote]

Well, I installed it on a Trixbox install from Nerd Vittles, only it wasn’t running under VMware, but that shouldn’t make a bit of difference because inside VMware it’s still a standard CentOS install. CentOS is a derivative of Red Hat (or something like that) and the Red Hat family all use yum. Probably the easiest way to install Midnight Commander would be using the same syntax you used for Webmin (you did install Webmin, right?): yum -y install mc

I’d do this as while logged in as root, so your installed Midnight Commander can change permissions and ownership of files.

The problem with using WinSCP to copy files is that Windows has no knowledge of Linux file permissions. I haven’t used WinSCP enough to know whether, when copying files from one Linux box to another, it’s “smart” enough to keep the Unix permissions and attributes intact on the target machine. For that matter, even if you use the samba to transfer files from one machine to the other, the permissions may be (probably will be) reset. The only way to achieve true Linux-to-Linux transfers on a local network is using NFS, and that’s not something I can explain here (other than to say you can probably set it up under Webmin).

HOWEVER, that said, if you compress a file using tar (and maybe gzip) - which I think the backup routine does automatically - then take that compressed file to the other machine, and unzip/untar it there, the file attributes of the files MIGHT be preserved. I say MIGHT because for that to happen, you have to have the same users on both systems (which you probably do, at least for asterisk) and I believe that on both systems the users have to have the same uid/gid numbers, though I may be wrong about that (and don’t ask me offhand how to find out what those are, or to change them if they don’t match). And, you may need to use some command line switch during the unzip/untar process to tell it to use the original permissions and ownership, rather than assigning everything to whatever user is currently unpacking the files. Permissions and ownership are the most maddening thing about Linux (for those of us most familiar with Windows) even if they are one of the reasons Linux is more secure than Windows.

If you used FreePBX’s built-in Backup and Restore, one would think it would take care of checking permissions during the restore process. If it doesn’t, that might be a bug that should be reported.

michegantelephone: I am leery of using ‘yum’ on the install because it is a VMWare Trixbox install from nerdvittles. If it’s ok for me to run the ‘yum’ commands then I’ll install Midnight Commander and see if that helps me any.

As it is right now, I use WinSCP from my Windows XP machine to copy between the two Trixboxes (one is a shared drive on my Windows machine, the other is the VMWare system.)

Stilllearning: Yes, I did try rebooting the new machine. Several times. No change. As I said, I’ll check the ownership when I get home and go from there.

Undrhil

[quote=“Undrhil”]I’ll check on this when I get home tonight. What should they be set to? I assume Asterisk. Since I logged in as root to perform the copy, they are probably set to being owner by root. If this is the case, how can I change the owner?

Undrhil[/quote]

From memory it should be Asterisk, did you do a reboot of the new box??

I am a person who tries to avoid using the command line for ANYTHING (unless I’m copying/pasting a set of commands from someone else’s instructions) so on the off chance you’ve installed Midnight Commander (mc, or use mc -a if you get funny characters at the borders) I’ll tell you that you can do it from in there by navigating to the directory, selecting all the files (use the + key - not the one on the numeric keypad, but the shift of the = key - and a “select” dialog should pop up with a single * in the text field, at which point you click OK to select all the files). Then navigate to File | Advanced chown (from the top menu bar) and use the right and left arrow keys to navigate to the fields you want to change. For the owner and group, hit the enter key and it will give you a drop-down list of possible owners and groups, if you don’t see asterisk use the up/down arrow keys to find it. Don’t forget to click Set when you have changed things the way you want them.

I’ve posted this because for people like me, who couldn’t recall the arcane Linux command line sequence if their life depended on it - this tells you how to get the job done without referring to the dreaded man page. However I’m sure it will inspire some Linux purists to come out of the woodwork and insist that it’s much easier to do it by typing something or other on the command line. If by chance no one does, and you are really inspired to learn how to do it the hard way :slight_smile: then type man chown at the command line prompt and spend several minutes deciphering everything there. Or you could probably cheat a bit and type chown into a Google or Wikipedia search; there’s probably a “cheat sheet” somewhere that will tell you exactly how to do it. I still prefer the Midnight Commander way - if you don’t have it you can install it using yum (I think you’d use yum install mc or something like that).

I’ll check on this when I get home tonight. What should they be set to? I assume Asterisk. Since I logged in as root to perform the copy, they are probably set to being owner by root. If this is the case, how can I change the owner?

Undrhil

List your Backup files in ’ /var/lib/asterisk/backups/Backup’ after the copy
with ‘ls -la’. Is the owner and group set to ‘asterisk’ or ‘root’ or
something else?

Brian

-----Original Message-----
From: Undrhil [mailto:[email protected]]
Sent: Tuesday, December 12, 2006 12:32 AM
To: [email protected]
Subject: [Amportal-users] Backup/Restore from one install to another…

I am not sure if this would be a question for the FreePBX forum or the
Trixbox forum, so I’ll ask here first and then move on to the other one if
need be.

I am working with two Trixbox installations - both running FreePBX 2.2.0rc1.
On the primary installation, I have a set of Backups from the last month or
so, which is the exact way I want the secondary system configured. Each
backup is a complete backup, from what I can tell. I have all five radials
set to Yes in the Backup options screen. Anyway, I created a new Backup
scheme on the secondary machine, called Backup. I then copied the most
recent backup file from the primary machine to
/var/lib/asterisk/backups/Backup on the secondary machine. I then went into
the Backup and Restore section of FreePBX on the secondary machine, chose to
restore from a backup and selected Backup. The new file is listed there, so
I choose it and tell it to do a full restore from this backup set.

Once it’s finished, I click the red bar and, just to be safe, I log into the
console and issue a reboot command. At this point, I turn the old machine
off, so there is no conflict in registering with Teliax for my IAX trunk.
When the machine completes the rebooting process, I try to call in on my
voip line but I get silence and then it disconnects. I watch the Asterisk
terminal window and I see where my call is coming in. The system seems to
be routing the call correctly, but the audio file I had selected shows up as
being a 0 second file now. I check the file in the directory listing and
it’s the right file-size, so I don’t see how it can be a 0 second WAV file
now.

So, basically, my question is two-fold: (1) Is this a viable way to copy a
configuration from one machine to another? (2) Is this a question for this
forum or Trixbox.org? :smiley:


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Amportal-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amportal-users


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Amportal-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amportal-users

Post generated using Mail2Forum (http://www.mail2forum.com)

So, “Is this a viable way to copy a configuration from one machine to another?”

Can you backup one system and restore it on another system as long as they both run the same version ?
is it hardware dependable ?

Thanks.

as long as the versions are the same you are usually ok.

I ran into a similar issue when migrating our PBX over to new server. This was on FreePBX version 2.0.1. I installed FreePBX on the new server. Created and ran a backup on the new installation to create the directory. Copied the full backup from the old server to the new server. Restored from backup. Shutdown old server. Changed the IP address of new server to old server IP so the phones would register. And tested a call. Outgoing was fine, Incoming just went to dead air and then hung up. The way I resolved it was I had to go to each extension and re-enable the voicemail. I’m not sure what one has to do with the other, but that is how I resolved the issue. Also on that point the restore didn’t bring over any custom recordings so those had to be copied over also.

2.0.1 is a very very very old and extremely buggy version of FreePBX, not at all representative of today’s product. (Which is not to say that the backup/restore module has all its bugs flushed out, but I would not take much consideration for anything one may have seen on 2.0.1).

Actually, I have the same issue and I’m running on the latest updates as of 03/15/12 at 3:00pm EST.

I found that the asterisk db in mysql is not being restored properly using the webui. When I open up my backup that basically contains everything (even my customized FOP2 w extra buttons), and I extract it. I can see two .sql scripts within the backup stuff.

I then found mysql-3.sql was pertaining to my asterisk database when I open it up with kedit or nano. Just to confirm, I opened up mysql in the shell and typed show ‘databases;’. Then I typed ‘connect asterisk’ and then typed ‘show tables;’. I found the data referenced in mysql-3.sql was pertinent to this database. When I manually type ‘. mysql-3.sql’ (I opened mysql from the directory I extracted the backup into). It then processes the script and adds the necessary data. I can then confirm that extensions, routes, etc are all in my system, where as the web-based restore does what appears to be nothing.