Why Consider RAID for PVR Recordings and Solid State Drive for Mythbuntu Operating System?
Summary
This article is the first in a mini series and outlines the reasons
why you might consider storing your PVR recordings on a RAID.
Additionally the reasons why we also opted to store the Mythbuntu
operating system (OS) on a Solid State Drive (SSD) are discussed.
The original series of articles that outline the path of creating a
custom-built PVR can be found at the following links:
- Cutting the cord on cable TV
- Selecting hardware for a MythTV PVR
- Installing Mythbuntu 12.04.2 with MythTV 0.25
- Configuring MythTV automatic wakeup and shutdown
Contents
- Why Consider RAID for MythTV PVR Recordings?
- Why Consider Solid State Drive for Mythbuntu Operating System?
- High Level Migration Steps
- Final Decision
- Future Articles
Why Consider RAID for MythTV PVR Recordings?
NOTE: TL;DR |
First I should begin by describing what a RAID is before delving into
why you might consider RAID for your storing your TV shows. RAID
stands for Redundant Array of Inexpensive Disks and is a method of
using multiple disk drives in such a way that the loss of one drive
does not result in loss of data. One of the simplest forms of RAID is
where one drive mirrors the contents of another drive. This is known
as RAID level 1 and is the RAID setup we consider in this article.
So why consider RAID for PVR recordings?
Personally I thought I would never consider RAID for a PVR. After
all, the hard disk drives in my desktop computers have proven very
reliable over many years. In fact one of my computers that I use for
testing GParted was purchased back in
1998 is still using the original hard drive. That is a track record
of 16 years, and none of my newer computers have lost a hard drive.
Of course I might just be lucky with my desktop computers. ;-)
Further in my reasoning, PVRs store TV shows and how important is a
TV show anyway if one were to lose a hard drive? After all it's
only TV.
Unfortunately I was soon to learn that there are more factors
involved and there was folly in this line of reasoning.
As I mentioned in earlier articles, starting in May 2011 I was
involved with building three PVRs: one for my spouse and I, one for my
parents, and one for a friend. Performing these three installs made
me very familiar with the setup process, and I thought that once set
up that these systems would continue to run for many years...
Wrong!
I got my first indication when our own PVR hard drive failed after 91
days of operation. Since the drive was covered under a 1 year
warranty, the drive was replaced by the manufacturer. With a new
drive in hand I re-installed Mythbuntu (11.04 at the time) and
re-setup the PVR.
A second indication of the frailty of hard drives came in April of
2013 when my parents' PVR hard drive failed after 679 days of
operation. Since they live far from me, I would have to schedule a
trip to replace the drive and rebuild their PVR. This got me to
thinking that even if the loss of TV shows was not critical, there
must be a better solution so that I would not have to perform many
re-installs and re-setups of PVRs.
So why are these PVR hard drives failing when my desktop computers
continue to run for many years?
My first thought was that I had simply received a bad batch of drives,
and this could indeed be the case. However I had purchased and
installed the same drive in my desktop computer and it is still
running fine today (February 2014). This led me to investigate different
usage patterns.
With my desktop computers I often power them up for a few hours and
then shut them down later when I am finished working. This is similar
in operation to how I configured the PVR to automatically wakeup to
record shows and then shutdown later when idle. Hence this usage is
similar.
So what else is different between desktop computer and PVR
operation?
With my desktop computer I read many files, but do not write much
data. The exception to this would be when I download a CD image of an
operating system which is in the order of 700 MB. In contrast, our
PVR records on average about 2 to 3 hours of TV shows each night.
With HDTV shows occupying 9 GB per hour, this is 18 to 27 GB written
each day! Further with four tuners that can run in parallel there
could be up to four processes recording shows, four processes
commercial flagging, and one more process viewing an existing
recording. This is a lot of hard drive activitly and is a big
difference from my desktop computer usage, and I think is the reason
the hard drives fail quicker in the PVR. At least that is the theory
that sounds reasonable to me.
So how can I minimize the impact of these hard drive
failures?
My initial thought was that perhaps there are more durable drives for
this type of usage. From research into hard drives designed to handle
multiple video streams, I discovered that such drives do exist, but
are much more expensive (twice as much). Moreover, when I tried to
purchase such a drive from my local computer shop I discovered that
these drives are either not available to consumers, or are a special
order item. This would not work for me because when a drive fails I
want the option to replace it right away, and not have to wait for an
order to arrive. In addition there was no guarantee that these
specialized drives would last longer, and further, some manufacturers
seem to have ceased production of these hard drives (for example
see Seagate
SV35 Series Surveillance Hard Disk Drives).
Fortunately there is another way to achieve improved reliability while
still using consumer grade drives -- RAID. Since my motherboard did
not support BIOS RAID, I would need to investigate Linux Software
RAID.
With the decision made to store the PVR recordings on RAID, the next
question was what to do with the Mythbuntu operating system (OS).
Why Consider Solid State Drive for Mythbuntu Operating System?
Now that the PVR recordings were to be stored on RAID, I had to decide
what to do with the Mythbuntu OS. My immediate thought was to place
the OS on RAID. In theory this should work if I placed the OS on a
BIOS RAID (also known as FAKE RAID) because the BIOS could directly
recognize and boot from the RAID.
However, I was considering Linux Software RAID and the challenge I
faced is that the computer BIOS does not recognize Linux Software
RAID, and is limited to booting from individual disks. To work around
this limitation would require creating a separate /boot partition that
was not in the RAID and using that to boot the OS contained inside the
Linux Software RAID. The drawback to such a setup is that I would
have to manually mirror /boot (plus the Master Boot Record boot code)
on both drives, and potentially have to manually change the boot drive
in the BIOS when one of the hard disk drives failed. This was not
something I desired to undertake. After all, I wanted the PVR to
continue running without intervention until I had free time to replace
a failed hard drive. Hence the PVR had to keep running while I was
away on vacation, or until I could schedule a trip to my parents
remote location to replace a failed hard drive.
With RAID out of the picture for the OS, what else could I do to do
to increase the reliability of the PVR?
Because the PVR recordings appear to significantly shorten the hard
drive life span, I realized I needed to separate these recordings from
the OS. In thinking about purchasing a new disk device for the OS I
realized that I only needed about 50 GB for the OS and linux-swap.
This lessened the price differential between a 1 TB Hard Disk Drive
(HDD), and a smaller 60 GB Solid State Drive (SSD). Further, a SSD
also offers additional advantages for the OS. Specifically a SSD
contains no moving parts and should last much longer than a physical
spinning hard drive. Also as a side benefit a SSD should boot faster
too. I really liked these benefits and so decided the OS would be
placed on SSD.
Since by this time Mythbuntu 12.04 had been released and I was running
Mythbuntu 11.04, I saw this as the perfect opportunity to also upgrade
to the newer version of Mythtbuntu.
High Level Migration Steps
While writing this article I initially planned to include all of the steps, but discovered these would make for an unwieldingly long article. So as a compromise I decided to break out the steps into two new tutorials, and just include the following high level steps in this article.
- Purchase additional hard disk drive (HDD) and new
solid state drive (SSD)
Category Component Cost Additional Hard Disk Drive Seagate Barracuda 1TB 7200RPM SATA 6 GB/S 70 New Solid State Drive Intel 60GB 520 series SATA 6 GB/S 110
- Install new HDD and SSD in computer
In my computer I plugged the drives into the SATA ports in the following order:
- /dev/sda - new SSD for Mythbuntu 12.04 OS.
- /dev/sdb - original HDD containing Mythbuntu (11.04) and
recordings.
- /dev/sdc - new HDD for mirrored RAID storage of recordings.
- /dev/sr0 - original DVD R/W optical drive.
- Migrate Existing MythTV 0.24 on HDD to MythTV 0.25
on SSD
- Backup existing MythTV 0.24 database using mythconverg_backup.pl script.
- Alter BIOS to place SSD higher in boot order than other HDDs.
- Install newer Mythbuntu 12.04 on SSD.
- skip MythTV configuration steps
- ensure /etc/fstab set to mount /data from HDD (sdb)
- ensure ownership mythtv.mythtv for files and folders in /data - Import MythTV 0.24 database backup into new MythTV 0.25 using mythconverg_restore.pl script.
- Install and setup Linux Software RAID and migrate
PVR Recordings
- Install and configure packages for Linux Software RAID.
- Partition and setup new hard drive (sdc) as one half of RAID level 1 mirror (/dev/md0).
- Copy /data from original hard drive (sdb) to new RAID (md0).
- Update /etc/fstab to mount /data from new RAID.
- Re-partition original hard drive (sdb) to same partition layout as new HDD (sdc) used in RAID.
- Add original hard drive (sdb) to RAID.
- this completes the other half of the RAID level 1 mirror.
The above are very high level steps of the process I undertook. In the near future I plan to cover these steps in more detail in additional tutorials.
Final Decision
In conclusion, we made the decision to store PVR recordings on a
mirrored RAID due to the heavier write usage demands of a PVR versus a
desktop which can result in earlier failure of hard drives. Further
due to additional challenges of placing the operating system on a
Linux Software RAID, I opted for a separate drive (an SSD) for the
Mythbuntu operating system and boot code.
UPDATE Feb. 10, 2014: While writing this article, the warranty
replacement drive I received in August 2011 started to fail after 995
days of operation. I sure am glad that I decided to place the PVR
recordings on RAID. :-)
Future Articles
In future articles, I plan to cover the following steps of our path: