2 5. Backup
René Kreijveld edited this page 2026-05-31 08:43:28 +02:00

Backup

jbackup

Create a full backup of a Joomla site: a database dump plus a compressed archive of all site files.

Usage

jbackup [-n <name>] [-b] [-z] [-t] [-o] [-s] [-h]

Options

Option Description
-n <name> Name of the site to back up. If omitted, the current directory name is used.
-b Save the backup in the backup folder
-z Create a .zip archive instead of the default .tgz
-t Add a date/time-stamp to the backup filename
-o Overwrite existing backup file and/or database dump without prompting
-s Silent - suppress all messages
-h Display help

What it does

  1. Exports the database to db.sql.gz in the site folder using ddev export-db
  2. Creates a compressed archive of all site files (including hidden files and folders) in the project root folder or in BACKUPFOLDER when -b option is used
  3. Removes the temporary db.sql.gz from the site folder
  4. Displays the backup path and restore instructions

Output location

Backups are saved in the root folder of the project unless the -b is used. In that case the backup is save to the BACKUPFOLDER defined in your configuration:

  • <sitename>.tgz - default
  • <sitename>.zip - with -z
  • <sitename>.20240315.143022.tgz - with -t

Restoring a backup

To restore a .tgz backup:

cd ~/Development/sites/mysite
tar xzf mysite.tgz

To restore a .zip backup:

cd ~/Development/sites/mysite
unzip -q -o mysite.zip

After restoring the files, import the database:

jdbimp

Examples

Back up the current site:

cd ~/Development/sites/mysite
jbackup

Back up a named site with a timestamp and zip format and store in the backupfolder:

jbackup -n mysite -b -z -t

Back up silently, overwriting any existing backup:

jbackup -n mysite -o -s

jbackupall

Create a full backup of all DDEV Joomla projects. This script scans for all Joomla installations and runs jbackup for each one, saving the backups to the configured backup folder.

Usage

jbackupall [-z] [-t] [-s] [-h]

Options

Option Description
-z Create .zip archives instead of the default .tgz
-t Add a date/time-stamp to the backup filenames
-s Silent - suppress all messages
-h Display help

What it does

  1. Scans the ROOTFOLDER (defined in your configuration) for all Joomla installations by locating configuration.php files
  2. Runs jbackup -b for each found project, saving all backups to the configured BACKUPFOLDER
  3. Passes through any zip (-z), timestamp (-t), and silent (-s) options to each jbackup call

Examples

Back up all Joomla projects:

jbackupall

Back up all projects as zip files with timestamps:

jbackupall -z -t

Back up all projects silently:

jbackupall -s