Problem with a backup batch file

Ronald Hicks
Ronald Hicks used Ask the Experts™
I'm backing up a server to three places:  a D" drive on the same machine and to two external drives on another machine (USB connected) in a different location.  It has a 232 GB drive of which 170 is free.  I'm not backing up to that drive though, so that might  be irrelevant. The swap file ("total paging file for all drives) on this machine is 3799 MB.

Backups to the D: drive are fine.  I've noticed that nothing is being backed up to the other two locations since I changed out the machine to which they are connected, which is a Win 7 Pro (64 bit, 3 GHz, 4 GB RAM) machine.

I put in a couple of pauses in my batch file to see what is going on.  I ran it, and in about a minute, at the pause, it said "Insufficient memory. 0 files copied."

Here's a fragment of my batch file, the fragment that copies to one of the external (USB connected devices (a Western Digital 4 TB Elements Basic Storage Unit)

echo **BEGIN >> \\mailroom\Elements\backup\list.txt
date /t      >> \\mailroom\Elements\backup\list.txt
time /t      >> \\mailroom\Elements\backup\list.txt
xcopy c:\data\*.* \\mailroom\Elements\backup\data\*.* /s /e /c /d /y >> \\mailroom\Elements\backup\list.txt
date /t  >> \\mailroom\Elements\backup\list.txt
time /t  >> \\mailroom\Elements\backup\list.txt
echo **END >> \\mailroom\Elements\backup\list.txt

The size of the folder named data is 611 GB, on a 1 TB drive.

What memory is coming in to play here? Swap file perhaps?  And what would make it insufficient?  

Thanks for any clues and suggestions.

Ron Hicks
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
The error message is probably a red herring. I guess there is an issue with the share for the external drive.
You can try if RoboCopy instead of xcopy helps. You should use that anyway for such large amount of data. The corresponding line is
robocopy c:\data \\mailroom\Elements\backup\data /s /njh /njs /log+:\\mailroom\Elements\backup\list.txt

Open in new window

It could also help to run the script on the target PC.
I have seen the "insufficient memory" error when using xcopy before. Like Qlemo said it is a red herring, and is caused by a bug in xcopy. It's not that the computer is out of memory, it's that either xcopy doesn't release the file handles properly and the system runs out of handles, or that the path is too long which causes the file copy operationg to fail, and xcopy returns "insufficient memory" as an incorrect diagnosis of the problem.

See here:

Either way, xcopy is the wrong tool for the job for this. If you must use a batch file script, robocopy is a far better tool for the job. It has a mirroring option that can remove missing files from the destination, and it won't unnecessarily copy files that haven't changed using smarter algorithms than simply comparing the date.

Really though, you should be using a real backup product, not a script. Your script is missing all sorts of important features - the ability to keep past revisions, for a start. No block-level differential backups which means if a very large files has only a few bytes change it will require that the entire file gets re-copied. The backups are probably not encrypted or secure in any way. There's no verification afterwards to ensure the files actually got copied and nothing is corrupted. There's no notification of backup success or failure Your backup files won't retain the original security ACLs they had originally.

And probably most important, because you aren't using volume shadow copy you aren't getting a consistent snapshot of your data from one point in time. The data can change while your backup is running which means you end up with an inconsistent snapshot of your data. Also, any files that were locked and in use at the time will fail and not get copied.

Try an actual commercial bakcup product. If you just want file-level backups and not a complete system image and you want it cheap, look at CrashPlan.
Ronald HicksConsultant


Thank you.  Very helpful.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial