How to Backup Elastix for Migration

Discussion in 'General' started by RKM, Mar 7, 2010.

  1. RKM


    Feb 1, 2010
    Likes Received:
    Recently I posted a quick overview of how to install MondoRescue, since the yum / existing tutorials seem to have versioning issues.

    While Mondo is great for restoring to similar hardware, you may want to restore your system to an alternate hardware setup, or possibly a Virtual Machine. In either event, there are issues with using an "image backup" which assumes all of the hardware is identical.

    I've been working on a way to backup/restore for purposes of migration (whether it be to new hardware or a VM), and have finally found a route that is working for me.

    After about a week of testing, this is what I've concocted, in simplest terms:

    IMPORTANT: This is a special backup for migration purposes; this is not a daily/weekly style backup (although it could be, if you chose to do at a slow time, without stopping services/etc, and make some other modifications).

    1) Install a vanilla OS on the target machine, with as few options as possible (CentOS Network Install ISO is small and works great -- uncheck all options, except some key items under "Base"). The only thing you need at this juncture is the sshd and basic system. This must be the same OS/version as you're running your Elastix server.

    2) Remove all unnecessary applications that might be installed by default (it's important to do this prior to moving over the new system, so the yum/rpm databases are in-sync, etc). For example:
    yum erase gnome* acpid amtu* avahi* bluez* cadaver* ccid* conman* coolkey* cpuspeed* crash* dovecot* desktop-file* ed.i386 fetchmail* htmlview* irda* isdn* oddjob* samba* slrn* spamassassin* talk tux 
    3) On the old system, shut down Asterisk, MySQL, Apache (HTTPD), etc. This is *not* a requirement, however, it will assure that nothing gets altered in the process.
    service asterisk stop
    service mysqld stop
    service httpd stop
    4) Temporarily remove all firewalls/etc, which might block you from logging-in to your new system, considering your new system will have a different network config. Do this using chkconfig, so they are off at boot.
    chkconfig iptables off
    5) TAR your entire Elastix OS, minus some boot/hardware specific directories. After testing, I've com up with the following TAR exclusion list to preserve the new OS:
    tar cvpzf /tmp/backup.tgz --exclude /tmp --exclude /etc/fstab --exclude /etc/mtab  --exclude /etc/sysconfig --exclude /etc/udev --exclude /etc/inittab --exclude '/etc/modprobe*' --exclude /usr/src --exclude /root --exclude /boot --exclude /dev --exclude /proc  --exclude /mnt --exclude /sys --exclude /lost+found  /
    6) rsync the TAR to the new server, and extract.
        rsync -av -e ssh /tmp/backup.tgz
        tar xvpzf /tmp/backup.tgz -C /
    7) On your original server, immediately restore any stopped services/firewall/etc
    chkconfig iptables on
    8) Re-enable your firewalls (etc) on the new box, once you've altered their configuration to work in the new environment (if required)

    Reboot the new box, and you should have an identical replica, including all user accounts/passwords, MySQL data, etc.

    If you run into any issue, you can either start back from the vanilla OS, or work on the specific issue directly (using the CentOS Live CD if necessary).

    Hope that may come in handy for someone else,

Share This Page