You are on page 1of 37

PBX IN A FLASH DEVELOPMENT CORPORATION

Daily Backup
Backing up your PBX in a Flash 1.7.5.5
installation on a daily basis
PIAF Development Corporation
July 20, 2010

PIAF
Digitally signed by
PIAF Dev Corp
DN: cn=PIAF Dev
Corp, o=PBX in a

Dev
Flash Development
Corporation,
ou=Executive,
email=support@pi

Corp
afdevcorp.com,
c=US
Date: 2010.07.19
23:25:14 -04'00'

A manual to install, configure, and use a daily backup program on PBX in a Flash 1.7.5.5
Daily Backup July 2010

Welcome! This document will describe the configuration and installation of the daily backup package
onto PBX in a Flash 1.7.5.5 We have tested this script on Lab, Production, Real, and Virtual machines;
using both VMware and Proxmox with great success. This is version 1.7.5.5 of the program released July
20, 2010

This work is copyright 2008 – 2010 by the PBX in a Flash Development Corporation. This work may
not be altered or modified without express written permission of the author. You may copy this
manual and use it freely; however this notice must be included with the document. This manual is
NOT released under the GNU General Public License. Whole Disk Backup is designed and licensed
to only run under PBX in a Flash. Use of this program under any other PBX system is a violation of
our license.
WARNINGS
Please contact us in the PBX in a Flash forum for further information.

As with any new piece of software you need to ensure it actually works in your own computer
environment. If you fail to test this software on your production machine and you rely on it to do
mission critical backups YOUR BACKUP OR RESTORE WILL FAIL. What does this mean? It means that
without testing on your own hardware the Daily Backup program may not work at all.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 2
Daily Backup July 2010

OVERVIEW

The need to have software backups on a daily basis is a requirement that has been lacking in most
installations of PBX systems. When a PBX installation fails due to software problems there has to be a
way to quickly and accurately repair or restore the errant piece of software. To this end a daily backup
program was created. This program is run by cron every morning about 4am and will make backups,
using various methodologies, of critical files that are essential to running PBX in a Flash 1.7.5.5. Once
these backup procedures have been completed a single master archive will be created and then
optionally move offsite. Upon completion a complete report will be emailed to the user of your choice.

Daily-backup also offers the ability to move the master archive to offsite storage via FTP, SMB, Attached
USB flash/hard drive, and copy to a Pogo Plug. Rsync is also supported for selected transport
mechanisms.

METHODOLOGY

The “Kitchen Sink” approach was chosen to make daily backups as opposed to a single method of storing
critical system information. This provides the user with extra flexibility when it comes to restoring
critical aspects of PIAF 1755 where a complete bare metal restore may NOT be required. For example: a
single table in MySQL becomes corrupted you can simply restore from the MySQL dump which is stored
in the master archive.

Once you have configured the /etc/pbx/daily-backup.conf file cron will run /etc/cron.daily/disk-
backup.cron at about 0400 hours. The program will read the configuration file and proceed to call
various backup methods and then store the results in a single master backup file. The current methods
for backing up PBX in a Flash 1.7.5.5 are: Original FreePBX backup, Complete dump of MySQL, Incredible
backup, and a separate archive of any digium licenses.

In order to restore please follow the appendixes in the back of this document. NOTE: Some of these
appendixes have yet to be written and require a high degree of Linux awareness. Unfortunately this is
beyond the scope of this manual.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 3
Daily Backup July 2010

REQUIREMENTS

There are several requirements to run the disk backup script and they are outlined below. It is
recommended you have met all of the requirements prior to performing the installation and
configuration.

o A working PBX in a Flash 1.7.5.5 installation. Note this software is designed to work with PBX in a
Flash 1.7.5.5 ONLY

o A command line editor you are comfortable with on your PBX in a Flash. We use joe as our
command line editor.

o Various pieces of information that you will require in order to make the file transfer methods
you have selected work. Below is a table of all of the required information. Simply fill the
information for the method of storage you have selected. By default ftp is enabled and
USB/SMB is disabled.

