Mount.cifs cannot allocate memory mounting Windows share

Mounting a Windows (SMB) share on Ubuntu gives us a “cannot allocate memory” error.

Executing a command like this:

mount -t cifs //toad/Backup /media/backup -o user=username,password=password,iocharset=utf8,file_mode=0777,dir_mode=0777

We get an error like this:

mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)


First, check the permissions on your shared folder. Right-click the folder and select Properties. Your Windows user must be allocated permissions on both the Security and the Sharing tabs.

Open regedit, and set the following registry key to ‘1’. This key tells Windows to set aside enough system cache for sharing large files. Commenter Raoul Duke (thanks!) adds that this change is unnecessary on Windows 7 and later.

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

And set the following registry key to ‘3’. This value tells Windows to prioritise file sharing over reducing memory usage. You can read more about this key here.


Reboot (or just restart the “Server” service in services.msc – thanks Sergio Francisco for the pointer!). Your problem should now be solved.


About these ads

9 comments on “Mount.cifs cannot allocate memory mounting Windows share

  1. Instead of reboot computer, you can only restart “Server” service in services.msc. Thanks!

  2. […] but was receiving a “Mount.cifs cannot allocate memory mounting Windows share” message. These Windows registry edits might have solved the issue I was having… or perhaps it was the samba updates that […]

  3. Raoul Duke says:

    You don’t need to change “LargeSystemCache” on Win7. Only “…LanmanServer\Parameters\Size”. And as Sergio wrote, no reboot either. Only restarting the Server service .

  4. Jon Best says:

    worked like a charm! thx!

  5. damith says:

    it really worked. mine the registry settings was wrong

  6. Alexander Feterman says:

    Had the same problem, but no access to the server, so I tried something else. The server was a Win2008 so I tried specifying the version (vers=2.1 in the options string). Worked like a charm.

  7. Josenildo says:

    Thank you very much!. I have the same problem and resolved following this post. I have win7 and change only lanmanserver. Thanks again.

Troll this Post

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s