събота, 27 октомври 2012 г.

Fix the performance of WD My Book Live with Macs

I wanted a simple NAS to use with my several Apple Macs in the house. I could have built one myself, I am more than capable of doing that, I simply didn't want to spend the hours on it. I upgraded the unit to the latest firmware and I was pretty disappointed when I was only reaching 700-800KB/s after uploading several gigabytes of photos and videos. Directory listing took long time - in the vicinity of 4-5 minutes, and every directory change - up and down the tree would take as much. I was pretty much to return the drive, but all my regular drives are WD, so I knew something is wrong and they can't ship such a bad product.

Some indian engineer at WD didn't read the docs right, or probably never bothered reading them. They had the data partition formatted as ext4, the worst filesystem when it comes to fstat() and similar calls performance. My drive was writing at 750kb/s and at the same time was reading back in excess of 25MB/s, just to keep up with the metadata and fstat calls, and the little cpu inside was killing itself with more than 90% iowait.

Just enable SSH and format the data partition to XFS, and get the following benefits:

* When listing a folder from a Mac client (afp) it only takes less than a minute to list it. Going up and down the tree does not cause any additional wait - the listings and metadata are kept in memory by xfs, so they are supplied instantaneously to the computer viewing it.
* The upload transfer rate is about 8.3MB/s or slightly faster, even for computers on my wireless, where it used to be 700-800KB/s before. That is not great, but just enough for what I need it. The little power pc cpu is not killed by iowait and there is no excessive disk read, so the disk drive is not going to suffer premature failure.

Disclaimer: If you want to modify your NAS - do so at your own risk. I will not provide detailed instructions. You should know what you are doing.