[mythtv-users] video artifacts on recordings: could building a raid be the cause?

Jan Ceuleers jan.ceuleers at gmail.com
Wed Dec 27 10:23:55 UTC 2017


On 27/12/17 10:48, UB40D wrote:
> I rebuilt my myth box after several months of downtime and I decided to
> bite the bullet and finally build a RAID to store the recordings. This
> is on ubuntu 16.04, using mdadm.
> 
> Several (all?) recordings made yesterday had video artifacts ranging
> from mild to unwatchable: square patches in areas with motion, frame
> hiccups, sometimes the bottom 2/3 of the frame without picture.
> 
> Could this be due to the fact that the raid array is being built in the
> background? I originally didn't think it would, given that
> - the machine usually copes with several simultaneous recordings
> - top says that the md0_raid5 rebuild process only takes between 2% and
> 20% of the cpu

Top informs you about the possibility of CPU utilisation being the
bottleneck. You established that it wasn't.

A more likely bottleneck when building a RAID is that I/O bandwidth is
the bottleneck, and specifically the seek rate. Rebuilding a RAID
normally involves sequential reads and writes, but if you do this while
also accessing the file system the heads constantly have to move back
and forth between the area being rebuilt and where the file(s) being
accessed are located.

It's too late for that now, but a better way to build an array is to
assemble it, assuming it's clean (i.e. without a rebuild) and then
create the filesystem on top of it. The array is brought into sync when
each of its blocks is first written, and areas of the array that haven't
yet been written contain no useful data so it's unimportant that it's
not in sync.

You can slow rebuilding the array down to a crawl by running something
like (as root):

	echo 5000 > /proc/sys/dev/raid/speed_limit_max

This will limit the resync speed to 5MB/s and should give you an
opportunity to assess whether the RAID resync is indeed affecting
recordings. Set it back to a large number in order to resume at full tilt.

Another approach is to reduce the frequency with which the kernel writes
your recordings to disk. In other words, to allow it to buffer writes
for a much longer time. How to do that depends on too many things to go
into here.

Another thing to check though is whether the power supply in your box
has enough oomph to power all your disks working hard at the same time.
If not you should see signs of trouble in dmesg (i.e. read or write errors).

> Does it seem plausible to anyone that building the raid could be the
> cause for the video artifacts? The machine is a 4-core i5 with 8 GB RAM.

That's ample.

> Note that the faulty recordings were made to an independent HDD, not to
> the raid that was being built.

How many parallel recordings to this single disk, what is its type
(rotation speed, seek speed) and by which kind of interface is it
connected to the host? How is this disk powered? Things for you to consider.

HTH, Jan



More information about the mythtv-users mailing list