Hello,
i’m a happy xtrabackup user with a fast growing database.
I have a question when you want to save some disk space when restoring your xtrabackup.
If i restore my backup and prepare it directly to my DB datadir and then set the appropriate rights i think i won’t have to use the --copy-back option of innobackupex?
While doing so i can save disk space because you don’t have to store the restored backup elsewhere then copy it to the datadir.
What is the purpose of --copy-back except just copying the files to the datadir?
Do you see any drawbacks using my method?
Thanks.
Yes, you can copy backup directory directly to target server datadir and prepare it there but make sure data directory is empty where you are restoring and mysql server is stopped on target server. Also, you can prepare a backup created with older Percona XtraBackup version with a newer one, but not vice versa. Once your backup is prepared, you can apply proper permissions to data directory and restart mysql service.
Xtrabackup --copy-back option copies/restore the backup to target server data directory. It will copy all the data related files as per my.cnf. WIth, --copy-back option you don’t need to manually copy/move files. If you don’t want to use --copy-back option you can use method you described via mv, cp or rsync.