Fix for mount error(12): Cannot allocate memory

Do you have the following situation:

  • You’ve got a share on Windows (XP, Vista, 7) that you’re trying to access from a Linux system, in this case Ubuntu.
  • Mounted through /etc/fstab or directly through the command line.
  • Initially, it works great, but then loses the mountpoint – you’ll go to, say, /mnt/server/mountpoint but there are no directory contents. “mount” shows the path as still mounted.
  • umount’ing the directory and then trying to remount it provides this gem of a message:
    mount error(12): Cannot allocate memory
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Of course, since you’re probably a reasonable system administrator, you go and check the memory allotment. top looks fine and nothing else on the system is complaining.

The solution, kindly provided by Alan LaMielle’s blog, gives a registry fix on the Windows side of things. In case that link ever breaks, here is the summary of what needs to happen on the Windows system:

  • In HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management, set the LargeSystemCache key to 1 (hex).
  • In HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters, set the Size key to 3 (hex).’
  • Restart the “Server” service and its dependencies (on my Windows 7 box, these were “Computer Browser” and “Homegroup Listener”, and I had to restart the service twice for the dependencies to also come back up.) Alternatively you can just restart the Windows system as you’re probably due for a large set of updates anyway.

Then re-run the mount command (for entries defined in /etc/fstab, use sudo mount -a) and your shares should be restored to their former glory.


  1. I knew intuitively that this had to be a bug, not surprised it was Windows’ problem, not Linux. Worked like a champ for me – Win 7, FC 16 running as a guest under VM Ware player. Thanks, chap.

  2. One typically views suggested “fixes” with a jaundiced eye … this one worked and worked immediately. Many thanks!
    Our IT department is looking for good people …

4 Trackbacks / Pingbacks

  1. Links 4/10/2011: Parted Magic 6.7, Red Hat’s Latest Takeover, Fedora 16 Beta | Techrights
  2. Comment connecter un shared drive NTFS sur Oracle Enterprise Linux | Le coin de Guy Boulais
  3. Fehlerbehebung mount error(12): Cannot allocate memory | PLUSTECH
  4. Fehlerbehebung mount error(12): Cannot allocate memory |

Leave a Reply

Your email address will not be published.