# Physical Backup

**URL:** <https://forums.percona.com/t/physical-backup/23388>\
**Category:** General Questions\
**Tags:** mysql, percona\
**Created:** [July 5, 2023, 1:17pm UTC](https://forums.percona.com/t/physical-backup/23388 "2023-07-05T13:17:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Percona\_new](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/percona_new/32/9299_2.png) [@Percona\_new](https://forums.percona.com/u/Percona_new)\
**Post date:** [July 5, 2023, 1:17pm UTC](https://forums.percona.com/t/physical-backup/23388/1 "2023-07-05T13:17:02Z")

</div>

Hello team! we need to explore alternatives for performing physical backups of a MySQL database, and I wanted to know if it is possible to backup a database by copying the contents of the data directory from one server to another, if necessary, by shutting down MySQL to perform the copy.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Michael\_Coburn](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/michael_coburn/32/18_2.png) [@Michael\_Coburn](https://forums.percona.com/u/Michael_Coburn)\
**Post date:** [July 5, 2023, 3:04pm UTC](https://forums.percona.com/t/physical-backup/23388/2 "2023-07-05T15:04:11Z")

</div>

Hi @Percona_new welcome to the Percona forums!

Yes this is a valid method of doing a backup, it is known as a cold backup, and is a supported method.

---

<div class="post-metadata">

**Author:** ![Percona\_new](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/percona_new/32/9299_2.png) [@Percona\_new](https://forums.percona.com/u/Percona_new)\
**Post date:** [July 6, 2023, 1:44pm UTC](https://forums.percona.com/t/physical-backup/23388/3 "2023-07-06T13:44:27Z")

</div>

Thank Michael! By any chance, do you have the procedure? or step by step guide?  
Thank!

---

<div class="post-metadata">

**Author:** ![Michael\_Coburn](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/michael_coburn/32/18_2.png) [@Michael\_Coburn](https://forums.percona.com/u/Michael_Coburn)\
**Post date:** [July 10, 2023, 1:32pm UTC](https://forums.percona.com/t/physical-backup/23388/4 "2023-07-10T13:32:39Z")

</div>

Hi @Percona_new  
The process is essentially:

1. Stop MySQL `sudo systemctl stop mysql`
2. Copy the data directory `cp -avr /var/lib/mysql /my/backup/location`
3. Start MySQL `sudo systemctl start mysql`

---

<div class="post-metadata">

**Author:** ![Percona\_new](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/percona_new/32/9299_2.png) [@Percona\_new](https://forums.percona.com/u/Percona_new)\
**Post date:** [July 10, 2023, 1:48pm UTC](https://forums.percona.com/t/physical-backup/23388/5 "2023-07-10T13:48:08Z")

</div>

Michael thank you for your help! The general process is clear, but maybe I wasn’t clear with the question. What I was asking is whether I can move/copy just a database from one installation to another using the cold backup method.  
Let’s suppose I have a database called “test” on Server A, and I want to move it to Server B using the cold backup method. Currently, we are doing it with MySQL Dumper, but we need to test the possibility of doing it with cold backup.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_Coburn](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/michael_coburn/32/18_2.png) [@Michael\_Coburn](https://forums.percona.com/u/Michael_Coburn)\
**Post date:** [July 11, 2023, 1:55pm UTC](https://forums.percona.com/t/physical-backup/23388/6 "2023-07-11T13:55:43Z")

</div>

ahh I see more clearly your question - you are asking whether a schema (database) can be copied between one server to another. the answer to this question is NO when using InnoDB, as there are internal tables to MySQL that track the existence of schemas and their associated tables. You would need to proceed with a logical export of the database, and then load it in via the MySQL protocol.

Your other option is to leverage Transportable Tablespaces available since MySQL 5.6  
[https://dev.mysql.com/doc/refman/8.0/en/innodb-table-import.html](https://dev.mysql.com/doc/refman/8.0/en/innodb-table-import.html)

---

<div class="post-metadata">

**Author:** ![Percona\_new](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/percona_new/32/9299_2.png) [@Percona\_new](https://forums.percona.com/u/Percona_new)\
**Post date:** [November 10, 2023, 2:26pm UTC](https://forums.percona.com/t/physical-backup/23388/7 "2023-11-10T14:26:02Z")

</div>

Hello Michael, thanks for the response. Im back with some extra information. Each of our databases have its own tablespace which contains all the database’s tables. So for example:

CREATE TABLE `test` (  
`id` int unsigned NOT NULL AUTO\_INCREMENT,  
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4\_unicode\_ci DEFAULT NULL,  
PRIMARY KEY (`id`)  
) /\*!50100 TABLESPACE `dba` \*/ ENGINE=InnoDB AUTO\_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4\_unicode\_ci

When I try alter table discard tablespace:  
ERROR 1148 (42000): InnoDB: Cannot discard table `dba/test` because it is in a general tablespace. It must be file-per-table.

How can overcome this situation?