A least one of the following

o An ftp account on a remote system that you can log into and upload files

o A USB stick of sufficient size locally attached to your PBX in a Flash. It is recommended you
follow the directions in Appendix one to delete the existing file system and redo it with the Linux
version of fdisk and mkdosfs.

o Access to a shared drive on a Windows/Samba server with sufficient privileges to read and write
files

o Access to a Pogo Plug share

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 4
Daily Backup July 2010

Information Tables to be filled out prior to Installation


These settings are contained in /etc/pbx/daily-backup.conf and /etc/pbx/script-email.conf. When the
program is installed the default setting is to disable daily backups until the /etc/pbx/daily-backup.conf
file is fully configured.

Configuration Options

VARIABLE User provided


Default Value Description
NAME value

MASTER SWITCH This controls if the program is


processed.
CONFIGURED “0”
0 = DISABLED You need to change this to “1” after you
have configured the /etc/pbx/disk-backup.conf file

VARIABLE User provided


Default Value Description
NAME value

This switch instructs the program to email the log file


to a email address specified in /etc/pbx/email-
script.conf There is another option later in the
configuration file to gzip the log file prior to sending
SENDLOG “1” it.

0 = Do not email log

1 = Email log

This option causes the ISO files that have been


created to be deleted AFTER they have been copied
to offsite storage.
DELBACKUPS “1”
0 = Do not delete local copy of ISO file

1 = Delete local copy of file

DIRECTORY “/backup” Do not change! This is where the ISO files are created.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 5
Daily Backup July 2010

Incredible Backup Configuration

VARIABLE User provided


Default Value Description
NAME value

This option tells the program to process a daily


backup via the Incredible Backup methodology
IBACK “1”
0 = Do not use Incredible Backup

1 = Use incredible Backup

MySQL Database backup

VARIABLE User provided


Default Value Description
NAME value

This option tells the program to perform a MySQL


dump of all tables
DBBACK “1”
0 = Do not use the MySQL dump procedure

1 = Use the MySQL dump procedure

DO NOT
DBNAME “root” Should not have to be changed
CHANGE

DO NOT
DBPASS “passw0rd” Should not have to be changed
CHANGE

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 6
Daily Backup July 2010

FreePBX Backup

VARIABLE User provided


Default Value Description
NAME value

This option tells the program to perform a FreePBX


Backup of the system

FPBXBACK “1” 0 = Do not backup the system using the freepbx


method

1 = backup the system using the freepbx method

This option removes the freepbx generated archive


located in /var/lib/asterisk/backups/piafbackup
REMFILES “1”
0 = Do not remove files

1= Remove files

This allows you to specify what the FPBX program will


Options See Appendix backup. See the file for details. Do not modify unless
you know what you are doing.

Digium License Backup

VARIABLE User provided


Default Value Description
NAME value

This option tells the program to copy any Digium


license located in /var/lib/digium
LICBACKUP “1”
0 = Do not backup Licenses

1 = backup Licenses

DO NOT CHANGE UNLESS YOU KNOW WHAT YOU


DIGIUMLIC "/var/lib/digium" ARE DOING! This is the path currently to where the
digium licenses for thing like g729… are stored

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 7
Daily Backup July 2010

Ftp Information

User
VARIABLE NAME Default Value provided Description
value

Once the ISO’s have been created by


Mondorescue copy them to an ftp store
CPFTP “0”
0 = Do not copy to ftp share

1 = Copy to ftp share

This is the username that you use to log onto


USERNAME “ftpuser”
the remote ftp server

This is the password used to log onto the


PASSWORD “ftppassword”
remote ftp server

This is the remote ftp directory you wish the


REMOTEDIRECTORY “/”
backup files to be placed minimum is /

This is the IP address or Fully Qualified Domain


SERVER “ftp.server.ip”
Name of the ftp server

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 8
Daily Backup July 2010

Usb drive info

User provided
VARIABLE NAME Default Value Description
value

