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)
Solution:
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.
HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size
Reboot (or just restart the “Server” service in services.msc – thanks Sergio Francisco for the pointer!). Your problem should now be solved.
Links
http://alan.lamielle.net/2009/09/03/windows-7-nonpaged-pool-srv-error-2017
Instead of reboot computer, you can only restart “Server” service in services.msc. Thanks!
Thanks Sergio I have updated the OP to reflect your tip.
[…] 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 […]
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 .
Thanks Raoul I have updated the OP to reflect this tip.
worked like a charm! thx!
it really worked. mine the registry settings was wrong
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.
This tip (specifying the version vers=2.1 in the options string) worked for me too. The server was Windows 7 Pro. Thank you very much!
Here was the error I was getting:
> sudo mount -t cifs //192.168.x.x/share ~/share -o username=bob
Password for bob@//192.168.x.x/share:
mount error(121): Remote I/O error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Found this blog through Google search, but did not want to mess with registry settings on the Windows server. Ended up browsing man mount.cifs and found out about the “vers” option (should have read through these comments first!) Anyway, if you don’t specify vers, it defaults to 1.0, and apparently Windows 7 works better with 2.1.
From the man page:
vers=
SMB protocol version. Allowed values are:
· 1.0 – The classic CIFS/SMBv1 protocol. This is the default.
· 2.0 – The SMBv2.002 protocol. This was initially introduced in
Windows Vista Service Pack 1, and Windows Server 2008. Note
that the initial release version of Windows Vista spoke a
slightly different dialect (2.000) that is not supported.
· 2.1 – The SMBv2.1 protocol that was introduced in Microsoft
Windows 7 and Windows Server 2008R2.
· 3.0 – The SMBv3.0 protocol that was introduced in Microsoft
Windows 8 and Windows Server 2012.
Here is the corrected command which now works for me:
> sudo mount -t cifs //192.168.x.x/share ~/share -o username=bob,vers=2.1
Bob … this was kicking my backside something fierce. Thanks! Should have checked the man pages.
Thank you very much!. I have the same problem and resolved following this post. I have win7 and change only lanmanserver. Thanks again.
[…] See: https://boinst.wordpress.com/2012/03/20/mount-cifs-cannot-allocate-memory-mounting-windows-share/ […]
Awesome, thank you guys, problem solved.
thanks a lot !!!!, it fix my problem