Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to rsync some directories on my linux server to a Windows 7 share mounted locally on the Linux server at /mnt/backups.

My rsync command looks like this:

rsync -avz --progress --partial --modify-window=1 --temp-dir=/tmp /home /mnt/backups

When it executes I get this:

building file list ...
165048 files to consider
rsync: ERROR: cannot stat destination "/mnt/backups": Cannot allocate memory (12)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(507) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(453) [sender=2.6.9]

I've searched around and the only tips I've found were to add --modify-window and --temp-dir options but those haven't made any difference.

For the record, I've had similar problems trying to tar a backup file to this mounted location which is why I wanted to switch to rsync. I suspect Samba is causing these problems but everything looks fine on the surface. Not sure what else to do from here...

share|improve this question
Forgot to mention... the first time I ran this it went for a while, copied about 8G and then started choking on this error. Now as soon as I run the script it fails with this msg. – Justin Nov 1 '11 at 23:51
Are there in fact over 100,000 files? It seems the stat function call was unable to allocate memory, which is unusual to say the least. Also, unless the Windows machine is using the FAT filesystem, you don't need the modify-window option. – David Schwartz Nov 2 '11 at 0:36

Appears to be an issue on the Windows 7 end. The fix is to update the following two reg keys.

Set the following registry key to ’1′:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache

and set the following registry key to ’3′:



share|improve this answer

Cannot allocate memory (12)

How many RAM do you have on the receiving side? Increase virtual memory on the Windows and try again.

share|improve this answer
The receiving Windows server has 12G of memory. The Linux server however only has 2G. – Justin Nov 3 '11 at 1:58
How about the swap on the Linux? – quanta Nov 3 '11 at 2:16
Linux has 2G swap – Justin Nov 5 '11 at 1:09
How much swap usage in rsyncing process? Did you try to increase it? – quanta Nov 5 '11 at 2:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.