Installing and using MythTV: Example Configurations.

Next Previous Contents

## 24. Example Configurations.

## 24.1 Advanced Partition Formatting

The partitions that your distribution sets up for you may not be optimized for large files.

Unlike a typical filesystem, a MythTV video partition is usually a very large filesystem filled with a fairly small number of large files. Filesystem I/O is usually not an issue, even in multi-tuner and/or multi-frontend setups.

There is however, one aspect of filesystem performance that can have a bearing on the performance of MythTV. In Linux, deleting a file will utilize I/O bandwidth until the deletion has been completed. If deleting the file takes long enough, the video capture buffer may overrun, thereby resulting in dropped frames. Some filesystems are faster at deleting files than others and, for multi-gigabyte MythTV video files, these differences can be significant.

Fortunately, there are published tests ( http://aurora.zemris.fer.hr/filesystems/big.html) that provide insight into filesystem performance under conditions relevant to MythTV usage. In addition, some limited testing (archived at http://www.gossamer-threads.com/lists/mythtv/users/52672) with very large files (10 gigabytes) was reported in the MythTV Users mailing list.

### Ext2

Ext2 was the defacto standard Linux filesystem for many years. It is stable, provides good I/O performance and can quickly delete large files. The primary disadvantage of Ext2 is that it is not a journaling filesystem, so a file system consistency check (fsck, which is normally only performed after a system crash) can take many hours on a filesystem the size of a typical MythTV partition.

### Ext3

Ext3 is Ext2 with a journal, so your biggest gain is that in case of a crash and reboot you won't have to wait very long for your partition to be remounted.

There are options available when formatting an Ext3 partition, as in:

> `

>     # mkfs.ext3 -T largefile4 /dev/hdb1

> `

This example assumes that `/dev/hdb1` has already been created using fdisk. If you're using LVM, `/dev/hdb1` may be something like `/dev/VGforMyth/video`.

The "-T largefile4" option creates one inode per 4 megabytes, which can provide a few percent more storage space. However, tests indicate that using the "-T largefile4" option can drastically increase the amount of time required to delete a large file and thus it should only be used with encoder settings that produce small video files (YMMV).

You can check on your filesystem using the dumpe2fs program. See the man page for details.

### ReiserFS

The Reiser filesystem is another journaling filesystem commonly distributed with Linux. It is known to be an extremely efficient filesystem and it especially excels at managing partitions containing a large number of small files. However, tests indicate it is not the fastest at deleting very large files. For that reason, it may not be the best choice when using encoder bitrates that produce very large files.

### JFS

JFS (Journaling File System) is a journaling filesystem originally developed by IBM for AIX which was later released as open source. While not as common as Ext3 or ReiserFS, it is distributed with RedHat 9 (RH9), Fedora Core and Mandriva as well as other distros. According to tests, JFS is the file deletion speed king, deleting virtually any file in under one second, even files as large as 10 gigabytes.

### XFS

XFS is a journaling file system originally developed by SGI for Irix, and later released as open source. While not a part of the default RedHat Linux 9 or Fedora Core installation (although it is a part of Mandriva and Fedora Core 2+), it can be easily installed via ATrpms. XFS provides deletion speeds for large files only slightly slower than JFS. According to the test results shown at ( http://aurora.zemris.fer.hr/filesystems/big.html), XFS provide higher I/O rates than JFS, albeit at a higher CPU loading. This may cause issues if you do not have the spare CPU capacity to handle XFS, potentially leading to dropped frames.

## 24.2 Caching support for Schedules Direct

MythTV 0.20.2 or later supports caching of downloaded information from Schedules Direct, so devices that share a common source do not require multiple downloads.

Before beginning, perform a backup of your existing database. See Saving or restoring the database for instructions.

In the following scenario, assume that you have the following:

1. A PVR-150 MPEG-2 encoder card connected directly to a CATV source.
2. A PVR-250 MPEG-2 encoder card connected via S-Video to a CATV Set Top Box.

What we are going to do is to create a single lineup at Schedules Direct and then create two Video Sources which use the same login information but have different channels associated with them.

On your Schedules Direct account, create a lineup that has all of the channels that you can receive. Because we have a Set Top Box (STB), choose a Digital lineup. Yes, this means that you may have 900 channels in this lineup, but that's OK.

Use the Schedules Direct channel editor and unselect any channels that you can't tune without the STB. This will usually be channels higher than 125, but check your CATV provider lineup if you're not sure. Once you've deselected them (using a click on the first channel you can't receive and then a shift-click on the last channel you can't receive will deselect all the channels in between those two.) click the Save Changes button at the bottom of the screen.

In mythtv-setup, create a Video Source with an appropriate name. "SD-Analog Only" will be used in this example. Click "Retrieve Lineups" and select the digital lineup you just created at Schedules Direct.

Click "Finish" to return to the Video sources selector and then press the ESC key to go back to the main screen.

Now choose Input Connections. Select the PVR-150 which is connected directly to the CATV. Set the Video Source to "SD-Analog Only" and click "Fetch channels from listings source".

Set the start channel to an appropriate value.

NOTE: There is a bug where the "Fetch" command may not work; you can tell that the Fetch did not retrieve any channels in one of two ways: in the text-mode console, you will see a connection to Schedules Direct, but it doesn't appear to retrieve any channel information:

> `

>     2007-08-25 15:03:05.526 New DB DataDirect connection
>     2007-08-25 15:03:05.526 Connected to database 'mythconverg' at host: localhost
>     2007-08-25 15:03:05.536 DataDirect: Your subscription expires on 11/23/2007 01:12:10 PM
>     2007-08-25 15:03:05.707 New DB connection, total: 3
>     2007-08-25 15:03:05.707 Connected to database 'mythconverg' at host: localhost
>     2007-08-25 15:03:05.708 sourceid 2 has lineup type: CableDigital
>     2007-08-25 15:03:06.623 Data fetching complete.
>     2007-08-25 15:03:06.624 DataDirect: Deleting temporary files

> `

or, the "Please add channels to this source" message in the "Starting channel" field stays on the screen.

If either of these happens, save the information on this screen by clicking the "Finish" button. Exit back to the Input connections screen by pressing ESC, then select this Input Connection again. This time the Fetch will work and the "Please add channels to this source" message will disappear.

If you look at the text-mode console, you'll see this if the channel retrieval is working:

> `

>     2007-08-25 15:04:32.437 New DB DataDirect connection
>     2007-08-25 15:04:32.437 Connected to database 'mythconverg' at host: localhost
>     2007-08-25 15:04:32.447 DataDirect: Your subscription expires on 11/23/2007 01:12:10 PM
>     2007-08-25 15:04:32.622 New DB connection, total: 3
>     2007-08-25 15:04:32.622 Connected to database 'mythconverg' at host: localhost
>     2007-08-25 15:04:32.623 sourceid 2 has lineup type: CableDigital
>     2007-08-25 15:04:33.418 DataDirect: Adding channel 41 'AMC' (AMC).
>     2007-08-25 15:04:33.422 DataDirect: Adding channel 32 'A & E Network' (AETV).
>     2007-08-25 15:04:33.425 DataDirect: Adding channel 66 'Black Entertainment Television' (BET).
>     2007-08-25 15:04:33.427 DataDirect: Adding channel 180 'Bravo' (BRAVO).
>     2007-08-25 15:04:33.430 DataDirect: Adding channel 51 'ABC Family' (FAM).
>     2007-08-25 15:04:33.432 DataDirect: Adding channel 146 'Country Music Television' (CMTV).
>     2007-08-25 15:04:33.435 DataDirect: Adding channel 39 'CNBC' (CNBC).
>     2007-08-25 15:04:33.437 DataDirect: Adding channel 36 'Cable News Network' (CNN).
>     2007-08-25 15:04:33.440 DataDirect: Adding channel 35 'CNN Headline News' (CNNH).

> `

Repeat the Input Connection configuration for any other capture devices that are connected directly to the CATV system. You do not need to click Fetch once you've done one successful download of the channel information - the Starting channel should be automatically populated.

Go back to Schedules Direct and re-enable the channels that you had previously deselected, then click Save Changes.

Create a new Video Source, here called "SD-All Digital Channels". Perform the same "Retrieve Listings" you did before.

Go back to the Input Connections screen, select the PVR-250 which is connected to the STB, assign the "SD-All Digital Channels" video source and perform a retrieve channels. This will pull down the complete channel listing, but only for this device.

When mythfilldatabase runs, it will cache the "big" download which is appropriate for the STB, and then copy the information to the channels that can only be accessed without the STB. But by default mythfilldatabase is going to notice that the "Analog only" video source is missing the channels that are in the Digital lineup you created at Schedules Direct, so we need to override the addition of new channels.

When you run mythfilldatabase to populate your database, you'll need to run it like this:

> `

>     $ mythfilldatabase --remove-new-channels

> `

You will also need to modify how the mythbackend calls mythfilldatabase when it performs its automatic listings update.

In mythfrontend, select "Setup" -> "General".

Continue press ENTER until you reach the Mythfilldatabase configuration screen. In the "mythfilldatabase Arguments" field, type --remove-new-channels

then press the TAB key until you reach Finish, then press ENTER to save. You can then press ESC until you return to the main screen.

Next Previous Contents