Once the ISO’s have been created by


Mondorescue copy them to an external
USB Hard/Flash drive
CPFLASH “0”
0 = Do not copy to USB hard/flash drive

1 = Copy to USB hard/flash drive

It is
recommended Where the flashdrive is mounted to
USBMOUNTPOINT= “/mnt/usbmondo”
you DO NOT default is /mnt/usbmondo
change this

This is the device name of your USB


stick and may change depending on
USBDEVICENAME= “/dev/sda1” what you find using dmesg. Default is
/dev/sda1 *Usually works in most
cases

Please see Appendix one for the complete procedure to configure your USB drive to work before filling
out the table above.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 9
Daily Backup July 2010

Smb Share Information

User provided
VARIABLE NAME Default Value Description
value

Once the ISO’s have been created by


Mondorescue copy them to a SMB share
on the network
CPSMB “0”
0 = Do not copy to network share

1 = Copy to network share

This is the ip Address of the machine


that is sharing a folder. This machine can
SMBMACHINE= “192.168.1.5”
be windows based or any operating
system that can run SAMBA server

This is the share name on the remote


window/Samba machine. NOTE you
SMBSHARE= “sharename”
must have sufficient privileges on the
remote machine to read/write/modify

It is
This is the local folder that the remote
recommended
LOCALMOUNT= “/mnt/smbmondo” SMB share is mounted to. NOTE don’t
you DO NOT
change thus unless you understand how.
CHANGE THIS!

This is your username on the remote


SMBUSER= “user”
Windows/Samba machine

This is your password on the remote


SMBPASS= “pass”
Windows/Samba machine.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 10
Daily Backup July 2010

Pogo Plug Information

User provided
VARIABLE NAME Default Value Description
value

Once the ISO’s have been created by


Mondorescue copy them to a
network based Pogo Plug
CPPOGO “0”
0 = Do not copy to the Pogo Plug

1 = Copy to the Pogo Plug

This is the local mount for Pogo Plug


PMOUNT "/mnt/pogoplug" It is recommended you do NOT
change this

This is the username to log into a


PNAME "test1234@nowhere.com" Pogo Plug. Note it should be in the
form of an email address

This is password used in conjunction


PPASS "password" with username to log into a Pogo
Plug

This is the name of the hard drive on


the Pogo Plug you wish to use. NOTE
it is recommended you change the
name of the shared hard drive to
POGOROOT "16gbflash" something without spaces in it.
Spaces in the hard drive name can
lead to unexpected results. This can
be changed on the web based
configuration # my.pogoplug.com

This is the destination directory on


the Pogo Plug. If it does not exist it
will be created. We tested it with a
POGOPATH "test 15" space in the name however it is
recommended you do NOT use
spaces or any special charaters in
the directory name

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 11
Daily Backup July 2010

Rsync information

User provided
VARIABLE NAME Default Value Description
value

This will allow the ISO files to be copied


to the destination via rsync. Generally
this takes less time to do the copy,
except for the first iteration. After the
first time only the deltas (changes) are
copied to the remote storage device.
USYNC “0”
If enabled it will be used on all enabled
methods except for ftp.

0 = Do not use rsync

1 = Use rsync

Gzip information

User provided
VARIABLE NAME Default Value Description
value

With this option gzip will compress the


log file prior to emailing it to the
designated recipient. The log files can
GZIPPEE “0” become very large and be rejected by
mail servers. This is only effective if
sending of logs via email is enabled (as
above)

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 12
Daily Backup July 2010

Email configuration

The configuration of sending automated emails for log files was moved to a separate configuration file.
Many of PIAF support programs now use this file in order to ascertain if log files are to be sent and to
whom the email goes to. This file now resides in /etc/pbx and is called script-email.conf

VARIABLE NAME Default Value User provided value Description

Place your own email address


here, enclosed in double quotes.
EMAIL= “root@localhost” If you leave it the default it will
send the log files to the root
account.

With this setting you can tell the


