{"id":115,"date":"2018-06-07T12:46:32","date_gmt":"2018-06-07T12:46:32","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2018\/06\/07\/backup-magento-2\/"},"modified":"2025-11-20T10:49:48","modified_gmt":"2025-11-20T05:19:48","slug":"backup-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/backup-magento-2\/","title":{"rendered":"How to Backup Magento 2 (&amp; Roll Back)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Taking a timely Magento 2 backup is your best defense against unwanted accidents that happen anytime while running an online store.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This blog teaches you the exact method to backup Magento 2 stores easily and safely.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Types of Magento 2 Backup\u00a0<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 offers three specific native backup:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>System Backup<\/li>\n\n\n\n<li>Database and Media Backup<\/li>\n\n\n\n<li>Database Backup<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">System Backup<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This backup type creates a complete snapshot of your entire store. Here is what this backup includes and excludes:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 <strong>Includes:<\/strong> The entire File System (source code, extensions, themes), the Database, and (optionally) the Media files.3<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u274c <strong>Excludes:<\/strong> Temporary directories like var\/cache, var\/log, and pub\/static (generated assets) are excluded to save space.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Database and Media Backup<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This backup secures your dynamic data\u2014the content that changes daily. It skips the core code files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 <strong>Includes:<\/strong> The SQL Database dump and the pub\/media folder (product images, WYSIWYG uploads).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u274c <strong>Excludes:<\/strong> The core Magento application code (app, vendor, lib).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Database Backup<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is the &#8220;lightweight&#8221; option. It is fast and requires very little storage space.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong> \u2705<\/strong> <strong>Includes:<\/strong> Only the SQL dump of your database tables (customers, orders, configurations, catalog data).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u274c<\/strong> <strong>Excludes:<\/strong> All files, images, and code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Backup a Magento 2 store? (Three Methods)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the three methods, you can take your store backup. You can opt for any of the method based on your technical knowledge. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 1: Backup Magento 2 via Command Line<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Switch to the Magento file system owner and use the backup command.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command performs the following sequence: enables maintenance mode, backs up the selected files (database, media, system), and finally disables maintenance mode.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">magento setup:backup [--code] [--media] [--db]\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here is what the command means:&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Command Options<\/strong><\/td><td><strong>Meaning<\/strong><\/td><\/tr><tr><td>\u2013code<\/td><td>Backing up whole Magento system excluding var and pub\/static folders<\/td><\/tr><tr><td>\u2013media<\/td><td>Backing up pub\/media folder<\/td><\/tr><tr><td>\u2013db<\/td><td>Backing up Magento 2 database<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Method 2: Backup Magento 2 via Admin Panel<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Log in to your Magento 2 admin panel and navigate to <strong>System &gt; Tools &gt; Backups. <\/strong>Then, follow the below steps:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1: Select the Backup Type<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">You get three options to select the backup you want: System Backup, Database and Media Backup, and Database Backup.\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"273\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Select-the-type-of-Magento-2-backup-1024x273.png\" alt=\"Select the type of Magento 2 backup\" class=\"wp-image-24390\" srcset=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Select-the-type-of-Magento-2-backup-1024x273.png 1024w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Select-the-type-of-Magento-2-backup-300x80.png 300w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Select-the-type-of-Magento-2-backup-768x205.png 768w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Select-the-type-of-Magento-2-backup-1536x410.png 1536w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Select-the-type-of-Magento-2-backup-2048x546.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2: Add Backup Details\u00a0<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Now, add the needed backup details.\u00a0\u00a0<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Backup Name<\/strong>: Add a name using only a-z\/A-Z letters, 0-9 numbers, and spaces.\u00a0<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Maintenance Mode<\/strong>:Option to enable the maintenance mode during the backup. Important to note, your store will remain inaccessible until the maintenance mode is turned off. .<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Exclude:<\/strong> Check the box to exclude the media folder while taking backup.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"270\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Add-backup-details-from-Magento-2-admin-1024x270.png\" alt=\"Add backup details from Magento 2 admin\" class=\"wp-image-24391\" srcset=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Add-backup-details-from-Magento-2-admin-1024x270.png 1024w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Add-backup-details-from-Magento-2-admin-300x79.png 300w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Add-backup-details-from-Magento-2-admin-768x202.png 768w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Add-backup-details-from-Magento-2-admin.png 1358w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3: Complete Your Backup&nbsp;<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Click on OK to start your backup. After a few minutes, when the backup is complete, you will see a message, \u201cThe backup is complete.\u201d&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 3: Magento 2 Manual Backup<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the process broken down into three clear, actionable steps.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1: Backup the File System<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access your hosting account (via FTP or cPanel File Manager).<\/li>\n\n\n\n<li>Navigate to the public_html directory. (If your site is in a subfolder, find that specific folder instead).<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Download the entire folder to your local computer <strong>OR<\/strong> copy and paste it into a separate backup folder on the server for safekeeping.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2: Access the Database Tool<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log in to your <strong>cPanel<\/strong>.<\/li>\n\n\n\n<li>Click on <strong>phpMyAdmin<\/strong> under the database section.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">On the left-hand sidebar, click on the specific <strong>database name<\/strong> that your Magento 2 store is using to open it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3: Export and Save the Database<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click the <strong>Export<\/strong> tab at the top of the screen.<\/li>\n\n\n\n<li>Choose the <strong>&#8220;Quick&#8221;<\/strong> export method and ensure the format is set to <strong>SQL<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Click <strong>Go<\/strong>. This will download a .sql file to your computer, which contains all your products, orders, and customers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Magento 2 Backup Issues &amp; Fixes&nbsp;&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You might face a few challenges while taking your backups. Here are the common issues and fixes listed by<a href=\"https:\/\/experienceleague.adobe.com\/en\/docs\/commerce-knowledge-base\/kb\/troubleshooting\/miscellaneous\/backup-issues\" target=\"_blank\" rel=\"noopener\"> Adobe Commerce<\/a>.&nbsp;&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 1: Backup Disabled<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If your backup functionality doesn&#8217;t display, you might see this error message in your store.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"159\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Magento-backup-issue-1024x159.png\" alt=\"Magento 2 Backup issue\" class=\"wp-image-24388\" srcset=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Magento-backup-issue-1024x159.png 1024w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Magento-backup-issue-300x47.png 300w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Magento-backup-issue-768x119.png 768w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Magento-backup-issue-1536x239.png 1536w, https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/06\/Magento-backup-issue.png 1698w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution: <\/strong>Enable the feature using the Command Line Interface (CLI) command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">bin\/magento config:set system\/backup\/functionality_enabled 1 <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 2: Insufficient Disk Space<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This issue is directly related to your storage and space. If your space is full, your backup will not be completed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution: <\/strong>Move files to another storage device or drive to free up the disk space.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 3: Permission Access&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is a common issue; you might only have read-only access to the system files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution:<\/strong> Make sure you have all the right access to carry out your backups.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Roll Back to a Magento 2 Backup (Using the Command Line)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Follow the below steps:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Switch to the Magento file system owner.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Enter&nbsp;<strong>magento info:backups:list<\/strong>&nbsp;into the command line to know the name of the latest backup you require.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Roll back to a previous backup with this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>magento setup:rollback &#091;-c|--code-file=\"<name>\"] &#091;-m|--media-file=\"<name>\"] &#091;-d|--db-file=\"<name>\"]<\/name><\/name><\/name><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions&nbsp;<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">How often should you take a Magento 2 store backup?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Daily backups are recommended for stores that update regularly and weekly\/monthly for stores that need fewer updates. It is recommended to<a href=\"https:\/\/meetanshi.com\/blog\/schedule-automatic-backup-in-magento-2\/\"> schedule automatic backup<\/a> in Magento 2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where should you store Magento 2 backups?&nbsp;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can store your backups in local servers or use third-party cloud services like Google Cloud Storage or Azure.&nbsp;<\/p>\n\n\n<div class=\"meetanshi-cta\">\r\n<div class=\"cta-content-wrapper\">\r\n<span>Magento 2 Cloud Backup<\/span>\r\n<p>Securely back up your store data to Google Drive or Dropbox.<\/p>\r\n<a href=\"https:\/\/meetanshi.com\/magento-2-cloud-backup.html\" target=\"_blank\" class=\"btn-primary\">Take Backup<\/a>\r\n<\/div>\r\n<div class=\"cta-image-new\">\r\n<img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2025\/11\/magento-2-cloud-backup.png\" alt=\"Magento 2 Cloud Backup\">\r\n<\/div>\r\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You have gone through all the methods, so you may start back up now! Every Magento store owner must have a system to back up the database regularly to avoid exploits, bugs, hacks, crashes, and any such data loss mistakes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Taking a timely Magento 2 backup is your best defense against unwanted accidents that happen anytime while running an online store. This blog teaches you&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-115","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/115\/revisions"}],"predecessor-version":[{"id":24392,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/115\/revisions\/24392"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}