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...

  • 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, 2011 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. Nov 2, 2011 at 0:36

2 Answers 2


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′:


References: http://frankooh.wordpress.com/2012/01/02/smbrsync-cannot-allocate-memory/ http://ubuntuforums.org/showthread.php?t=869994&page=2&p=8251122#post8251122 http://www.decuslib.com/decus/vmslt99a/nt/tips.txt https://groups.google.com/forum/#!topic/microsoft.public.windows.vista.networking_sharing/NF3jEW2VlmQ


Cannot allocate memory (12)

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .