File copy fails with the error “Insufficient System Resources”

Ø Apply KB 312362 https://support.microsoft.com/kb/312362

Ø Configure the below keys to maximize server resources. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\Parameters subkey, configure the following entries:
• Name: MaxWorkItems Data Type: REG_DWORD Value data: 8196 (decimal)
• Name: MaxMpxCt Data Type: REG_DWORD Value data: 2048 (decimal)
• Name: MaxRawWorkItems Data Type: REG_DWORD Value data: 512 (decimal)
• Name: MaxFreeConnections Data Type: REG_DWORD Value data: 100 (decimal)
• Name: MinFreeConnections Data Type: REG_DWORD Value data: 32 (decimal)

In the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanworkstation\Parameters subkey, configure the following entry:
• Name: MaxCmds Data Type: REG_DWORD Value data: 2048 (decimal)

By default, your registry does not have a Configuration Manager subkey. To create the key, locate and then right-click the following subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager Point to New , and then click Key . Type Configuration Manager , and then press ENTER. In the new HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Configuration Manager subkey, configure the following entry:
• Name: RegistryLazyFlushInterval Data Type: REG_DWORD Value data: 60 (decimal)

 =============================
Reason for adding or modifying above keys
==============================
<https://support.microsoft.com/?id=312362>
By default, the Memory Manager tries to trim allocated paged pool memory when the system reaches 80 percent of the total paged pool. Depending on the system configuration, a possible maximum paged pool memory on a computer can be 343MB and 80 percent of this number is 274MB

By tuning the Memory Manager to start the trimming process earlier (for example, when it reaches 60 percent), it would be possible to keep up with the paged pool demand during sudden peak usage, and avoid running out of paged pool memory.

This problem can occur because the functions used by all of the copy utilities use buffered input/output (I/O) to transfer data from the source file to the destination file. Whenever buffered I/O is performed on a file, there is a paged pool memory overhead requirement that is proportional to the size of the file. Because paged pool memory is a limited resource, there is an upper limit on the size of file that can be copied.

Since all of the paged pool that is required to buffer an entire file is allocated when the first read or write procedure is performed on the file, the file copy operation fails immediately, instead of half way through the operation.

Regarding PAE

The CopyFileEx and CopyFile functions are used by all of the standard file-copy utilities. Because these functions use buffered I/O, the maximum size of a file that you can copy depends on the amount of paged-pool memory that is available at the start of the copy procedure and whether the Physical Address Extensions (PAE) kernel which allows access to memory above 4 gigabytes [GB] is in use. With the standard kernel, 1 kilobyte (KB) of paged pool is required for each megabyte (MB) of file size that is opened for buffered I/O. Because there are two files involved in a copy procedure, 2 KB of paged pool are required for each MB in the source file.

When the PAE kernel is used, the overhead is doubled and 4 KB of paged pool is required for each MB in the source file.