COPY OF SITE – I have an OCD thing about thinking peoples sites might be down one day, so I copy paste the material out, but I still give full credit where its due, in this case its all due to the owner of the site: INSERT-URL-HERE – In no way am I claiming this as my own information, this is just a reference to a good site that I wanted to share, plus it probably increase that sites hits – If this is something bad and you dont want me to include this, let me know my contact information is all over this blog. opps@infotinks.com will get to me.

All of the notes are on my onenote with pictures, I didnt want to upload the pics one by one, so I have uploaded the exported pdf of the whole article which has the pictures.

Note all of this information is from online, it was hard to find so I put together here, download the pdf at the bottom to get a better understanding of the issue.

————–

GETTING THIS ERROR:

#root@debian:/mnt/rdowngod#~~Fri Jun 28~~08:23 PM~20:23:19~HIST:551~CMD:56$
mount -o user='boss@infotinks.com',pass=xxxx' //10.11.12.13/DL /mnt/rnew
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

————–

http://thelinuxexperiment.com/guinea-pigs/jake-b/fix-for-mount-error12-cannot-allocate-memory/

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

————–

Most articles point to this:

How to Resolve “mount error(12): Cannot allocate memory” on a Windows Share

http://jlcoady.net/windows/how-to-resolve-mount-error12-cannot-allocate-memory-windows-share

If you mount a Windows 7 share using Samba/CIFS you may run into “mount error(12): Cannot allocate memory” if you are using very large files on the Windows machine. Looks like in certain situations Windows needs to be told to run as a file server and to expect large files. You can read more details at Large Files are locking up Windows 7 32 bit and 64 bit, but the solution is to make two registry edits and then restart a service:

1.    Set “HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache” to “1″.

§  Set “HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size” to “3″.

§  Restart the “server” service.

Once you have done that you should be able to mount the share using a command like “sudo mount -a” or just reboot the Linux machine.

Another pointed @ Event Viewer on PC: Expanding Erorr on Summary of Adminsitrative Events

Then selecting the srv  with double click and seeing the error they are all the same

Error:

The server’s configuration parameter “irpstacksize” is too small for the server to use a local device.  Please increase the value of this parameter.

Researching online: http://support.microsoft.com/kb/106167

RESOLUTION

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756 How to back up and restore the registry in Windows

————–

To resolve this issue, increase the value of the IRPStackSize registry entry. To do this, follow these steps:

1.       Click Start, click Run, type regedit, and then click OK.

§  Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

If the IRPStackSize entry is not present in this subkey, follow these steps:

1.    Click Edit, point to New, and then click DWORD Value.

§  Type IRPStackSize, and then press ENTER.

Note Type IRPStackSize exactly as it appears. The value name is case sensitive.

1.       Click IRPStackSize, click Edit, and then click Modify.

§  In the Data Value box, type a larger value, and then click OK.

Note Values may range from 0x1 to 0xC. These values are equivalent to 1 to 12 in decimal notation.

If the problem persists after you complete the previous procedure, increase the value of IRPStackSize more.

————–

MORE INFORMATION

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756 How to back up and restore the registry in Windows

 

The IRPStackSize parameter specifies the number of stack locations in I/O request packets (IRPs) that are used by Windows 2000 Server, by Windows Server 2003, and by Windows XP. You may have to increase this number for certain transports, for media access control (MAC) drivers, or for file system drivers. Each stack uses 36 bytes of memory for each receive buffer. This value is set in the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

The default value of the IRPStackSize parameter is 15. The range is from 11 (0xb hexadecimal) through 50 (0x32 hexadecimal).

If the subkey is not present, you can use Registry Editor to add the subkey. To do this, follow these steps:

1.       Click Start, click Run, type regedit, and then click OK.

§  Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

3.       Click Edit, point to New, and then click DWORD Value.

§  Type IRPStackSize, and then press ENTER to name the value.

Note Type IRPStackSize exactly as it is displayed. The value name is case sensitive.

§  Click Edit, and then click Modify.

§  In the Data Value box, type the value that is appropriate for the network, and then click OK.

If the problem persists after you complete this procedure, increase the value of IRPStackSize even more.

Note On some computers, values from 33 through 38 can cause problems. For information about a hotfix that addresses these problems, click the following article number to visit the article in the Microsoft Knowledge Base:

924749 Event ID 2021 is logged even though lots of non-paged pool memory is available in Windows Server 2003

————–

WHAT WORKED FOR ME WAS

IRPStackSize DWORD set to Decimal 50

NOTE INSTEAD OF REBOOT JUST DO THIS:

WINDOWS+R

Services.msc

Find Server and Right Click Stop and Then Right Click Start, Or just Right Start

One thought on “Cifs Samba error 12 fixes – Windows Share mounting on linux

  1. I saw bits and pieces of this info scattered everywhere while trying to solve my error 5 running the latest ubuntu 14.04 trying to mount a share from another box running the latest windows 2012. I didnt know I had to reboot the windows server after the registry fix and I didnt know that numbers above 12 were ok – using 50.

Leave a Reply

Your email address will not be published. Required fields are marked *