A Third Way For Backup

fsgl wrote on Tuesday, February 05, 2013:

The built-in backup tool was relatively easy to use, but recovery was not quite as faithful as one would like.  The LBV forms had to be re-configured if the widths of the boxes were larger than 50.  Scanned images of patients’ insurance cards were lost.  Still  very grateful to have it than not.  Joe Holzer’s Wiki article, http://www.open-emr.org/wiki/index.php/Windows_OpenEMR_Backup_and_Recovery, suggested a more reliable method of backup with Windows.  Most physicians would not attempt to use command prompt so xcopy is not really an alternative.  For those of us too frugal to pay for file copying software or to hire a consultant, would TeraCopy or FastCopy be good substitutes?  Are there just the four folders mentioned in the article that need to be copied each day?  Does the mysql folder need to zipped before recovery because phpMyAdmin won’t accept a file larger thatn 30MB?   It would make more sense to use a file copying freeware than to do differential/  incremental backups.  Is that true merely on the surface?  Thanks for your help.

blankev wrote on Tuesday, February 05, 2013:

The quicker Copy Paste, the less annoying it is for the user. With most Copy => Paste solutions you have to stop OpenEMR/Xampp functionality for a while. It would be better to find an program that can make a Copy while working on a functioning OpenEMR.  This said, a Copy Paste functionality while you are able to continue working without any notice of the process would be a great feature or even better an incremental copy of relevant files as a quick backgroud safety net in some kind of batch mode.

pfwilliams wrote on Wednesday, February 06, 2013:

The mysqldbexport utility does live backups of the database.
I’m running it 5 times a day during business hours, without interrupting users, and a sixth time after hours.
I discussed it and posted a rough batch file in this thread:
http://sourceforge.net/projects/openemr/forums/forum/202504/topic/6136217?message=12842006

I’ve yet to find the time to go back and see if it can be implemented without installing Workbench and Python, or to cleanup or enhance the batch file.

blankev wrote on Wednesday, February 06, 2013:

I can imagine how this could work, but as a general practitioner I know I need to have it all in place before I can handle this option. You are speaking in terms of Workbench en python and know this is too much for me. Give it like SCRACH from MIT edu, programming for kids eight years and up and I might have a chance to implement. Tnx for giving your time, hope you find a solution! WOULD BE GREAT for me but also for OpenEMR!

fsgl wrote on Wednesday, February 06, 2013:

Ours is a tiny practice.  Backup is done at the end of the day when there is no writing to the database.  According to the above cited Wiki article, Apache & MySql don’t need to be turned off, but it is not that difficult to do so with Xampp control.

Our Windows 7 laptop is dedicated for the practice and it is used for nothing else.  The only reason to do an incremental or differential backup of the whole kit-and-kaboodle is for redundancy. Windows develop corrupt files for very little reason, therefore backing up C-drive is pointless when recovery must be done with the factory settings or an uncorrupted system image.

It is my understanding from the Wikipedia article and the links, ({http://en.wikipedia.org/wiki/List_of_file_copying_soft 
ware} that there are superior file copying software to that of Windows.  For speed, Fastcopy has been given high marks.  Copy Changed Files, {http://tsr-soft.com/products/copy-changed-files/}[/url, does an incremental file backup using either binary comparison or a time comparison.  It is not as well known as the software mentioned in Wikipedia.
Because they all are open source, even if the utilities are not deployed, the codes can be modified for use in OpenEMR or used to spark other solutions.

fsgl wrote on Wednesday, February 06, 2013:

Let’s try those links again: 1)http://en.wikipedia.org/wiki/List_of_file_copying_software
2) http://tsr-soft.com/products/copy-changed-files/

fsgl wrote on Wednesday, February 27, 2013:

Per Brady Miller’s reply of 9/24/2011,http://sourceforge.net/projects/openemr/forums/forum/202505/topic/4719012, the 4 folders, mentioned in Joe Holzer’s Wiki article, are conveniently grouped in c:\xampp\htdocs\sites\default.  The only other folder to backup is the c:\xampp\mysql\data\openemr.  For a small practice with a modest amount of files to backup, the Windows file copying utility should be adequate if one is not particular about differential/incremental backups. Restoring the htdocs folder is just copy and replace.  The question regarding the mysql database restoration, is it simply copy & replace or must phpMyAdmin be used?

cverk wrote on Thursday, February 28, 2013:

Below is my previous post for this.  It really is not complex. Use notepad to make an empty file called check.bat and save it to the C drive.  Open windows notepad and copy the script below to notepad and save it on your desktop as a text file.  You can name it something like backup.txt.  Then rename it to backup.cmd and it is ready to use.  If you double click backup.cmd it will shut down your server, backup all the files and then restart the server.  Each time you run it will make incremental backup of just files that have changed. If desired you can use windows scheduler to run it any time you want maybe after the office is closed.

Here is a script for backing up from drive C to drive M such as you would use to back up to a usb thumb drive.  I use truecrypt encrypted USB drives.

net stop “mysql”
net stop “apache2.4”
cmd /c cd C:\
if exist C:\check.bat xcopy C:\xampp\*.* M:\xampp\ /d /e /c /i /f /h /k /y
net start “apache2.4”
net start “mysql”

Now if your computer just dies, you can copy the whole xampp backup file directly to a new computer, run the xampp control to restart mysql and apache and you are back in business. If your current computer gets corrupted you can run xampp control to stop mysql and apache, copy over the xampp files, restart mysql and apache with xampp control, and again you are back in business.

fsgl wrote on Thursday, February 28, 2013:

Thanks, cverk, for your suggestions.  I generally do a search to avoid asking a question that had been answered before.

In the school of computer science you are in the post-doctoral program while I am still in grammar school.  I don’t even have a rudimentary understanding of programming therefore applications which do not involve programming skills are easier for me to use and understand.

I agree that your method is far more elegant than my piecemeal approach.  Backup is vital to every medical practice and one is not likely to adopt a methology without understanding it first.  Lines 1, 2, 5 and 6 are self-explanatory.  I think that I get most of line 3 but I understand only 50% of line 4 (I think xcopy is hidden somewhere in Windows 7 but I am not sure).

Physicians tend to be a cautious lot and for good reasons.  If we were wild and crazy, patients would suffer as a result.  It was fairly daring for me to convert from paper records to EMR as a do-it-yourself project.  It was with great trepidation that
I went into the lines of codes to change the patient statement form but I did it.  One day I will be more efficient and elegant in backing up but for now kindly answer the question about copy and replace the mysql database or use phpMyAdmin for restoration of the same.

cverk wrote on Friday, March 01, 2013:

the script was adapted from the wiki instructions.  I am just a solo family doc, not a programmer.  xcopy is a throw back to dos which is embedded in windows.  I am using windows 7 pro. I think the idea of the check.bat is not to try and back up a drive that isn’t present.  The modifiers make sure you back up incrementally all the files and subfiles etc.  This approach doesn’t involve messing with a running database, it just writes and overwrites everything.The way to know it is working for backup is to use it to copy to another computer.  I will back up my office production server to a usb drive, take it home and put it on my home computer, and use that copy to mess with any changes I want to try without risking messing up my office copy. Since my kids have access to the home computer and I am transporting usb drives I encrypt them on partitions using the opensource truecrypt.
   I think where you may be confused is that the xampp version in windows is completely contained within the xampp directory on the hard drive.  It does not spread a bunch of files through other windows directories. So you can basically copy the whole xampp directory to any windows machine, double click the xampp control in windows explorer and use it to start up mysql and apache, and it will run on that machine. In fact if you want to, you can run it directly from the usb drive , but it is kind of slow.

cverk wrote on Friday, March 01, 2013:

