generaldrupal

Create and restore application backups

Backup

The Bitnami package for Drupal application data files are installed in a different directory from the application’s runtime/binary files. The simplest way for performing a full backup is to copy or compress both directories. To do so in a safe manner, you will first need to stop all servers, so this method may not be appropriate if you have people accessing the application continuously.

NOTE: If you want to create only a database backup, refer to these instructions for MySQL/MariaDB.

Follow these steps:

  • Change to the directory in which you wish to save your backup:

      $ cd /your/directory
    
  • Stop all servers:

      $ sudo /opt/bitnami/ctlscript.sh stop
    
  • Create a compressed file with the directory containing application data files:

      $ sudo tar -pczvf application-backup.tar.gz /bitnami
    
  • Additionally, to make a full backup, create a compressed file with the directory containing application binaries and runtime files:

      $ sudo tar -pczvf application-bin.tar.gz /opt/bitnami
    
  • Restart all servers:

      $ sudo /opt/bitnami/ctlscript.sh start
    

You should now download or transfer the application-backup.tar.gz and application-bin.tar.gz files to a safe location.

Restore

Follow these steps:

  • Change to the directory containing your backup:

      $ cd /your/directory
    
  • Stop all servers:

      $ sudo /opt/bitnami/ctlscript.sh stop
    
  • Move the current stack to a different location:

      $ sudo mv /opt/bitnami /tmp/bitnami-backup
    
  • Uncompress the backup file with the application data files to the original directory

      $ sudo tar -pxzvf application-backup.tar.gz -C /
    
  • Additionally, to restore a full backup, uncompress the backup file with the application binaries and runtime files to the original directory

      $ sudo tar -pxzvf application-bin.tar.gz -C /
    
  • Start all servers:

      $ sudo /opt/bitnami/ctlscript.sh start
    

IMPORTANT: When restoring, remember to maintain the original permissions for the files and folders. For example, if you originally installed the stack as the root user on Linux, make sure that the restored files are owned by root as well.

Last modification February 9, 2023