Crazy System Restore

jmullinix

Guru
Joined
Oct 21, 2007
Messages
1,263
Reaction score
7
Hey all,

A client of mine discovered a way to recover the configs on a phone system that has not been backed up and won't boot. All of the credit for this goes to Paul at Keystone Digital in Pennsylvania.

First, build a new PIAF box. Then take the old drive, put it in a USB drive carrier and plug it into a USB port. You can use dmesg to find out its location; something like /dev/sdc3. Mount the drive to a temporary folder. I mounted mine to tempdrv

mount /dev/sdc3 /tempdrv

Now, on the new machine, stop the mysql service

service mysqld stop

Navigate to /var/lib/ and rename the mysql folder to something else.

mv mysql mysql.old

I did this just in case something goes terribly wrong. Now copy the mysql folder off of the old drive to /var/lib/

cp -r /tempdrv/var/lib/mysql /var/lib/

Now change the owner of the newly created mysql folder to mysql:mysql

chown -R mysql:mysql /var/lib/mysql

Now restart mysql

service mysqld start

Now copy the usual stuff from /var/lib/asterisk/keys, /var/lib/asterisk/sounds/custom and perhaps the voicemails from /var/spool/asterisk/voicemail/

You should now be able to access FreePBX and it should be fully populated with the old machines stuff. Click on something, then scroll to the bottom and click submit. When you click on the orange bar, it will build the required files in /etc/asterisk.

Finally, if you have a TDM card, rebuild the drivers for it and bounce the box. You should have a functional PBX.

Paul and I won't promise that this will work every time. He had a RAID 1 failure and the old machine would not boot from either drive but we were able to access the one drive to make this work. Your mileage may vary.
 
Hi

sighs of relief all round, I imagine.

One caveat to this that with this method, I have seen some corruption of tables, which can have some weird errors which sometimes do not come to light for some time, which makes diagnosis difficult. This happens particularly when the MySQL versions are different between the donor and recipient.

Consider running the mysqlcheck command on all tables to check and and repair the tables. This should do no harm, but do a mysqldump before you start.

See http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html for more details on the syntax, or there are some facilities in phpMyAdmin as well.

Joe
 

Members online

No members online now.

Forum statistics

Threads
26,686
Messages
174,407
Members
20,257
Latest member
Dempan
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top