Are you looking to backup Magento 2 store?
Great decision.
Backups can be a lifesaver in case of hacking, file corruption, and any unfortunate and unexpected event.
People ignore backups, thinking there is always time. Until there is no time to do it, they find themselves in a situation where they need the backups.
The best time to backup a Magento 2 store is now.
Why is Magento Backup Important?
The aim of the Backup is to have a secure copy of your store all the time, so if something happens to the original, you can replace it with the copy.
Cyber-attacks, hackers, outdated themes and extensions, poorly coded modules, and incompatible technology can break the Magento store.
Without backups, you will be stuck with hours of work to clean your store and revamp it.
The store changes new files and folders, data, and orders every day. So you have to create the Backup every day to keep the copy updated. This can be done by scheduling the Backup.
This quick tutorial will show you how to backup Magento 2 store. You do not need to install any Magento extension for backups.
How to Backup Magento 2
There are three methods to backup Magento 2:
I’ll discuss each of the methods here.
#1 Magento 2 backup via Command Line
You can take the Magento 2 backup with the CLI. Run the following command to start the Backup:
magento setup:backup [--code] [--media] [--db]
- –code: Backing up the whole Magento system, excluding var and pub/static folders
- –media: Backing up pub/media folder
- –DB: Backing up Magento 2 database
The command will enable the maintenance mode, make the Backup, and then disable the maintenance mode. However, you have to be a system file owner to execute the command.
#2 Backup Magento 2 via Admin Panel
If you have admin dashboard access, you can take the Magento backup from there too.
Log in to the Admin panel and navigate to System > Tools > Backups.
Follow the below steps:
#2.1 Select the Backup Type
The admin panel offers three types of backup types:
- System Backup: Creates and saves a complete copy of the database and the file system. You may include a backup to the media folder as per your choice.
- Database and Media Backup: Creates a full copy of the current database and the media folder
- Database Backup: Only forms and stores a copy of the database.
When taking Magento 2 backup, you should:
- Enable the maintenance mode option during the Magento backup to avoid any inconvenience. Once you are done taking the Magento backup, maintenance mode will turn off automatically.
- If you want to include the media folder, don’t forget to check the Include Media folder to System Backup.
#2.2 Name the Backups
- Backup Name: Enter the term you want to name the Backup. When creating a backup name, use only a-z/A-Z letters, 0-9 numbers, and spaces.
- Maintenance Mode: You may enable the maintenance mode in your store during the backup, which will result in reduced page speed, but the site will be inaccessible at the time of the process until the maintenance mode is turned off again.
- Exclude: You can exclude the media folder from taking Backup. Including the Media folder will increase the backup size.
#2.3 Verification
A notification will be displayed: The Backup is Complete.
It means the Backup is successful, and everything went fine. There are no errors to worry about.
#3 Using Breeze to Backup Magento 2
If your Magento store is on Breeze, you do not have to do anything and let Breeze manage the backups. You can schedule the daily automatic backups and forget about them.
Here are a few simple steps to take the backups to your local computer.
- Login to your Breeze Platform
- Select the Company you would like to work on
- Click on the ‘Sites’ to open the site list.
- Open the ‘Store’ whose Backup you like to download.
- Click the ‘Backups’ option from the list.
Manual Backup: You can manually start the Backup anytime from the Breeze platform.
Number of Backups: The number of backups depends on the plans.
Automatic Daily Backup: You can enable the automatic Backup, and Breeze will do it for you.
Retention time: The retention time depends on the plan and Backup type. The manual Backup does not get deleted until you run out of backup amount. Then it will delete the outdated Backup to make space for the recent Backup.
Wrap Up
I hope this tutorial helped you to take the Magento 2 backup. This quick article highlights the importance of keeping the updated Backup of the Magento store.
You can use the inbuilt Magento 2 feature, run several commands or use Breeze to take the Backup. However you do, you must ensure the backups are active.
If you do not get time to manage the backups, a managed Magento hosting could be the solution for you.
At Breeze, we keep the Backup of all the stores, and you can access them at any time. Besides backups, the Breeze platform has many features that secure your store and speed up the website.
If you have any questions or queries, feel free to ask anytime in the comment section below.