ftocc

Here's How to back up a Trixbox 2.2 Install

GSnover
Posts: 1408
Member Since:
2006-11-19

** Update - SugarCRM Stores info in it's Apache directory - Now included **

There are several excellent articles here about Mondo and such for complete backups - this is a procedure for a more stripped-down Backup and Restore - just the data you need, not an image of the whole box:

Backing up Everything on your Trixbox 2.2 so you can restore it.

This is the procedure I use when I am trying to make a complete backup of a machine in preparation for moving it to different hardware, or just a complete backup for disaster recovery. Mondo is also a killer way to do this, but the advantage of doing it this way is that you have the individual components and can restore only the pieces that you want to move to the new machine. I will be giving the actual keystrokes from the console.

1) Go into FreePBX and create a Complete Backup named now - Select EVERYTHING
1) cd /usr/src - any working directory - I like this one.
2) mkdir move - I like an empty directory to work in.
3) cd move - go there.
4) cp /var/lib/asterisk/backups/now/* . - copy the backup you just created here to the working directory.
4) service mysqld stop - we are going to be backing up the databases, and we don't want open files getting in the way.
5) tar -czvf tftpboot.tar.gz /tftpboot/ - copy your tftpboot directory here.
6) tar -czvf sugarcrm.tar.gz /var/lib/mysql/sugarcrm/ - copy your SugarCRM database here.
7) tar -czvf endpoints.tar.gz /var/lib/mysql/endpoints/ - copy your endpoint database.
8) tar -czvf sugar-web.tar.gz /var/www/html/crm/ - Get the SugarCRM Web Directory
9) service mysqld start - restart it if you are going to keep using the old machine.

At this point, a directory should look something like this:

[root@asterisk move]# ls -alh
total 61M
drwxr-xr-x 2 root root 4.0K Dec 5 20:45 .
drwxr-xr-x 13 root root 4.0K Dec 5 20:38 ..
-rw-r--r-- 1 root root 38M Dec 5 20:39 20071205.20.38.05.tar.gz
-rw-r--r-- 1 root root 6.8K Dec 5 20:45 endpoints.tar.gz
-rw-r--r-- 1 root root 1.8M Dec 5 20:44 sugarcrm.tar.gz
-rw-r--r-- 1 root root 22M Dec 5 20:39 tftpboot.tar.gz
-rw-r--r-- 1 root root 38M Dec 5 20:48 sugar-web.tar.gz

There are several ways to move this off of your machine - you could use WinSCP if you are a Windows-Type, or you could FTP it off the machine (my preferred method) to get it to a place where when the new box is up and running, you can then copy the files back and restore.

Restoring is quite simple:

1) For the FreePBX backup, just go into FreePBX, create a backup job called now, and then move the file starting with 2007 (the first file listed) back into it's proper directory (/var/lib/asterisk/backups/now/) and you will be able to restore it.

2) For the Endpoints and SugarCRM backups, just stop mysqld and then expand the tar files right over top of the existing directories and when you restart mysqld, it will use the restored data.

3) For the tftpboot directory, install any firmware-x packages and configure them BEFORE you then expand the tarball over top - you want it back to the way you had it.

You could also very easily make this into a bash script, and then schedule it as a CRON job - because you are just dealing with the individual components, it is pretty straight forward.

You could also use this procedure to move from 2.2 to 2.4 with the exception of SugarCRM - I am going to see if I can rip the SugarCRM script and package out of the 2.2 .ISO and make it work on 2.4 - I will post it here when I have it working.

Trixbox is VERY flexible and forgiving when it comes to moving from machine to machine - hope this helps.

Greg



GSnover
Posts: 1408
Member Since:
2006-11-19
More thoughts on moving from one box to another.

http://www.trixbox.org/forums/trixbox-forums/help/questions-about...

I case someone stumbles accross this post and want's more info.

Greg



jahyde
Posts: 1996
Member Since:
2006-06-02
I was hesitant on the

I was hesitant on the endpoint manager if someone is trying to migrate from an older version (as many have asked about lately), I just wonder how much the db structure has changed between versions - does anyone know about that - anyone in dev?

for instance 1.x to 2.2x, I think there is quite a bit of difference, especially in the cisco section.

--

--my PBX is run on 2 V8's



GSnover
Posts: 1408
Member Since:
2006-11-19
Good Point - I haven't messed with a 1.x box since I started

with Trixbox - this would be a good question for the TB folks.

Greg



jahyde
Posts: 1996
Member Since:
2006-06-02
I just happened to have an

I just happened to have an install (if it aint broke, dont fux it;)

just from the first look at the db, 1.2.3 has:
Aastra
Cisco
Generic
Grandstream
Snom360
2.2.x adds Linksys and Polycoms.

But interestingly enough I only compared the Aastra and Cisco tables between the 2, and they look the same as far as I can see. I may be wrong, but I think this should be fine if you do an import using phpmyadmin instead of a complete replace, that way the new tables for Linksy and Poly wont get dumped.

--

--my PBX is run on 2 V8's



vaporjet
Posts: 49
Member Since:
2007-04-29
Any easy way to backup TB if

-



jahyde
Posts: 1996
Member Since:
2006-06-02
huh?

huh?

--

--my PBX is run on 2 V8's



vaporjet
Posts: 49
Member Since:
2007-04-29
Sorry, I initially was

Sorry, I initially was looking for a way to backup a TB2.2 box I have here. Problem was that I couldn't access the FreePBX page due to some apache and php errors. These errors have now been fixed.



Michael_Oz
Posts: 32
Member Since:
2006-08-09
Save the following as eg

Save the following as eg backup.sh in eg /home/backup.sh and reference this in a cron file. Easiest to do via webmin:

#!/bin/sh
/bin/cp /var/lib/asterisk/backups/now/* /usr/src/move
#
# we are going to be backing up the databases, and we don't want open files getting in the
# way.
/sbin/service mysqld stop
#
#copy your tftpboot directory here
#/bin/tar -czvf was replaced with /bin/tar -czf to eliminate verbosity
/bin/tar -czf /usr/src/move/tftpboot.tar.gz /tftpboot/
#
#copy your SugarCRM database here
#no...copy everything in /mysql:
# tar -czvf was replaced with tar -czf to elim verbosity
/bin/tar -czf /usr/src/move/mysql.tar.gz /var/lib/mysql/
#
#next line has already been copied
#tar -czvf sugarcrm.tar.gz /var/lib/mysql/sugarcrm/
#copy your endpoint database.
#tar -czvf endpoints.tar.gz /var/lib/mysql/endpoints/
#endpoint is not there...

#Get the SugarCRM Web Directory
#tar -czvf was replaced with tar -czf to elim verbosity
tar -czf /usr/src/move/sugar-web.tar.gz /var/www/html/crm/
#
# restart it if you are going to keep using the old machine.
/sbin/service mysqld start
#

Michael
Melbourne

--

Michael
Melbourne



joshelson
Posts: 173
Member Since:
2006-12-07
Danger, Danger!

I am not sure that this is the best method for a 2.2 to 2.4 upgrade.

FreePbx Backup/Restore replaces extensions.conf, iax.conf, and sip.conf (check your /var/www/html/admin/modules/core/etc to confirm), at a very minimum. Those files are not the same between 2.2 and 2.4 installations, and if you upgrade from 2.2 to 2.4 via this method, you will end up with 2.2 versions of these files.

Check out this link, from the FreePBX guys, as to why this isn't a good idea:

http://freepbx.org/forum/freepbx/users/backup-and-restore-when-do...

Any ideas on how to work around this?

-Josh



GSnover
Posts: 1408
Member Since:
2006-11-19
Hmmm...Haven't seen any instability with this, but OK

I have to defer to Phillippe if he says the module does a bad job - Although I have used it extensively with no problems - as they say, your mileage may vary...

Greg



joshelson
Posts: 173
Member Since:
2006-12-07
As a few examples of things that break...

If you do a Trixbox 2.2 to 2.4 backup / restore, the following files (perhaps among others) are taken to pre-2.4 releases:

/var/www/html/admin/modules/core/etc/extensions.conf
/var/www/html/admin/modules/core/etc/sip.conf

If you restore the above files to the 2.4 defaults, you are no longer able to make sip to sip calls.

I haven't completely gotten through troubleshooting on these issues on 2.4, but it doesn't appear that you can use extensions_custom.conf correctly anymore, and there have been intermittent Caller ID issues.

I'm not saying that it's impossible for this to work, but I think we're risking further issues in more complex installations by doing this. I am concerned.

Josh



GSnover
Posts: 1408
Member Since:
2006-11-19
No, you are having a different problem

I can tall you for certain that restoring a 2.2 backup to a 2.4 box does not break sip-2-sip calling - we have done that MANY times, and it has never messed it up - you are having a different problem, this is NOT caused by the restore.

You are having a different set of problems.

Greg



joshelson
Posts: 173
Member Since:
2006-12-07
That's not exactly the scenario I was describing...

What I actually said was that if you look at a vanilla 2.4 Trixbox installation, you have the following two files, which are rather important to the dialplan:

/var/www/html/admin/modules/core/etc/extensions.conf
/var/www/html/admin/modules/core/etc/sip.conf

In that installation, those files appear larger than was in TB 2.2.

The backup / restore procedure takes the larger files mentioned above and replaces them with the files that were core dialplan functionality in 2.2, removing the 2.4 version files. At that point, sip to sip calls work fine.

If however, as I state above, I attempted to put the 2.4 version files back, I lost sip to sip calls.

I'm not suggesting that backup / restore will immediately break everything you have, but I am suggesting that we pay heed to the FreePBX guys that say we should be not using this procedure. I'm not quite sure how to clean this up, as it stands now.

Josh



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.