I got ahead of myself and didn’t answer the question. The cmd command accesses the command structure where  xcopy is in windows and cd changes directories to the c drive. I did a similar adaptation to encrypt and backup in the middle of the night to the amazon cloud which I posted previously. So I think I have a pretty robust backup structure making a daily usb backup onsight, offsite with me, and coast to coast on the amazon cloud.

cverk wrote on Friday, March 01, 2013:

The windows 7 pro machine I am using as my server also has dual mirrored hard drives in Raid 1 and a battery backup power supply. We scanned all our old paper files to pdf and those are shared from an encrypted partition on my server to my workstations as well.  So I have exam room access to almost 30 years of patient records.

fsgl wrote on Friday, March 01, 2013:

I surmised that you are a physician from prior posts.  My analogy was meant to convey that your knowledge of computer science is far more advanced than mine, not that programming is your day job.

If I understand correctly, if XAMPP-OpenEMR is self contained, I should be able to backup manually each day the site\default folder and the mysql database.  Both add up to only 11 MB so I don’t think that  I have to do a differential backup.
When my laptop crashes or Windows 7 becomes corrupted again, then I should be able to install a new copy of XAMPP-OpenEMR and copy and replace the above mentioned folder and the database.  I think this is a similar process with each new patch.  I become queasy when I see command prompt pop up.  If I tell a patient that she has anisometropic amblyopia, she would look worried.  But if I tell her she has a lazy eye because of the difference in her glasses, she would say that she had known this since third grade.  It’s the fear of the unknown.

For our practice it did not make sense to scan 31 years worth of paper records because it is still faster to skim the paper chart than to go through each scanned document.  Even if I had  headings for the scanned documents, it is still faster to get the paper chart and speed read it.  We also did not have the resources to do the scanning.

The young folks have fledged, so there is no pressing need for encryption.  I did try Truecrypt once but did not find it helpful.

I will have to research the modifiers of xcopy before I can implement this method of backup.

Ideally, this more robust method of backup should be built-in for Windows.  Brady Miller was correct (I am paraphrasing him) that greater acceptance of OpenEMR is impeded by such things as the lack of a simple yet faithful backup utility that does not involve command prompt.  I had written a series of 6 posts in our American Academy of Ophthalmology EHR forum about our DIY OpenEMR project.  None of my colleagues were interested.  They seem to think all of this is beyond the ability of us mere mortals and that an EMR application is only worthwhile if it has a huge price tag.  For the average physician, (s)he would not go near command prompt with a ten foot pole.

Thank you for taking so much time to explain.

cverk wrote on Friday, March 01, 2013:

You have to shut down mysql and apache using the xampp control program before you can just copy the database files for backup.  The script idea just saves you manually shutting down the running processes, finding and copying over the files you want and then restarting the office server so it can be used. The first microsoft os computer I ever worked with was DOS based, so I think having a command (cmd) file pull up and run a dos based script gives me the opposite reaction.  More like a sense of transparency. The same feeling I get from this whole project as opposed to being held hostage to a proprietary option.
We started scanning 10 years ago, after I filled up a rented storage site, so by the time we got into Openemr I was down to just the charts on hand. I don’t think I would recommend that at the same time as trying to transition into an EMR.

blankev wrote on Saturday, March 02, 2013:

First there was COPY, followed by XCopy with more options, now I read about ROBOCOPY.

**Question: **Is ROBOCOPY available and working with Windows XP home version with the same script file (cverk script) as it does for Windows 7?

TNX in advance,

Pimm

fsgl wrote on Saturday, March 02, 2013:

Cverk, at your level of knowledge and experience it makes sense to get into the weeds.  I prefer to do things for myself, such as investing, accounting and tax returns; but it is also important to know one’s limitations and not get too far over one’s head.  If a patient came to your office with an embedded corneal foreign body, you are licensed to remove it .  For good measures, I would tell you, in advance, that all you have to do is put in a drop of 0.5% Proparacaine, then take the tip of a sterile 27 gauge needle, get under the foreign body and gently dislodge it.  I seriously doubt that you would not refer the patient to a local Ophthalmologist, not because you lack the knowledge but because you lack the experience.  Isn’t discretion the better part of valor?

