Backup and Restore
ServBay offers powerful backup and restore features, making it easy for developers to protect critical data in their local development environment, including website files, databases, SSL certificates, and ServBay's own configuration. Regular backups are crucial to prevent data loss.
Backup Settings
You can find the Backup
option in the left sidebar of the main ServBay interface. Click it to enter the backup management center. The Backup Settings
section lets you configure automatic backup strategies and select what to back up.
1. Backup Folder
- Function: Specifies the storage location for all backup files.
- Default Path:
/Applications/ServBay/backup
- You can click the folder icon to set a custom path for storing backups. It's recommended to choose a drive with ample and secure storage space.
2. Auto Backup
- Switch: Turn the
Auto Backup
toggle on or off to enable or disable automatic backups. - Backup Frequency (Every):
- Daily: Runs a backup once per day.
- Weekly: Runs a backup once a week.
- Monthly: Runs a backup once a month.
- Execution Time: Set the specific time (hour and minute) to trigger automatic backups. For example, setting it to
03:00
will run the backup at 3 AM.
3. Categories
Select which types of data you want to include in the automatic backup:
- Config: ServBay's core configuration files.
- Websites: All files and directories under
/Applications/ServBay/www
. - SSL: All added SSL/TLS certificate files.
- MySQL: Backs up all MySQL databases. (Note: Only running MySQL services will be backed up)
- MariaDB: Backs up all MariaDB databases. (Note: Only running MariaDB services will be backed up)
- PostgreSQL: Backs up all PostgreSQL databases. (Note: Only running PostgreSQL services will be backed up)
Check the boxes for the categories you want to include in the automatic backup schedule.
Once you’ve finished configuring everything, click the Save
button in the lower right to save your settings. Click Reset
to revert to the default settings.
Manual Backup
In addition to automatic backups, you can also perform manual backups for specific data types at any time.
For example, to back up a MariaDB database:
- Under the
Backup
menu on the left sidebar, selectMariaDB
. - You will see the MariaDB backup management screen.
- Check the specific database(s) you want to back up (e.g.,
servbay
), or checkBackup All DBs
to back up all databases under the MariaDB service. - Click the
Manual Backup
button at the bottom right. - ServBay will immediately execute the backup task and add the backup file to the list below.
Backing up MySQL and PostgreSQL databases follows a similar process—simply select the corresponding database type under the Backup
menu. You can also back up Websites
and SSL
by clicking the Manual Backup
button under their respective categories (if available on the interface).
Backup Management
In the management interface for each backup category (such as MariaDB, MySQL, PostgreSQL, Websites, SSL, Config), you’ll find a list of all generated backup files. The list usually includes the following information:
- Filename: Name of the backup file, typically including date, time, and a unique identifier.
- Date: When the backup was executed.
- Size: Size of the backup file.
- Note: Related notes, such as the database version.
- Control: Buttons for managing each backup file:
- Folder: Click the folder icon to open the backup file’s storage location.
- Restore: Click the circular arrow icon to restore using this backup file. Use with caution!
- Delete: Click the trash can icon to delete the backup file and free up disk space.
Restore Operation
Warning: The restore operation will overwrite current data with the data from the selected backup file. Before restoring, it is highly recommended to manually back up your current state to prevent accidental loss or rollback to an incorrect state.
To restore data from a backup:
- Go to the backup management screen for the data category you want to restore (e.g.
Backup
->MariaDB
). - Locate the backup file you want to use in the backup list.
- Click the Restore icon (circular arrow) next to that backup file.
- The system may prompt you to confirm the restore operation. Please read the message carefully.
- Once you confirm, ServBay will begin the restore process. The time required depends on the backup file size and your system’s performance.
The restore operation will affect:
- Config: ServBay settings.
- Websites: Files under
/Applications/ServBay/www
. - SSL: Installed SSL certificates.
- MySQL/MariaDB/PostgreSQL: The relevant database contents.
Notes & Recommendations
- Storage Space: Backup files consume disk space. Make sure your backup directory has enough available storage. Regularly clean up old backups you no longer need.
- System Resources: Backups—especially for large websites or databases—can consume substantial CPU and I/O resources. It’s best to run backups during periods of low system load.
- Database Status: Both automatic and manual database backups require the relevant database service (MySQL, MariaDB, PostgreSQL) to be running. If the service is stopped, backups may fail or be skipped.
- Backup Verification: Periodically test restoring backups in a staging or test environment to ensure file integrity and recoverability. Don’t wait until you actually need to restore to find out there’s an issue.
- Backup Strategy: Set backup frequency and how long to retain backups based on project importance and how frequently the data changes.
Summary
ServBay's backup and restore features are essential tools for ensuring the security of data in your local development environment. With straightforward configuration, you can automate backups and use manual backup and restore operations to flexibly manage your website files, databases, and settings. All ServBay users are strongly recommended to enable and regularly check their backup settings to ensure that your valuable work is properly protected.