Sunday, 4 October 2015

Troubleshoot Windows Server file copy errors

Copying large files to a Windows Server file share can sometimes fail. Performance Monitor or PowerShell commands can help find and fix file copy errors.

Server Message Block file shares have existed for long enough that they are generally stable and reliable. However, some administrators have found that copying large files from a Windows 7 or Windows 8 client computer to a Windows Server file share can result in erratic -- and sometimes problematic -- behavior.
The first step in resolving file copy errors is to recognize what type of behavior occurs by design and what behavior indicates a problem. In Windows 7, it is usually easy to distinguish between normal file-copy behavior and problematic behavior. But due to the way the Windows 8 buffering process works, it can sometimes appear as though there are problems when none exist.
When copying a file to a remote file share, Windows 8 uses a memory buffer. It reads a portion of the file into memory, and then writes it to the file share. With smaller files, this technique results in very fast file copy operations. With larger files, the file copy process initially goes very quickly and then slows to a crawl (Figure A).
Copying files over the network
Figure A: When copying a large file in Windows 8 to a file share on the network, the transfer will start fast then slow significantly.
If the file being copied is not excessively large, then the behavior in Figure A will continue until the copy finishes. For larger files -- or computers with smaller buffers -- the copy operation will occur in spurts. Large chunks of data will be copied, with periods of little to no activity in between. These slowdowns occur as the operating system flushes and then repopulates the buffer (Figure B).
Inconsistent file copy behavior
Figure B: In some cases, the file copy process may vary in speed.
Neither of the conditions shown in Figure A and Figure B indicates a problem. This is normal behavior for Windows 8.1. However, in some cases, the file copy process may time out, resulting in an error message (Figure C).
File copy time-out period

Figure C: In some cases, the copy will fail when the time-out period expires.
This problem only seems to occur when copying very large -- 10 GB and larger -- files. The error message in Figure C is "Error 0x80070079: The semaphore timeout period has expired." This general error can be hard to diagnose. The error can occur with Windows 7, Windows 8 and possibly other versions of Windows. It can be caused by the Windows desktop, Windows Server or the network connecting the two.
Check the server logs
Begin the troubleshooting process by checking the server's event logs. While this error may not generate an event in the log, you may spot something else that could contribute to the time-out.
Next, check if the server or the workstation is causing the problem. Although the Performance Monitor can help, subjective tests are just as effective. Start a large file copy that is likely to produce an error, and then test the responsiveness of the server and the desktop. Can you play a video on the desktop? Can you write files from another desktop to the server while the file copy process is going on? In most cases, you will probably find that the desktop remains responsive, but that the server's performance decreases dramatically.
Use PowerShell for a further diagnosis
If you isolate the problem to the server, then you will need to work to find the exact cause of the problem. The issue is almost always related to a storage bottleneck or network bottleneck. These bottlenecks can be the result of a poorly designed configuration or a health problem. Run the following twoPowerShell commands on your file server:
Get-PhysicalDisk
Get-PhysicalDisk | Get-StorageReliabilityCounter | Select-Object ReadErrorsTotal, WriteErrorsTotal, Temperature
These commands will show whether the disks in your server are healthy, and whether or not any read or write errors are occurring. Sometimes, the file-copy time-out error occurs because of an unhealthy disk that cannot keep pace with the I/O requests.
It is also a good idea to review how the server's physical network adapters are being used, especially if the file server is a virtual machine. Imagine that a host server has a single NIC team that it uses for all traffic. Virtualization-related operations, such as live migrations and replication operations, can steal bandwidth from user sessions and cause file copy operations to time out.
If you are not immediately able to solve the file copy errors, then you might be able to temporarily work around the issue by using a dedicated file-copy utility, such as Robocopy, rather than the operating system's built-in copy functionality.

No comments:

Post a Comment