MacOS – Explanation for Ridiculously Slow Copy Speed

encryptionfindermacosperformancersync

I am backing up data files from one encrypted image to another. They're text files ranging in size from a few hundred kilobytes to a few megabytes. The process has become excruciatingly slow and is now clocking in at taking a 2 days to copy 8 gigabytes.

I'm doing this with a Finder copy in OSX Lion. I've tried using cp, rsync and ditto from the terminal but speed problems persist. I've also noticed that the speeds are reasonable at the beginning of the copy process but get very bad roughly 10% of the way through. They also improve temporarily following a reboot. Here's the io load during a copy:

mac:~ me$ iostat 5

      disk0           disk1           disk2           disk3 
KB/t tps  MB/s     KB/t tps  MB/s     KB/t tps  MB/s     KB/t tps  MB/s  
9.11  32  0.29   105.94  65  6.71     8.32 342  2.77   119.57  60  7.00 
7.03   7  0.05    16.00   6  0.09     4.00 558  2.18     0.00   0  0.00 
5.62   6  0.04   117.67  56  6.48     4.62 689  3.11     0.00   0  0.00

So I don't even know where to start in terms of diagnosing the cause. Some things I've considered:

  • The encryption keys vary across images, thereby requiring encrypting and decrypting
  • The image is close to full capacity
  • The drive holding the image is close to capacity
  • The file sizes can vary considerably
  • The destination is highly fragmented

I can't rule any of these in or out though and don't know where to start looking to diagnose the problem

Best Answer

OK - your iostat output is showing you that the disk2 spindle is the limiting factor. I would guess from the relative idleness of the other drives that you are copying from and to images stored on disk2. In that case, the head will seek back and forth and back and forth rather than filling up the drive buffer with lots of data.

Typical hard drives cannot perform more than several hundred IO per second due to physical limitations of the head moving along with rotational speed limitations (some time is lost waiting for the drive to spin so the area where the write will happen is under the write head.).

You could try making sure the data being written is going to a physical disk different than the one where it is being read and see a substantial speed up.

It might be faster to first copy the disk image to one of your other three drives, do the copy and then delete the source image from the "temporary" location.