application to always send a
copy of the logs to the
addressee.
USEEMAIL “1”
0 = Do not email the logs

1= Send the application logs via


email.

NOTE This feature will only work if you have your sendmail/postfix configured to send email outside
of your PBX in a Flash system. Please don’t ask for help on configuring your sendmail/postfix. You
must test your sendmail/postfix install by sending a test message outside of your PBX in a Flash
system.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 13
Daily Backup July 2010

PROCEDURE

In order to install daily-backup.cron and its associated programs the user will have to follow some basic
commands in the PBX in a Flash 1.7.5.5 command line interface. (Hereinafter called the CLI) This
document contains screen captures and step by step instructions so the installation should not present
too many difficulties.

The general order of installation is as follows:

1. Decide which method(s) you will be using to transfer your backup files and to which remote
machines or attached devices. You may choose one or all of them. By default ftp is enabled but
you can also choose to use USB hard/flash drive, SMB, or Pogo Plug.

2. Fill out the information tables above prior to installing the software. If you are going to use a
USB memory stick I recommend it be at least 8gb in size. You will need to follow the steps in
Appendix 1 in order to get the required information to fill out the table above.

3. Install the Software

4. Configure the /etc/pbx/daily-backup.conf file.

5. Test the backup software by running the daily-backup.cron script by “hand”. This may take a
while. Start it running and go away for lunch!

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 14
Daily Backup July 2010

INSTALLING THE SOFTWARE

Please log onto your PBX in a Flash 1.7.5.5 system as root and perform the following steps

STEP 1

Type help-pbx and then tap the ENTER key

As you scroll through it you will see on page 3 the new install-dailybackup program

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 15
Daily Backup July 2010

STEP 2

Type install-diskbackup and then tap the ENTER key. You will see out standard license screen tap the Y
key to agree with the terms and continue

You might see the following screen if the mail configuration file is not present on the system

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 16
Daily Backup July 2010

STEP 3

Next you will see the download screen

If the download is successful you will see the install proceed. If your internet is down you will see the
following

Then

If you see these screens you have problems with your internet connectivity. It is your problem to
diagnose this and not the developers of PBX in a Flash!

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 17
Daily Backup July 2010

STEP 4

As the install progresses you will see the following screens:

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 18
Daily Backup July 2010

Other screens that may be displayed

If you see this screen it means you are trying to run this program on a non PBX in a Flash 1.7.5.5
installation or you are trying to run it on a pre PBX in a Flash 1.7.5.5 install. Unfortunately older installs
of PIAF are incompatible with the new version of the program. If you are running an older version of
PIAF please use the deprecated version as it still works. There are NO plans to back port this version so it
runs in versions prior to 1.7.5.5

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 19
Daily Backup July 2010

Configuring the daily-backup.conf file


We need to edit the /etc/pbx/daily-backup.conf file and add the appropriate information. We
recommend the use of joe for this purpose. It is a powerful text editor and allows you to use the
WordStar commands . All of the following screen captures are show inside of the joe editor
environment.

Log into your PBX in a Flash 1.7.5.5 system as root and in the CLI type cd /etc/pbx and tap the ENTER
key. Now type joe daily-backup.conf and then tap the ENTER key. You should see the screen below.

A few notes about the disk-backup.conf

• The can be no blank lines! Comments always start with a # symbol

• All options MUST be enclosed by double quotes for example: “1”

• There are NO capital O’s as options only Zeros 0

1. The first thing to edit is the master switch. This controls if the conf file is processed. It is shipped OFF

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 20
Daily Backup July 2010

2. Next we edit the configuration options

We recommend you use the defaults

3. Incredible Backup configuration – There is only one option to use it or not.

4. MySQL Dump configuration – There are 3 options. The first is to use this backup method. The
default is set to yes. The other 2 options are related to username and password for MySQL. If you
have not changed this then the defaults will do nicely. There is no reason to change the MySQL
password as MySQL is not accessible except through the local console.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 21
Daily Backup July 2010

