System back-ups

 

ISPadmin has an automatic data back-up functionality. It is possible to store the backups locally (SW/HW RAID), but also on a remote repository (FTP, NFS, CIFS). It is advisable to store local backups on a partition different from the system one. If the system disk was fully used by backups, it might lead to a damage of the system.

 

Backup settings

It is done in Settings System Settings Backups.

 

System and router backup encryption

icon info2Router backup encryption is off after installation so you can turn it on by running an external script from linux console under root rights.

You can change/set the password with the following script:

/usr/local/script/ispadmin/ispadmin_backup_crypt.pl

If you set password value to -1 encryption will be turned off and it won´t be performed at next backuping.
You will be asked to provide email address during password setup/change. A message about changed password for backups will be sent to this email with both, old and new one. Do not delete this email or at least print out its content and thoroughly keep it somewhere since the password will be needed for restoring the data from a backup. There is no other way of getting or restoring it! Check if emails are sent from the system prior to changing the password. If sending fails no message with new and old passwords will be delivered to you.

 

System and router backups

You can create a backup and search already existing ones in Other Backups.

Manual system backup

You can run manual ISPadmin backup with

ispadmin_backup backup all

This command will execute a complete system backup into /data/backup/incremental/. The whole backup usually takes between 10 to 30 minutes depending on the number of clients, or the amount of backup data. If you have e.g. 8GB of backups and big server load, backups may take longer. However, you have to allow for a slowdown of a web interface during backup.

Run ispadmin_backup to display help for backup and restore script.

ispadmin_backup

+ - - - - - - - - - - - - - - - - - - - - [ ispadmin_backup ] - - - - - - - - - - - - - - - - - - - - - +

This script can help you to backup and recover of ISPamin backup easy way. Well, you can run script this way:

ispadmin_backup [help] [debug] [source-path=SRC-PATH] [path=PATH] MODE SCOPE [BID]

[PATH] Path to the ISPadmin's restore directory. Absolute or relative path can be used.
       Default path is root / !!.
[SRC-PATH] Path to the ISPadmin's source directory for recovery or Backup directory. Absolute path can be used.
           Default path is ISPadmin backup directory /data/backup/incremental/
[MODE] Determine function of script:
backup   - backup system
restore  - restore system from [PATH]

[SCOPE]
all      - recover or backup all files important parts of the ISPamin (auto mode for db, etc, data)
etc      - recover or backup files in /etc
db       - backup the binary MySQL database (only ispadmin,system,mysql db)  and  backup all dump database to  /db_dump
         - recovery the binary MySQL database (only ispadmin,system,mysql db)
db_dump  - recovery all dump databases
graph    - recover or backup graph data in ISPadmin (RRD files)
scripts  - recover or backup scripts of ISPadmin (/usr/local/script/ispadmin)
ispadmin - recover or backup ISPadmin data (/data/support)

[BID] Determine incremental level. If is not given, last backup will be executed as default.

First argument is required ( or backup all ) or second one is optional.
If recover MODE is not given, full recover will be executed as default!

And finaly, a simple example of usage:
   ispadmin_backup restore scripts 401
   ispadmin_backup path=/backup/graph/ restore all
   ispadmin_backup backup
   ispadmin_backup source-path=/home/toor/backup/ backup
 

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (c) NET service solution, s.r.o.  - +

 

  • Usual backup of the whole ISPadmin into default directory /data/backup/incremental/

When run you will be asked if you really want to create backup:

ispadmin_backup backup all

Are you sure want to do the backup  - ALL to /data/backup/incremental/ !!?  [y/n]:

Listing of backup files:

ls -la /data/backup/incremental/

