Going green on my MythTV Server.

I documented my MythTV server build as many people have asked about it, and are interested in how I went about getting to the configuration that I am running today.
I will admit that the power consumption of this server has become a bit of a passion with me, and I think I am at the point of a diminishing return of saving money by changing the configuration to lower the power. Today my average is down to about 150 watts, and I would like to get it down to 100 watts average, on the main server. As our storage needs grow I know that I will probably not be able to get there.

I have always had at least one server running 24x7, and never thought much on how much power it took to keep things running. This server has always consisted of an older machine that was pushed into service, as speed and raw power was not usually a consideration for the services that I needed it to provide. I purchased a kilo-watt-meter and on a whim one day I plugged it into the UPS on my main server at the house. 500 watts was the reading, and I was surprised that it was drawing that much power., and this reading did not include the monitor. The hardware was an older pentium 4 with dual power supplies, 6 hard drives, cdrom drive, and a tape backup. Also attached to the system were two external hard drives in an old 5 1/4 enclosure. A quick calculation of what this server was costing me in power came out to $260.00 a year, at the winter rates. To round out to an even number 50 watts cost about $25.00 a year to run, so I would use these in my future calculations.

The basic services running on the server are.

  • DHCP for the home network.
  • Samba file sharing for the workstations on the network.
  • Anti-Spam e-mail software for all my e-mail accounts.
  • ZoneMinder video security software monitoring 4 cameras.
  • MythTV backend that I have been playing with, and have been wanting to expand.
  • Web Server that serves up personal pages, and access to my library.
  • Backup repository, for important data on the workstations.
  • MySQL database.
  • Linux development environment.
  • Bit-Torrent Client.