5. FreePBX configuration – There are multiple options and we recommend you leave the defaults
alone. The primary one is FPBXBACK which tells the program to use the FPBX backup method. The
options flag allows you to choose what you want FPBX to backup. The default is to backup all files
related to FPBX.

6. Digium License Backups – If you have licenses from Digium, such as g729, it is a very good idea to
back them up separately in order to facilitate easy restore. (They do get corrupted at times!). There
are two options and we recommend you keep the default settings.

7. Altering the FTP information (If you are using ftp to store your backup files)

Now referring to the table at the beginning of this document you need to edit the following fields
with your information IF YOU ARE USING THE FTP TRANSFER FEATURE! The ftp transfer is by default
TURNED ON. Please supply the USERNAME, PASSWORD, REMOTEDIRECTORY, and SERVER. The
DIRECTORY information SHOULD NOT BE CHANGED! Once you have entered the information Hold

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 22
Daily Backup July 2010

down the CONTROL key and tap K then X (if you are using joe) to save the file. Now you need to
reopen the file to continue editing. Press the UP arrow on your keyboard once and Linux will supply
your last command. Now tap the ENTER key and you will be back into the disk-backup.conf file.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 23
Daily Backup July 2010

8. USB Information

From within the editor scroll down the page until you see the following:

You will need to enable using USB hard/flash drives by changing CPFLASH=”1”. We recommend you
leave USBFS and USBMOUNTPOINT set to the defaults. You may need to change the
USBDEVICENAME to what your local USB Hard/Flash drive is referred by the operating system. The
steps required to ascertain this are outline in appendix one of this guide.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 24
Daily Backup July 2010

9. SMB Information

From within the editor scroll down the page until you see the following:

You will need to enable using network attached SMB drives by changing CPSMB=”1”. You will need
to change SMBMACHINE, SMBSHARE, SMBUSER, SMBPASS. DO NOT CHANGE THE LOCALMOUNT!
NOTE SMBMACHINE MUST BE A IPADDRESS ONLY! Using a machine name will not work!

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 25
Daily Backup July 2010

10. Pogo Plug information

One new feature of this program is the ability to backup to an internet attached storage device
referred to as a Pogo Plug. Currently the PIAF Lab backs all of it test machines to a Pogo Plug device
which has a total of 8 TB of storage. The Pogo Plug is stored offsite to help assure business
continuity in case of a disaster. The initial development of using this device with PIAF is all thanks to
Ward © NerdUno.

You will need to enable using network attached Pogo drives by changing CPPOGO=”1”. Do not
change the PMOUNT variable. Your PNAME should be your email address you use to log in to your
Pogo Plug. PPAS is your password for the Pogo Plug. POGOROOT is the name your Pogo Plug assigns
to the hard drives connected to the PP. This is usually the hardware name which can contain spaces.
We recommend you rename the Hard drive to something that does not have spaces in the name.
This can be accomplished by using the web interface to your Pogo Plug. Lastly the POGOPATH is the
name of the backup folder you wish to use under the POGOROOT. It can be anything but we
recommend you do not use spaces in the name. If this directory does not exist it will be created on
the Pogo Plug the first time the daily-backup.cron is ran.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 26
Daily Backup July 2010

11. Log compression facility

This feature allows the log file to be compressed with gzip and sent as a file attachment in an email.
Normally the log file is piped to the body of the email but due to the size some email servers will
reject the message.

Set GZIPPEE to equal “1” to enable this feature.

Testing the daily-backup.cron file

A critical step is to test the daily-backup.cron file. This test will take a very long time. I recommend you
start it and go to lunch. In the CLI type cd /etc/cron.daily and then tap the ENTER key. Now type ./daily-
backup.cron and then tap the ENTER key. Now go away for a while. If everything was configured
properly the command should complete with no error messages on the screen. However your mileage
may vary. I recommend you look at the log file /var/log/daily-backup.cron.log. Check on your
ftp/usb/smb/Pogo sites to see if the files were copied over. There should be a file called
MasterDailyBackup-XXXXXXXXXXXXX.tgz where XXXXXXXXXXXXX is a time-date stamp.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 27
Daily Backup July 2010