total 9
drwxr-xr-x 9 virtual virtual 1024 Mar 20 12:45 .
drwxr-xr-x 4 virtual root    1024 Mar 20 10:27 ..
drwxr-xr-x 2 virtual virtual 1024 Mar 27 09:55 db
drwxr-xr-x 2 virtual virtual 1024 Mar 27 09:55 db_dump
drwxr-xr-x 2 virtual virtual 1024 Mar 27 09:55 db_dump_last
drwxr-xr-x 2 virtual virtual 1024 Mar 27 09:55 etc
drwxr-xr-x 2 virtual virtual 1024 Mar 27 09:55 graph
drwxr-xr-x 2 virtual virtual 1024 Mar 27 09:55 ispadmin
drwxr-xr-x 2 virtual virtual 1024 Mar 27 09:55 scripts

 

  • Backup of the whole ISPadmin into a user directory, e.g. /new/backup

ispadmin_backup source-path=/new/backup backup all

Are you sure want to do the backup  - ALL to /data/backup/incremental/ !!?  [y/n]:

Listing of backup files:

ls -la /data/backup/incremental/

total 9
drwxr-xr-x 9 virtual root    1024 Mar 27 10:02 .
drwxr-xr-x 3 root    root    1024 Mar 27 10:02 ..
drwxr-xr-x 2 virtual virtual 1024 Mar 27 10:02 db
drwxr-xr-x 2 virtual virtual 1024 Mar 27 10:02 db_dump
drwxr-xr-x 2 virtual virtual 1024 Mar 27 10:02 db_dump_last
drwxr-xr-x 2 virtual virtual 1024 Mar 27 10:02 etc
drwxr-xr-x 2 virtual virtual 1024 Mar 27 10:02 graph
drwxr-xr-x 2 virtual virtual 1024 Mar 27 10:02 ispadmin
drwxr-xr-x 2 virtual virtual 1024 Mar 27 10:02 scripts

 

  • Backup of a system part (backup system is divided into sections as allowed for these options)

ispadmin - system ISPadmin (/data/support/ispadmin)
ispadmin_backup backup ispadmin

scripts - backup of ISPadmin scripts
ispadmin_backup backup scripts

graph - backup of all client graphs at day end, stored as static images. (/data/support/ispadmin/client_images/)
ispadmin_backup backup graph

etc - backup of entire linux config directory
ispadmin_backup backup etc

db - backup of binary DB - ISPadmin tables, system, mysql
    - backup of all dumped mysql databases into ./db_dump
    - newly created directory ./db_dump_last/, for storing currently dumped files from the last backup
ispadmin_backup backup db

alert icon Always back up your current data prior to any restoration.
icon info2 Important directories are: /data/support, /usr/local/script/ispadmin, /var/lib/mysql and /etc


From backup directory /data/backup/incremental/ to /. System data will be overwritten!!! So use it only in case that you have the ISPadmin data damaged and you want to replace them with the backup data.

alert icon If you are restoring complete data set to a new server with another Debian version we cannot recommend this restoration type since system configuration directories are restored in /etc and a different OS version may use different format and syntax for the files. So we recommend a partial restoration - see below. (no restoration of /etc followed by restoration of /etc to another place in the system with manual configuration of system settings - apache, hosts, dns,... ).


If your backups are encrypted you will be asked for password for backups, and the system will ask you again if you want to proceed with the restoration.

ispadmin_backup source-path=/data/backup/incremental/ path=/ restore all

Type Postcode password : Your_password_for_backups

Restore script started.

Recover will destroy actual data on the server! Do backup before the recovery is a good idea.
Are you sure want to do the restore  - from /data/backup/incremental/ directory to /  !!?  [y/n]:

This way you can restore data from the last full backup including the increments since the last full backup (if they are set).

alert icon For correct restoration, you have to have all previous backup data ready and working. It is not enough to copy just the last “5th day” of the backup with numerical identification. (e.g. Ispadmin_scripts.5.tar.gz)

 From user directory /data/backup/incremental/ to /. System data will be overwritten!!! So use it only in case that you have the ISPadmin data damaged and you want to replace them with the backup data.
