Thursday, April 06, 2006

Increasing MythTV storage capacity

Space and power problems
It was time to upgrade my MythTV storage but the Dellbox I use for my master back-end had run out of drive capacity and more importantly; 12v power. I had to attach and power additional storage externally or acquire a completely new server...

Adding 300Gb
Bought a bare 300Gb PATA Maxtor DiamondMax drive and a cheap PCI USB 2 card (the Dell only had USB 1 onboard). I already had a couple 5.25" drive cages suitable for 3.5" drives, one was PATA-firewire, the other PATA-USB 2. I also had a PCI firewire card lying around.

Firewire or USB?
Tested throughput with both setups; firewire cage+card and USB2 cage+card and decided to go with the USB2 transport. Both transports were really slow (~10Mbyte/s) but the USB storage driver had the slight edge. I'm fairly sure the bottleneck is in the IDE bridge chips used in my cages - perhaps they don't kick the drive into DMA or something but no-matter what I've tried, I can't increase the speed using these particular external drive cages.

Anyhow, I wanted to keep my original 200Gb drive in the final setup but test out the 300Gb hanging off the USB2 transport so I copied all my Myth recordings over from the internal 200 to the external 300 and let this run for a week to check for problems. I didn't even use any of the extra space of the 300 in case I needed to revert to the internal for some reason or other. Suffice to say that it worked fine, even limited to 10Mbyte/s disk bandwidth. Given that the highest data-rate coming off of my PVR350 is about 10mbit/s, I didn't actually expect a problem. However, if I ever get my DVB card hooked up (it's missing an aerial), I will probably need to revisit this...

Finishing Up
So, I finally glued everything back together using LVM, growing the XFS filesystem to the full 465Gb - yep 200(186)+300(279)=465. While I was at it, I decoupled the disk that holds the database from the disks that store the recordings. (I had earlier used spare space from the OS disk to expand the recordings area but sharing disk IO between simultaneous database updates and Myth recordings was not one of my best ideas and is generally frowned upon).

I reserved 20Gb on the new LV to reduce XFS fragmentation and give me some breathing space to run xfs_fsr if necessary. I also increased the Default recording quality to match my old High-quality settings.

Results
  1. Higher-quality recordings
  2. More recordings; increased time-to-expire for TV shows
  3. More movies available online
  4. Elimination of almost all MPEG stream recording corruption
  5. Increase in overall reliability of MythTV subsystem
The last 2 are likely due to decoupling the database/OS disk from the recording disks. Although this can work and provides an increase in recordings storage, the tradeoff appears to be a reduction in overall MythTV reliability.