Appendix One Restoring your PBX in a Flash 1.7.5.5


Overview

Because there are multiple ways of restoring your PBX in a Flash 1.7.5.5 system we will briefly touch on
this. We really need some volunteers to help write the individual restore steps.

• Incredible PBX backups – This is well documented on Nerdvittles and the restore script needs
some testing. On our test machines it seems to “work” however this method is still classed
EXPERIMENTAL until some brave souls test it some more

• MySQL database dump – If you need to restore you databases this website is a good start
http://crunchbang.org/archives/2007/11/18/bash-script-mysql-backup/ although this has a
more in depth approach http://www.devshed.com/c/a/MySQL/Backing-up-and-restoring-your-
MySQL-Database/1/

• FreePBX – Restoring from a FreePBX based backup

o Extract the FPBX archive out of the MasterDailyBackupXXXXXXX.tgz

o Copy it to /var/lib/asterisk/backups/piafbackup

o Open the FPBX gui in a browser and select the file to restore. Just follow the wizard.

o Questions?: http://www.freepbx.org/support/documentation/module-
documentation/backup-and-restore

• Digium License Restore.

o Extract the DigiumLicense archive from the MasterDailyBackupXXXXXXX.tgz

o Copy it to /var/lib

o Tar –xvzf DigiumLicense*.tgz

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 28
Daily Backup July 2010

Appendix Two Configuring and installing your USB drive

You should repartition and reformat your USB drive using Linux’s fdisk and mkdosfs prior to using it
with PBX in a Flash 1.7.5.5. I have had reports of large USB flash drive (>8gb) not having a properly
formed FAT32 filesystem. This could cause your PBX in a Flash machine to stop and refuse to boot.
Following the steps outlined below will help to prevent this problem from occurring

USE THIS PROCEDURE ON YOUR LARGE USB DRIVES TO CREATE A FAT32 FILESYSTEM OR YOUR PBX IN
A FLASH 1.7.5.5

Setting up your USB Flash Drive

Adding a flash drive can be easily within PBX in a Flash 1.7.5.5 Insert your flash drive into a USB port and
wait a few minutes. Then log in to the Command Line Interface on your PBX in a Flash using putty or a
similar program and do the following.

STEP 1 Where is my drive?

Type dmesg in the CLI and tap the Enter key. You may have to look thru the output until you find
something similar to below.

Notice that Centos calls USB flash drives SCSI. What you are looking for is the SCSI address that the OS
assigned to it. The 9th line from the top tells us that it is device sda. This translates to the path /dev/sda.
Please write this address down in the USB Table at the beginning of this document. Notice on the
second to last line the snippet sda: sda1. This means that the usable partition is actually sda1. Other
names can be sdb, sdc, etc

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 29
Daily Backup July 2010

STEP 2 Partitioning and Formatting the USB Drive

In order to use the drive you need to repartition and format it. This is due to some large USB drives
not being properly created and formatted by the USB manufacturer. This generally affects USB flash
drive 4 gb and above. This will delete ALL existing information on the drive

At the CLI type: fdisk /dev/sda

Then tap the enter key and then tap the “m” key and then the Enter key. You should see a display similar
to below.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 30
Daily Backup July 2010

Now we need to delete the existing partition. Tap the “d” key, and then tap the Enter key. This will
delete the partition.

Now create a new partition on the flash drive. Tap the “n” key and then the Enter key. It will now ask
you for the Command Action tap the “p” key and then tap the Enter key. It is now asking for a Partition
Number. Tap the “1” key and then tap the Enter key. Tap the Enter key twice more.

Change the drive type from linux to FAT32 LBA. Tap the t key and then enter c . You should see a screen
similar to the one below and it will indicate the drive is FAT32.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 31
Daily Backup July 2010

