Backup & Restoration

In by castcontrol

Important Information

    • Backups are stored by default in /usr/local/mediacp/backup/mediacp_yyyymmdd.tar
    • You can specify the location of a backup with the option –backup-dir=
    • Please make sure there is enough space in /usr/local/mediacp for your backups
    • Restoration process can only restore MediaCP from version or newer.
    • A valid license with support & upgrades package is required to complete the restoration process.

Full Backup (MediaCP + Media Files)

A full backup will take a backup of the MediaCP as well as all your media content files. This may take some time to process while it archives all your media files.

Firstly, we recommend checking the how large the MediaCP directory is and also the disk space available on your system using:

# du -h --max-depth=1 /usr/local/mediacp | tail -1
# df -h

You can then specify the location to store the backup with the option  –backup-dir=

# /usr/local/mediacp/mediacp.bin backup --backup-dir=/backups/

Backup of only MediaCP

A partial backup is much faster and will backup all MediaCP system files and database required for critical operation. Media content files are excluded and should be backed up separately.

# /usr/local/mediacp/mediacp.bin --no-contents backup

Automated Backups

The below crontab example will perform the following:

  • Delete backups older than 7 days
  • Nightly backup of MediaCP Software ONLY
  • Weekly backup of MediaCP Software + Media Content Files

Step 1: Open your system cron file for user mediacp:

# crontab -u mediacp -e

Step 2: Copy and Paste the following into the crontab file:

0 0 * * * find /usr/local/mediacp/backup/*.tar -mtime +7 -exec rm {} \>/dev/null 2>&1; # retention
0 0 * * * /usr/local/mediacp/mediacp.bin --no-contents backup --backup-dir=/backups/; # nightly backup
0 1 */7 * * /usr/local/mediacp/mediacp.bin backup --backup-dir=/backups/full/; # weekly backup

Step 3: Save your crontab file.

Of course, It is also recommended to save your backups to a safe location so look at the next section on how to set the backup location.

Change backup location

To change the location of backups, we recommend that you configure a symlink to the new location.

For example, if you wish to configure a mounted drive at /home2/backup/ as the backup destination you can run the following commands to set this up:

# rm -rf /usr/local/mediacp/backup/;
# mkdir -p /home2/backup/;
# chown mediacp:mediacp -R /home2/backup/;
# ln -s /home2/backup/ /usr/local/mediacp/backup/;


The backup restoration will perform the following:

  • New installation of MediaCP Web Services (Apache, MySQL, PHP, etc)
  • New installation of Media Services (Wowza Streaming Engine, Icecast, LiquidSoap, etc)
  • Restoration of MediaCP htdocs/
  • Restoration of MediaCP Database
  • Restoration of media services content files

Step 1: Copy the backup file to your server .

Step 2: Run the following to start the restoration software:

cd /root;rm -f init;wget;chmod +x init;./init restore

Step 3: You will be prompted for your license key.

Step 4: You will be prompted for the full path to your backup file.

Step 5: You will be prompted for the domain name for the MediaCP to be installed on

The restoration may take some time to complete.

If you have difficulty, please get in touch with our support team.