Example: Today is March 30, 2012 and you want to restore data from March 27, 2012.
How to do it: You need to find out number of backup done on March 27, 2012. You will do so with:

ls -la /data/backup/incremental/ispadmin/

total 188712
drwxr-xr-x 2 virtual virtual     2048 Mar 29 07:51 .
drwxr-xr-x 9 virtual virtual     1024 Mar 27 10:55 ..
-rw-r--r-- 1 virtual root       13697 Mar 29 07:46 backup2l_ispadmin.conf
-rw-r--r-- 1 virtual root         390 Mar 26 10:55 Ispadmin_ispadmin.1.check
-rw-r--r-- 1 virtual root         107 Mar 26 10:55 Ispadmin_ispadmin.1.error.gz
-rw-r--r-- 1 virtual root      106410 Mar 26 10:55 Ispadmin_ispadmin.1.list.gz
lrwxrwxrwx 1 virtual root          27 Mar 26 10:55 Ispadmin_ispadmin.1.new.gz -> Ispadmin_ispadmin.1.list.gz
-rw-r--r-- 1 virtual root          51 Mar 26 10:55 Ispadmin_ispadmin.1.obsolete.gz
-rw-r--r-- 1 virtual root         440 Mar 26 10:55 Ispadmin_ispadmin.1.skipped.gz
-rw-r--r-- 1 virtual root    64043583 Mar 26 10:55 Ispadmin_ispadmin.1.tar.gz
-rw-r--r-- 1 virtual root         390 Mar 27 13:15 Ispadmin_ispadmin.2.check
-rw-r--r-- 1 virtual root         107 Mar 27 13:15 Ispadmin_ispadmin.2.error.gz
-rw-r--r-- 1 virtual root      106139 Mar 27 13:15 Ispadmin_ispadmin.2.list.gz
lrwxrwxrwx 1 virtual root          27 Mar 27 13:15 Ispadmin_ispadmin.2.new.gz -> Ispadmin_ispadmin.2.list.gz
-rw-r--r-- 1 virtual root          51 Mar 27 13:15 Ispadmin_ispadmin.2.obsolete.gz
-rw-r--r-- 1 virtual root         436 Mar 27 13:15 Ispadmin_ispadmin.2.skipped.gz
-rw-r--r-- 1 virtual root    64043616 Mar 27 13:15 Ispadmin_ispadmin.2.tar.gz
-rw-r--r-- 1 virtual root         390 Mar 29 07:47 Ispadmin_ispadmin.3.check
-rw-r--r-- 1 virtual root         107 Mar 29 07:47 Ispadmin_ispadmin.3.error.gz
-rw-r--r-- 1 virtual root      106139 Mar 29 07:46 Ispadmin_ispadmin.3.list.gz
lrwxrwxrwx 1 virtual root          27 Mar 29 07:47 Ispadmin_ispadmin.3.new.gz -> Ispadmin_ispadmin.3.list.gz
-rw-r--r-- 1 virtual root          51 Mar 29 07:46 Ispadmin_ispadmin.3.obsolete.gz
-rw-r--r-- 1 virtual root         436 Mar 29 07:46 Ispadmin_ispadmin.3.skipped.gz
-rw-r--r-- 1 virtual root    64043616 Mar 29 07:47 Ispadmin_ispadmin.3.tar.gz

Now you know that data to be restored from March 27, 2012 have number 2. You can now proceed to the restoration. Type restoration command and add number of backup at the end. This way you ensure that the last backup from March 29, 2012 will not be restored, but rather the backup from March 27, 2012.
If your backups are encrypted you will be asked for password for backups, and the system will ask you again if you want to proceed with the restoration.

ispadmin_backup source-path=/data/backup/incremental/ path=/ restore all 2

Type Postcode password : Your_password_for_backups

Restore script started.

Recover will destroy actual data on the server! Do backup before the recovery is a good idea.
Are you sure want to do the restore  - from /data/backup/incremental/ directory to /  !!?  [y/n]:

This way you can restore data from any full backup or the increments including latest full backup (if they are set).

alert icon All this providing all backups in relevant sections (ispadmin,scripts,graph,db,etc) will have the same number for respective restoration day. Otherwise data from the day corresponding to backup number will be restored. Database restoration is done from db_dump backup in import of backed-up dump file of individual databases.

Similarly to backups of individual system parts, you have the following options:

ispadmin - system ISPadmin (/data/support/ispadmin)
ispadmin_backup source-path=/data/backup/incremental/ path=/ restore ispadmin all

scripts - scripts ISPadmin
ispadmin_backup source-path=/data/backup/incremental/ path=/ restore scripts all

graph - client graphs
ispadmin_backup source-path=/data/backup/incremental/ path=/ restore graph all

etc - linux config directory
ispadmin_backup source-path=/data/backup/incremental/ path=/ restore etc all

db - database
Example: Let´s assume your ISPadmin database has been damaged due to a blackout. Today is March 30, 2012 and you know that the database could have been damaged after March 27, 2012 when the blackout happened and your server did not run.
You need to restore database as per March 27, 2012.
You have basically 3 options:

  • Restoration of entire ISPadmin

See Typical restoration, or Older backup restoration

  • Restoration of latest text backup of the system

You can restore latest text or binary backup with ispadmin_backup source-path=/data/backup/incremental/ path=/ restore db_dump all

Or you can restore a specific older backup - how to determine its number see Older backup restoration - then you run ispadmin_backup source-path=/data/backup/incremental/ path=/ restore db_dump all 2, where 2 stands for backup number. Restoration script will ask you if you really want to restore each database (press Enter).

  • Restoration of latest binary backup of the database

You can restore latest text or binary backup with ispadmin_backup source-path=/data/backup/incremental/ path=/ restore db all

Or you can restore a specific older backup - how to determine its number see Older backup restoration - then you run ispadmin_backup source-path=/data/backup/incremental/ path=/ restore db all 2, where 2 stands for backup number. Restoration script will ask you if you really want to restore each database (press Enter).

Use this option especially for cases when you need to go through backup data (e.g. to find out a presence of a certain file in older backup).

ispadmin_backup restore all

Type Postcode password : Your_password_for_backups

Restore script started.

Recover will destroy actual data on the server! Do backup before the recovery is a good idea.
Are you sure want to do the restore  - from /data/backup/incremental/ directory to /backup/  !!?  [y/n]:

Listing of /backup folder contents

ls -la /backup
total 6
drwxr-xr-x  6 root root 1024 Mar 27 11:00 .
drwxr-xr-x 33 root root 1024 Mar 27 10:53 ..
drwxr-xr-x  4 root root 1024 Mar 27 11:00 data
drwxr-xr-x  4 root root 1024 Mar 27 11:00 etc
drwxr-xr-x  3 root root 1024 Mar 27 11:00 restore_mysql_dump
drwxr-xr-x  3 root root 1024 Mar 27 11:00 usr

alert icon You have to copy a complete directory structure of backups from FTP server into a new directory, e.g. /old_server/. So if you want to restore backup No. 3 from FTP you have to copy all previous backups 1 and 2 as well.

Then carry on with restoration using the command ispadmin_backup source-path=/old_server/ path=/restore/  restore all if you are restoring into restore, or ispadmin_backup source-path=/baa/ path=/ restore all if you are restoring the real system.

alert icon Real database will be restored with backed-up data in both cases.

You may opt for restoring certain sections as well (ispadmin, etc, graph, scripts), e.g. ispadmin_backup source-path=/baa/ path=/restore/ restore ispadmin all or you can add number of backup from /old_server/.

 

Related articles:

 

CONTACT

NET service solution, s.r.o.
Žerotínova 3056/81a
787 01 Šumperk
Czech Republic