The old server Drive inventory, (Also included in this list are external drives I had connected to my laptop which should be on the server)

  • 4 250 GB SATA Drives in Raid 5 (50% Full, running on 2 2 port PCI SATA cards)
  • 2 1TB SATA Drives for data. (No Raid used for Backup, and non critical (IE Replaceable) Data.
  • 2 500 GB IDE drives in external enclosures, holding data that is mostly on CD’R’s
  • 1 Linux OS Drive.

So I set out to see were all the power was going. One of the first things I did was turn off the redundant power supply and the power dropped by about 150 watts. That was a start. As the hardware was aging anyhow I thought about building a newer server to give me a little more room to install a working MythTV system, and still keep all the other services that I was running on the server. I set my sites on trying to shoot for 200 Watts of power consumption, which would come out to about $100.00 a year in electricity to run the system.

I am used to working on large scale computer systems, that is what I do for a living, so I wanted to add some redundancy into the system, but nothing I was running on it was super critical, and I could afford to be with out it for a day or so if need be. (Although my wife gets very upset if the system is down and I miss a recording of her Soap Opera, or American Idol!!!

So I came up with a few design goals, trying to balance availability, lessons learned in the past, and trying to get my power usage down.

  • The more drives in a raid array the more likely you are to have a failure, so if you do not need high availability, do not use Raid.
  • All important data will live on a RAID array. (Data Files, Photos, Digital Book Library, Etc)
  • I have had problems with CD’R’s losing data after as little at 5 years, so I wanted to get these back on magnetic media, even if it was off line.
  • Discontinue the use of tape as a backup media, it is expensive, and a PITA in this environment. As a result I was not doing them as often as I know I should.
  • Backup Disks can not share the same controller and PS as their data disks. I have had a PS go bad and take out all the drives connected to it in the past.
  • Data Drive Access speed only needs to be slightly faster than the max network transfer rate.  (I am very happy with the 2TB Samsung Spinpoint F4 drives)
  • Video archives do not change much and are not high availability so they do not live on a raid.
  • Drives should be kept spun down or off line if possible.
  • Active drives should be kept as cool as possible.
  • No new drive will have active data on it until it has been on line and actively running for 4 weeks.
  • All drives are to be replaced every 3/5 years. (Mark them with the date they were put into service)
  • Some sort of off site backup needs to be in place, that can hold a large amount of data. (2nd Cheek backups)
  • Do not rely on RAID as a means to protect the data. This has worked well in the past, but is a disaster waiting to happen.
  • Backup Everything that is important or takes a long time to recover, especially the metadata. (I have spent lots of time cleaning up MP3 tags on our music, and descriptions of the electronic books in the library)
  • Automate as many of the tasks as possible, especially the backup, and monitoring procedures.

New Egg had a sale right before Christmas in 2009 for a AMD A2+ A3, compatible MB with 6 SATA ports and lots of expansion slots, for $35.00 which I thought would make a good server MB. I chose the processor based on its power consumption alone. I wound up with a Dual Core AMD that was rated at 65 Watts. I ordered 2 Gig of ram to go with it, and a new power supply. A 2 drive External USB case for my backup disks. All said and done the total was $277.00 If this cut the power consumption in half I would pay for the new hardware in about 1 year. I would be using my existing case, and drives from the old server.

MythTV Considerations on the new server.

As I had cable and satellite turned off, I ordered an HD HomeRun which basically has 2 HD TV tuners built into it, and can steam those signals to the MythTV server. This is connected to an outside directional antenna I purchased from RadioShack. Even though I could care less about HD TV, I am forced to deal with it. I chose to start out with a 1 TB drive to hold all the recordings within Myth.

One of the other things I wanted to do was to RIP the entire DVD collection down to the server so they could be used by Myth. I set aside 2 1TB drives to hold all of these video’s. Many are in .avi and many of the others are in .mp4 format. (All new rips are in MP4 format)

The first iteration of the new server had compliment of.

  • 120G IDE drive for a boot disk. (Internal MB Sata Port)
  • 1 1TB drive for Myth Recordings. (PCI 2 Port SATA Card)
  • 1 1TB drives for Myth Movies. (PCI 2 Port SATA Card)
  • 4 250G Drives in Raid 5 for Data. (Internal MB Sata Ports)
  • 1 500G IDE drive for temporary storage, and working space, also used as a backup for the OS drive)
  • 4 Port PCI Video capture card for security cameras.

  • 2 1TB drives in an external USB Enclosure for backups.
  • 1 WD 500G USB External Drive

Once the server was all configured and set up every port that could have a HD attached was full. Total power draw was about 250 watts, a little higher than my goal.

I Started playing with setting the drives up so they would spin down and go into standby mode when not in use. At times I could get the system down to 225 watts or so. I tried to put the Raid 5 Array into standby when not in use. I could drop almost 30 watts by putting the old 250G drives into standby, but the raid drives would not sleep long, and I had raid failures, and had to keep rebuilding the array. I never lost any data on the raid, but this was not a good thing.
I also noticed that the data drives would be spun up when I checked, and nothing should have tried to access the drives.
The drives in the external Rosewell USB enclosure I could never get to spin down and go into standby. I could read SMART data off of them though, which I could not on the WD external, but the WD external at least went to sleep.

My main server is a dual core AMD with 6 Gig of ram. Video source is a HD Homerun on an antenna. 
It runs the Myth Backend, Zone Minder Security System, with 4 cameras, Anti Spam for all our mail accounts, A OSX VM that keeps the family's calendars and music in sync, and occasionally transmission and handbrake. I am on the edge of using all the resources of this server at times, but it is not uncommon for it to be sending 3 streams out, and recording 2 channels at the same time, and ripping a DVD and everything works fine. 

Attached to the server is a Rosewell RSV-8 storage tower that holds 8 drives. I purchased from NewEgg

This tower supports 8 drives on 2 sata channels and uses sata port multiplication, which means that is shares the bandwidth of 4 drives with the bandwidth of 1 sata channel. This has not proven to be a problem in my setup.  It comes with a 2 channel PCIe ESATA card, and cables. I had problems with the cables and replaced them with more flexible higher quality ones, and have not had any more problems with the drives going off line. 

In the main dual core server.

  2 DVDROM Drives
  2 320G sata boot drives in raid 1 (These are very fast seagate drives)
  2 2TB sata drives in raid 1
  1 2TB sata drives that we use for our OTA recordings from myth
  2 2TB sata drives in raid 1 that we use for general data storage

  In the 8 bay tower 
  2 2TB sata drives for backups from the laptops and workstation on the network
  2 2TB sata drives that hold our general movie collection set up to myth as storage groups.
  2 2TB sata drives that are spares / general purpose drives.
  I have 2 bays open for future expansion.

  I have a 2nd server that was built for speed and on demand uses. It has a 4 bay sata enclosure that holds drives for backups from the main server.
It holds
 2 2TB drives to backup the movie collection to.
 1 2TB drive to backup the data raid to
 1 1TB drive to hold the main server backups.

  This server is normally powered down.  This server is up only when I need its resources. I use it to run VM's and to rip DVD's etc. The drives are only up when backups are run. (Just a note this servers power is not in my measurements that I mentioned above, as it is an on-demand server, and was build for speed and not power savings)

  The one hole in my system is that the OTA recording are not backed up or raided at this time. My next plan is to move this to a raid, but it will still not be back backed up. The myth database lives on the main raid and is backed up to the data raid. Storage groups join the main movie drives, so the size of the drives does not matter, therefore it does not need to be raided, and I can add drives as needed with out having to reconfigure the filesystems etc.  As one drive fills up it changes very little, so backups for full drives are uncommon. On the drive we are adding movies to, I do a manual backup to the 2nd server when I add movies to it. All other backups are automated, and I use custom software that I wrote that works very much to Apples Time Machine, using rsync. Laptops and workstations are backed up every day, the server drives are backed up every week, or before and after I make massive changes. This makes backups very quick and painless as only changed data is backed up. Data that has not changed is simply linked to the file in the previous backup.

To help save on drive wear and tear I turn off the recording of access times (noatime in the fstab file) to off on all drives but the OS drives, and the Myth OTA recording drive. 

 All drives are put in sleep mode after they have been idle for 30 min. This works well on the software raid1 but I have had problems doing this with software raid5 and raid6. If you are monitoring the drives using the SMART utilities there is a flag you can set to check to see if the drives are asleep and it will skip them. Otherwise SMART will wake the drive up, or never let it go to sleep.
Remember you have to take the whole system into account, and one big raid in my opinion is definitely not the way to go with myth. The developers have given us storage groups for a reason. The advantage of storage groups is that adding disk space only requires you to add the drive, no changes need to be made to your existing data, which is always safer. Only the active drive needs to be awake and running when you are recording, or streaming a movie, This reduces the overall time on the drive, and reduces the heat that is generated. Heat is the number one killer of hard drives. If you loose a drive you only loose the data on that drive, not a whole array. I have seen many raid5 and raid6 arrays fail either through hardware or software. If your controller goes bad the whole array is lost in some cases.  It is not uncommon for  someone make a mistake rebuilding a failed array and wipe the whole array out. Never rely on RAID as your backup. With 2TB drives commonly sold for $75.00 at newegg the price of the backup drive is peanuts. Your backup plan also needs to include some time of offsite backup for you most critical data. My 2TB raid on the main server is copied out to and external 2TB drives and taken off site at least twice a year. I have 2 drive I rotate out off site for this. Digital Photo's, personal data etc are kept on this raid so everything that is really important is off site incase of fire, flood, theft etc.

This setup has worked good, and has evolved over the years into what it is today. Getting the power down is more of a hobby than a necessity. About the only way I am going to be able to get the average any lower is to eliminate the external drive tower and put all the drives in the case, with a high efficiency power supply. I am considering it, but the external case sure is nice, and I am not sure that it is worth the 20 watts for so that I could save. Remember that the biggest way to improve the reliability of your system to to eliminate as much heat as possible. If you can keep the server(s) in a basement, and keep everything cool you will get good service from your system.

I hope this will give you some ideas, and also help those that are building or evolving their MythTV servers.