Problem with a backup batch file

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)

:MAILROOM
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
Ronald HicksConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
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.
Frosty555Commented:
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:  https://en.wikipedia.org/wiki/XCOPY#Limitation

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ronald HicksConsultantAuthor Commented:
Thank you.  Very helpful.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.