Do you use or administer OpenEMR? Take the General Satisfaction Survey to help improve the product

Error in using built in backup tool

I have set up Openemr 5.0.2(4) on Ubuntu server 20.04 (php 7.4, mariadb 10.0, apache 2) and managed to restore my data from windows 10 xampp openemr after some hiccups.
However, I encountered some problem when using the built in backup tool now. “There was an error in the backup” when dumping the database.
Any help would be appreciated.
Thanks in advance.

Sorry, with regards to above post, mariadb version is 10.3.22.

I have tried the manual way to backup

  1. Get a backup of the database
    mysqldump --opt --quote-names -u openemr -p openemr | gzip > openemr.sql.gz

  2. Get a backup of the openemr folder
    tar -C /var/www/openemr/ -zcf openemr.tar.gz ./

  3. Tar the data and filesystem backups together
    tar -cvf emr_backup.tar openemr.sql.gz openemr.tar.gz

and finally get an emr_backup.tar from my office’s ubuntu server.

I copied the file to my home PC running Kubuntu 20.04 with apache 2, mariadb 10.3.22, php 7.4 and try to restore the database but encounter the below error:

isurgeon@isurgeonkbtu:~$ sudo ./restore
[sudo] password for isurgeon:
WARNING: This script is experimental.
It may have serious bugs or omissions.
Use it at your own risk!
Now you will be asked for the backup file.
By default this is named emr_backup.tar, although you may have saved it as something else.

Enter path/name of backup file: /home/isurgeon/emr_backup.tar

Extracting /home/isurgeon/emr_backup.tar …
tar: openemr.tar.gz: Wrote only 1536 of 10240 bytes
tar: Exiting with failure status due to previous errors
Error: tar could not extract ‘/home/isurgeon/emr_backup.tar’.

Enter path/name of backup file:

Note: the openemr.tar.gz size is around 2.6GB.

Any suggestion/help?
Thanks in advance.

Hi @isurgeon

The reason for the failure status during the extraction of a file can arise when the file/folder is not properly tared. You can use the following command to tar a file.

tar cvzf file.tar.gz folder (or)
tar -cvzf file.tar.gz folder

Once after tar you can untar using the command

tar xvzf file.tar.gz
Hope this may help you.

Thanks,
ViSolve

Hi
Thanks for your suggestion. I have tried your method to tar the folder but unfortunately I still get the similar error while extracting except the “wrote only bytes” were different.
By the way, do you know where is the openemr’s built-in backup tool script located?
Note: I am totally new to linux/ubuntu, learning by googling in my free time. I was using windows platform then.
Thank you.

Hi @isurgeon

You can find the restore script in the following path

contrib/util/restore

In addition to it, You can use the below path for the code of create backup event.

interface/main/backup.php

Hope this may help you.

Thanks,
ViSolve

1 Like

Thanks, ViSolve. I will look into it.