Pimm,  from the Wikipedia article on Xcopy, “While still included in Windows Vista, Xcopy has been deprecated in favor of Robocopy, a more powerful copy tool, which is now built into the operating system.  (Xcopy is still in Vista.)  Windows 7… does not claim that it is deprecated”.  Here is the quote from Wikipedia: “(Robocopy) has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was first introduced as a standard feature in Windows Vista and Windows Server 2008”. Version 6.1 has been bundled with Windows 7 and version 6.2 with Windows 8.  http://en.wikipedia.org/wiki/Robocopy goes into the advantages and merits of Robocopy, all of which is Greek to me.

   

fsgl wrote on Sunday, March 03, 2013:

For those of us who are command-prompt-phobic, two articles to help the medicine go down.

1)  Xcopy syntax, http://pcsupport.about.com/od/commandlinereference/p/xcopy-command.htm, which explains what the “d,e,c,i,f,h,k,y” are all about.
2)  the Xcopy Tool, http://www.techrepublic.com/blog/window-on-windows/simplify-file-management-with-the-xcopy-tool/1930, which explains how Xcopy works and why it is better than simply to copy and paste.  The graphic user interface is a very nice crutch.  The mouse-over explains each syntax and the tool groups them into categories which provides greater clarity.

Because one does not have to actually get into command prompt itself, it takes a great deal of the fear away.  After re-reading cverk’s posts, I think this is also the case for his  method of backup modified after Joe Holzer’s.  One has to crawl before walking and running.  Will test the Xcopy tool; do restorations; if all goes well, take cverk’s advice; and report.

blankev wrote on Sunday, March 03, 2013:

I want to make a remark about me finding Robocopy as a later version of XCopy.

Robocopy as mentioned earlier is NOT the same or an extension of Xcopy and before that from Copy in WIndows. It needs different parameters and so it can not be used with the same parameters as suggested by CVERK.

I tried to make some kind of Batch menu thing and Xcopy does fine. Only the first Xcopy made takes more time since all copies of XAMMPP need to be written to the new directory with the backup space.

I also could not find the way to make it work without administrator permission. Making a shortcut on the desktop is an improvement but you are still asked for permission. But with something crucial like backups this might be an advantage.

Hope to share my *.bat menu file, but I am still testing.

It is so easy to addapt that you can make copies and restore as you like. Also starting from the Windows schedular is a nice option for *.bat files no need to remember every now and than to make a backup copy………

Pimm

blankev wrote on Sunday, March 03, 2013:

Now I still need some guidance as to how make my Copy to restore to the website. Better said, backup from the website and restore to the website. Any clue is welcome.

Pimm

fsgl wrote on Sunday, March 03, 2013:

Professor Michael P. Harris of Delmar Academy explains in his Introduction to Batch Files:

"Explain the purpose and function of batch files.
Batch files are used to simplify long and complex OS commands. They allow a user to put together a string of commands and execute them with one command. They are used to automate frequent and/or consistent procedures that are always done in the same manner.

You have a batch file called CHECK.BAT.  You key in CHECK at the prompt. Where does it look for the file?  What does the operating system then do?
The OS will first check for any CHECK file name internally, then any file with the .COM extension, then .EXE and last the .BAT or .CMD extension. OS will check the default drive and directory for the file CHECK.BAT.  If it does not find the file there it will then look for the file on the search path.  As soon as the batch file is found, the OS will open up that file and execute the commands in the file one at a time. After the batch file is completed, OS will return control to the system."

My questions are 1) why is a check.bat needed with 6 lines of commands? 2) why are two files, check.bat and backup.cmd needed for the same function, namely differential backup of the XAMPP folder? 3) why have check.bat empty?  I know this sounds like children asking why is the sky blue, but it is helpful to understand the process.  Thanks for your patience.