Backup module (dar, available in versions 5.34.0 - 5.52.0 )

From ISPWiki
Jump to: navigation, search

ISPmanager 5.34 - 5.52 uses a backup system based on DAR. Starting from version 5.52 this system is changed into ISPtar.

New features

The main differences from the old backup system:

  • A separate backup copy is created for each user.
  • Filters are no longer used. Server administrators can exclude file copies, directories, databases (by default, all user data are backed up), or exclude a certain user from the backup.
  • Only one storage can be used, however, you can easily switch between storages. In this case, you won't be able to use backups on the first storage, and can access backups on the second storage.
  • Backups are made once a day. The first weekly backup copy (the week starts from Sunday) is Full, other copies - Incremental. You can change the backup period in the Cron configuration form.
  • You can set limits on total backup size. Once the limit is reached, the system will delete the oldest copies, and store the equal number of daily and weekly backups, if possible.
  • If the total backup size is not limited, and there is no free disk space on the storage, the system will delete the oldest backups.
  • The maximum number of backups to store on the system: 7 full weekly backups and 7 incremental daily backups. You can change this with the BackupCountLimit parameter in the etc/ispmgr.conf configuration file.
  • Users can now download their backups, and upload them to server.

DAR delivers a number of advantages:

  • A backup copy is divided into small volumes (20 MB in size by default) allowing to reduce time in case of partial data and the amount of free disk space to create and restore a backup copy.
  • There is no need to compress some types of files. This enables to reduce CPU usage during backup. You can also choose an archiver and compression level using DAR /etc/darrc
  • Files can be restored using DAR rather than via ISPmanager.

Module configuration

Click Settings in the Backups module to select and configure a storage, provide the total number of backups to store on the system, files and databases that you want to exclude from backup.

Go to the Scheduler module -- select ISPmanager backup task to set backup start time.

You can use the nice and ionice utilities to set priorities. In the etc/ispmgr.conf configuration file add the BackupCommandPrefix parameter to set priorities, which is set to nice -n 10 ionice -c2 -n7 by default.

For more details, please refer to Backup_configuration

View old file version

To view contents of an old file, download the file from the backup.

Importing data from another provider

You can import backups from other servers. Click the "Import" icon, choose a source type, and click OK.

Restoring server

To restore backups, select a storage type and its parameters. If you stored your backups on Amazon S3, after you have finished with the backup module configuration, the backups will be available on your server.

Full user recovery

To restore a user and his data, click the "Import" button in the list of backup copies. Choose a source and select the "Restore upon import". After importing the archive, the data will be restored.

Excluding files from a backup copy

Go to the Backups module to choose files you want to exclude from the backup copy. Enter paths relative to the user's home directory, e.g. data/.filemgr-tmp. The files that you select won't be backed up.

Changing backup start time

By default, backups are made once a day. In the Scheduler module you can change this period for ISPmanager backup task.

Setting backup time

The BackupTimeIterval parameter enables to set backup time. E.g.: BackupTimeIterval 03:00:00-06:00:00 means that the backup process will start from 3 to 6 a.m. The process for a separate user won't be interrupted. If the system failed to back up all users within that period, the process will start the next day. New copies for that day won't be created.

E.g.: on Monday, September 14, 2015 we backed up 10 users from 15, and remaining 5 users will be backed up on Tuesday. The next backup copy for all users will be created on Wednesday, September 16, 2015. User backups will be dated 14.09.2015, although some users were backed up only on September 15, 2015.

Clearing disk space in the storage

To free up disk space, you can set the Total size in the Backups module. Once you are done, old backups will be deleted until the total size reaches the specified value.

Speeding up the backup process

If you want to make a large backup copy, you can change the priority in the etc/ispmgr.conf configuration file with the BackupCommandPrefix parameter. nice -n 10 ionice -c2 -n7 is set by default.

The nice utility invokes a utility, requesting that it be run with a different system scheduling priority. More details can be found here

ionice enables to get and set the class and process priority.

Service files of a backup copy

Once the backup copy has been made, the files 2015-08-12.user.1.dar and 2015-08-12.user.info will be created in /usr/local/mgr5/var/backup/ispmgr. They keep service information and do not contain the backup itself.

The dar file contains information about backup files.

The info file contains information about its creation date, the name of the last backup file, backup size and type.

Such files make it possible to show backup copies in the list and reduce time required to access the data.

Odd number of backup copies

If the BackupCountLimit parameter is an odd number, for example, 15, 8 full backups and 7 daily incremental backups will be created. When the limit is exceeded, daily incremental backup will be deleted first.

Objects excluded from backup

Due to technical reasons, mailbox filters are excluded from backup.

How often backup can be made

A user can create a backup copy only once an hour, otherwise the previous backup copy will be downloaded.

Backup copy of a removed user

After deleting the user whose data were backed up, the "!" icon will be displayed in the list of saved data. This icon won't be deleted upon user restore.

Correspondence between full and daily backup copies

When the backup process starts for the first time, a full backup copy will be made. Next days daily incremental copies will be created. On Sunday a full backup will be made. During the first 14 days 3 full and 11 incremental backups will be made. After 14 days are passed, the oldest copies will be deleted first. Once the full copy doesn't have any incremental parts, it will be deleted. Thus, 7 full and 7 incremental backups will be left in about 2 months.

Deleting backup

To delete a backup copy, open the /usr/local/mgr5 directory and execute sbin/backup2_cp --delete. Specify a path to the info file of the backup copy, storage type, and token.

A storage type and token are stored in etc/ispmgr.conf, parameters BackupType and BackupToken correspondingly.

The following example shows deletion of the local storage backup copy of the certain user user:

sbin/backup2_cp --delete var/backup/ispmgr/2015-09-08.username.info --type local --token /var/backup

The following example shows deletion of all copies in the local storage:

ls -1 var/backup/ispmgr/*.info | xargs -I {} sbin/backup2_cp --delete {} --type local --token /var/backup

Changing volume size

Starting from version 5.38 you can change the volume size in the etc/ispmgr.conf configuration file.

Example:

BackupSliceSize 30M

Restoring database with user permissions

To restore a database with user permissions, you first need to create an empty database with the same name, and database users.

Starting from version 5.39 data cannot be restored from backup copies unless databases with the same names are created. They will be marked with the corresponding icons.