Now write the changes to the disk. Tap the “w” key and then tap the Enter key. Eventually you will see
the screen below.

Congratulations you have successfully repartitioned you USB disk.

Now we need to format the drive using the FAT32 file system. At the CLI type the following

mkdosfs –F 32 -s 32 /dev/sda1

Now tap the ENTER key. You should see something similar to the screen below

You have successfully formatted you USB flash drive to use the FAT32 file system.

STEP 3 How to use the drive?

The manual way to mount and unmount your usb drive is command line based. In order to mount the
drive type the following mount -t vfat /dev/sdc1 /mnt/usbmondo and then tap the ENTER key.

Type cd /mnt/usbmondo and then tap the ENTER key. Type the command ls and then tap the ENTER
key. You have successfully mounted your USB flash drive.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 32
Daily Backup July 2010

In order to unmount the drive type cd /root and then tap the ENTER key, Now type

umount /mnt/usbmondo

And then tap the ENTER key. The USB drive is disconnected from the mount point and no longer
accessible.

For the disk-backup.cron program to work you need to ensure you unmount the USB flash drive. This
helps ensure that your backup files cannot be accidentally modified.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 33
Daily Backup July 2010

Appendix 3 Daily-backup.conf file


#DAILY-BACKUP.CONF
#071010
#This is the external configuration file used by /etc/cron.daily/daily-backup.cron
# Each line must have a # in front of it unless it is used to provide data
#In other words NO BLANK LINES IN THIS FILE AT ALL!!!!
#CURRENTLY EXPERIMENTAL
#
#***********************************************************************
#MASTER SWITCH
#This indicates to disk-backup.cron that this file has been configured!
#You must change it to CONFIGURED="1" for disk-backup.crion to run.
CONFIGURED="0"
#***********************************************************************
#
#
#
#***********************************************************************
#CONFIGURATION OPTIONS
#
#Send log file via email 1=yes 0=no
#Change as needed Default is 1 and will send logs to the local root email account.
SENDLOG="1"
#
#Delete the backup files in /backup/daily after copying to remote device "1" = yes "0" = no
DELBACKUPS="1"
#
#this is the local directory where files are located
#This must exist!
#DO NOT CHANGE
DIRECTORY="/backup/daily"
#***********************************************************************
#
#
#***********************************************************************
#INCREDIBLE BACKUP CONFIGURATION
#
# Use incredible backup methodology 0 = No 1 = Yes
IBACK="0"
#***********************************************************************
#
#
#***********************************************************************
#DATABASE CONFIGURATION
#
#Generate a MYSQL Dump of all databases 1=yes 0=no
#Change as needed
DBBACK="1"
#
#Default Database name for access to MySQL
#Change as needed
DBNAME="root"
#
#Default Database password for root to access MySQL
#Change as needed
DBPASSWORD="passw0rd"
#***********************************************************************
#
#
#***********************************************************************
#FREEPBX CONFIGURATION
#
#Do freePBX backup from this file. Note if this is set to "1" you must
#disable backups in the FreePBX GUI as they are not needed
FPBXBACK="1"
#

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 34
Daily Backup July 2010
#Remove fpbx from /var/lib/asterisk/backups/piafbackup 1=yes 0=no
#change as needed Default is to REMOVE backup files after processing.
REMFILES="1"
#
#These are the flags passed to the freepbx backup script
#1st yes=backup Voicemail
#2nd yes=backup Recordings
#3rd yes=backup Configuration files
#4th yes=backup CDR
#5th yes=backup FOP
#The default is set to yes. If you don't want to back up something replace
#one of the yes's below with a no Please ensure the no is lowercase!
OPTIONS="yes yes yes yes yes"
#***********************************************************************
#
#
#***********************************************************************
#DIGIUM LICENSE CONFIGURATION
#Check for and backup DIGIUM license files. 1=yes 0=no
#It is recommended that you DO NOT CHANGE this setting
LICBACKUP="1"
#
#This specifies which license files if any to back up separately
#Initially this will be for digium licenses
#The Digium files are located in /var/lib/digium
DIGIUMLIC="/var/lib/digium"
#
#***********************************************************************
#
#
#***********************************************************************
#FTP CONFIGURATION
#
#Do ftp backups 1=yes 0=no Change as needed
CPFTP="0"
#
#This should be the user name on the remote ftp machine
#THIS MUST BE CHANGED
USERNAME="ftpuser"
#
#This should be the remote ftp password.Change if needed
#THIS MUST BE CHANGED
PASSWORD="ftppassword"
#
#this should be the remote directory you wish files to go
#into on the ftp server
#Change if needed
REMOTEDIRECTORY="/"
#
#this is the IP address or Fully Qualified Domain Name FQDN of the ftp server
#Change to where you are sending your backups
#THIS MUST BE CHANGED
SERVER="ftp.server.ip"
#
#***********************************************************************
#
#
#***********************************************************************
#USB INFORMATION
#
#Do usb flash drive backups 1=yes 0=no Change as needed
CPFLASH="0"
#
#
#This choice allows you to specify the USB file system to mount. Most 8gb USB keys
#have a FAT32 fs already installed, however there is a problem with the fs ID bit. I
#recommend you format the key with the information contained in manual
USBFS="vfat"

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 35
Daily Backup July 2010
#
#
#USB Mount Point
#This can be modified if you understand how
USBMOUNTPOINT="/mnt/usbmondo"
#
#StickDeviceName
#This may have to be modified depending on what
#the OS assigns to your USB Flash Drive
USBDEVICENAME="/dev/sda1"
#***********************************************************************
#
#
#***********************************************************************
#SMB INFORMATION
#
#Copy files to a remote SMB mount 1=yes 0=no Change as needed
CPSMB="0"
#
#This must be an ip address ONLY Machine names are not acceptable
#THIS MUST BE CHANGED
SMBMACHINE="192.168.1.2"
#
#This is the name of the share on the remote machine
#THIS MUST BE CHANGED
SMBSHARE="sharename"
#
#This is the local mountpoint name and path
#this is created by the install-diskbackup.sh
#DO NOT CHANGE!
LOCALMOUNT="/mnt/smbmondo"
#
#This is the User name on the remote machine
#for example your username on the windows machine where you are copying the files to
#THIS MUST BE CHANGED
SMBUSER="user"
#
#This is your password on the remote machine
#For example your password that corresponds to the username on the remote
#windows machine you are copying files to.
#THIS MUST BE CHANGED
SMBPASS="pass"
#***********************************************************************
#
#
#***********************************************************************
#POGOPLUG INFORMATION *NEW*
#
#Copy files to pogoplug
CPPOGO="0"
#
#This is the location the pogoplug share is mounted to already created by install-diskbackup
#DO NOT CHANGE
PMOUNT="/mnt/pogoplug"
#
#This is the username which is the pogoassigned email address
#THIS MUST BE CHANGED
PNAME="test1234@nowhere.com"
#
#This is the pogoplug password
#THIS MUST BE CHANGED
PPASS="password"
#
#This is the drive name as shared on the pogoplug
#THIS MUST BE CHANGED
POGOROOT="16gbflash"
#
#this is the destination folder on the POGOROOT drive.

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 36
Daily Backup July 2010
#it will be created if not exist only use one folder deep for the moment!
#THIS MUST BE CHANGED
POGOPATH="test 15"
#***********************************************************************
#
#
#***********************************************************************
# RSYNC INFORMATION *NEW*
#
#Use rsync use="1" do not use="0"
USYNC="0"
#
#At the moment the command we are using is rsync -a -v folder/* destination
#If there is demand we will make the command line accessible
#
#***********************************************************************
#
#
#***********************************************************************
#GZIP LOG FILE PRIOR TO EMAIL
# 0 = no gzip 1 = gzip
GZIPPEE="0"

© Copyright 2007 – 2010 PBX in a Flash Development Corporation All Rights Reserved Page 37

You might also like