File Copy Performance to USB Drive Oscillating Between Fast and Slow

I just had the “pleasure” of having to copy the contents of a terabyte USB disk to another similar USB drive. At first, I did not give this simple task much thought. I plugged the USB cables in and made my faithful Total Commander do the work. It did not take me long, though, to notice a strange phenomenon: the copy speed would oscillate between 8 and 24 MB/s.

For 10-20 seconds it would copy quickly at around 24 MB/s, only to drop to around 8 MB/s for a while. Then it would be fast again. And slow. You get the picture. Things like this make me really unhappy…

Who’s the Bad Guy?

My first suspect was the virus scanner. I deactivated it, checked Total Commander’s copy speed indicator, and found … no change. Too bad. It is disappointing to realize your enemy is not always the culprit.

Then I played around with the power settings. The system was on the “balanced” power plan, which allows the OS to reduce the CPU frequency and do other things to reduce energy consumption. As you may have guessed, messing with the power plan did not change a thing.

Finally, after googling around fruitlessly, I checked the external hard disks’ properties in device manager. Interestingly, the write cache was disabled. This is on the “Policies” tab, where I changed the setting from “Optimize for quick removal” to “Optimize for performance”. A reboot later the oscillations were gone. With the write cache enabled, the transfer rate settled at about 16 MB/s.

Lessons Learned

What can we learn from this? Obviously, Windows disables the write cache for external hard drives in order to reduce the impact of users unplugging their disks without notifying the OS first by clicking on the “Safely Remove Hardware” icon. While it is easy to mark this as another stupid idea from Redmond (after all, performance is king to many of us), I find it more interesting to ask whether copy performance is affected at all. A write cache can speed up writes significantly, but only if a substantial amount of the data to be written fits into the cache. As soon as the cache is filled, the transfer rate is reduced to the actual write performance of the disk again (in this case: to the rate the USB chip in the drive enclosure can cope with). So when looking at a large copy job, the write cache mainly levels the transfer rate curve. That conveys the impression of a nice steady transfer, but it does not change the overall transfer rate. This conclusion is consistent with my empirical findings - turning the write cache on did not substantially change the overall time for the copy job to complete.

Side Notes

I made my observations on Windows 7 RC. They may or may not apply to other versions of Windows.

Another small thing I learned: you do not want your system to go to sleep in the middle of the copy job. This can easily prevented by activating presentation mode: press Win+X to switch it on.

Comments

Related Posts

Fixing VS Code UI Unresponsiveness Caused by GitHub Copilot Extension

Fixing VS Code UI Unresponsiveness Caused by GitHub Copilot Extension
This article shows a simple solution to a problem that doesn’t seem to be adequately documented: VS Code UI lags, freezes, and delays caused by the GitHub Copilot extension. Problem: VS Code UI Becoming Slow Having worked on a Python project for a while, I noticed that VS Code’s UI was frequently freezing for seconds at a time. This was happening in various places of the UI: the editor itself but also in the GitHub Copilot Chat window. Copilot also seemed to be taking more and more time getting ready to answer, and the extension-host process would fully saturate one CPU core for long periods of time.
Applications

Hardware-Encode Video in H.265 with Free Tools to Save Disk Space

Hardware-Encode Video in H.265 with Free Tools to Save Disk Space
Many web meeting services have a recording functionality. Most recordings are provided as MP4 files with the video encoded in H.264 because that offers the most universal compatibility. However, it also needs a lot of disk space. H.264 has a successor, H.265, which only requires half the space for the same visual quality. This post shows how to use StaxRip, a free tool, to re-encode H.264 video into H.265 quickly by making use of GPU hardware encoding.
Tips and Tools