Sometimes when connecting to the Windows shared drive using the Linux/Windows system, we get the error as below:-
[root@localhost ~]# mount.cifs //192.168.1.5/home /mnt/ -o username=myuser,password=123456
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
This error means that we are not able to allocate memory on the source server (which you’re trying to connect to) and somehow we need to be able to increase the memory on the server. This error actually needs 3 changes to be done on the source server in order to connect to the Windows shared drive:-
1) Increase the system cache for sharing large files in the registry.
Open regedit and set
“HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache” to “1″.
2) Give priority to file sharing over reducing memory usage.
Open regedit and set
“HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size” to “3″.
3) Check if the IRPStackSize registry entry exists and increase the IRPStackSize value on the server.
Open regedit
Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
Click IRPStackSize, click Edit, and then click Modify and then in the Data Value box type a larger value and now click OK to apply this larger value.
If the IRPStackSize entry is not present in this subkey :-
———————————————————
Click Edit, point to New, and then click DWORD Value. Type IRPStackSize, and then press ENTER.
Click IRPStackSize, click Edit, click Modify and then in the Data Value box type a larger value, and then click OK.
Then restart the “server” service or if it is possible to do so, reboot to apply the above changes on the Windows system.
That’s all that needs to be done on the Windows server. Now try again to connect with the shared drive/directory/partition and you’ll have success.
]]>