Difference between revisions of "User:Mgpalmer"

From MythTV Official Wiki
Jump to: navigation, search
m (Main Frontend/Backend)
m (NFS)
Line 41: Line 41:
 
===NFS===
 
===NFS===
 
My MythDora system mounts the following from NFS:
 
My MythDora system mounts the following from NFS:
/storage/dorabackup/
 
 
  /storage/music/
 
  /storage/music/
 
  /storage/pictures/
 
  /storage/pictures/
 
  /storage/posters/
 
  /storage/posters/
 
  /storage/videos/
 
  /storage/videos/
Local storage on my MythDora system is limited to only the program recordings and temp directories. In future I plan to move the recordings also to remote storage. Required to do this is to upgrade to a 1 GigE switch and a dedicated NAS box (probably based on FreeNAS).
+
Local storage on my MythDora system is limited to only the program recordings and temp directories.
 +
 
 
===MySQL===
 
===MySQL===
 
My MySQL database is running on a remote server now. Details below.
 
My MySQL database is running on a remote server now. Details below.

Revision as of 17:27, 7 October 2008

My mythtv software system is MythDora 5.0.

My MythTV Systems

I've had a working MythTV system since about June 2006. My first working MythTV system was based on MythDora 2.32.

I currently have three systems now involved in my mythtv setup. The primary system is a combined backend/frontend running MythDora 4.0. In addition to this one I have a remote frontend only built from Jarod Wilson's guide, and a general support system serving (for mythtv) NFS and MySQL (on which mythconverg is running).

As well, I've set up a MythDora system for our daughter's household, and another for a friend.

Main Frontend/Backend

As of May 2007 my primary system is a combined backend/frontend running on:

  • Biostar NVIDIA GeForce 6100-M9
  • AMD64 x2 4200
  • 2 GB PC3200 DDR (4x 512MB modules in dual channel mode)

I've reduced the storage to a single drive:

  • 500 GB Seagate SATA/300 HD - I'm running LVM and xfs on my /storage partition preallocating 512 MB for files with good success so far.

For capturing content I have two tuners:

  • Hauppauge PVR500 dual analog tuner card
  • AverMedia A180 dvb - viewing ATSC on DirecPath (DirecTV reseller for multi dwelling units)

The A180 captures the few digital channels present on my cable (see below). The PVR500 works out great since I have quite limited space for PCI cards. The user interface includes:

  • MCE USB remote (bundled with PVR500)
  • Logitech Cordless Desktop EX110 (mouse & keyboard)
  • ViewSonic N3751w 37" LCD display
  • Yamaha HTR-5835 DTS 5.1

Remote Front End

My wife's computer in our home office is dual boot Windows XP Pro and Fedora 7 Linux. The Fedora 7 system is set up primarily for mythtv use, and was set up using Jarod Wilson's excellent instructions. Only minor deviations from his instructions were necessary.

The hardware includes

  • Biostar NVIDIA GeForce 6100-M9
  • AMD64 3800
  • 1 GB PC3200 DDR (2x 512MB modules in dual channel mode)

(Yes, the same as my primary backend, so it also serves as backup hardware.)

General Server

I've resurected an older computer system to use as a general purpose Linux based home server in order to:

  • off load some activity from my MythTV system
  • learn more about some types of distributed systems
  • and, well, because I can.

Services specific to mythtv listed here.

NFS

My MythDora system mounts the following from NFS:

/storage/music/
/storage/pictures/
/storage/posters/
/storage/videos/

Local storage on my MythDora system is limited to only the program recordings and temp directories.

MySQL

My MySQL database is running on a remote server now. Details below.

My Digital Content

Channels

The digital channels I'm able to receive currently include:

  • 2-1 WSB-DT
  • 5-1 WAGA-HD Fox
  • 11-1 WXIA-DT
  • 46-1 WGCL-HD

Quality

These channels come on my DirecPath wire as ATSC encodings.

5-1 which is the HD content from Fox 5 Atlanta stutters badly. There are significant audio and video drop outs every few seconds that make the programming nearly unwatchable. This is true also for 5-2 which is the ATSC SD channel for Fox 5. These drop outs are visible also when watching these channels with the TV's built in tuner. These drop outs do not appear on any other channel. Nothing I've done so far improves the situation.

Otherwise the video recordings from digital content are a dramatic improvement over the analog content.

To Do

Things I'd like to do next:

  • Separate the main system using a mini hardware setup for FE
  • RAID-5 NAS for more robust storage
  • Dedicated FE for office, to include display panel & remote
  • Gigabit LAN equipment
  • Net boot my frontends

Moving my mythconverg to a remote MySQL server

Just for grins and skills I decided to set up a remote Linux server on which to run MySQL. Here are the things I did to get this working. This is Fedora centric, as MythDora is built on Fedora.

One advantage to having the database on a remote system is that it does not page out to disk when mythtv hogs all the RAM.

Setup MySQL

First, set up the database server machine. Install MySQL. It looks like mythtv-0.21 will be dropping MySQL v3 and v4 support. Ensure you use v5 of MySQL.

After installing, set mysqld to run at boot time, and turn it on now:

# chkconfig mysqld on
# service mysqld start

Then change the root password for MySQL:

# mysql -u root mysql
mysql> update user set Password=PASSWORD('ROOT_PWD') where user='root';
mysql> flush privileges;
mysql> quit

Get a copy of mc.sql from your mythtv machine. I found mine at

/usr/share/doc/mythtv-docs-0.20.2/database/mc.sql

Then put it in the database with

$ mysql -u root -p < /your/path/to/mc.sql

(This will prompt you for the mysql-root password.)

Add a mythtv user to your mysql install. http://dev.mysql.com/doc/refman/5.0/en/adding-users.html

Move any other config stuff you might have. I'm using Jarod's recommended my.cnf additions. From his site:

Under the [mysqld] section add:

key_buffer = 16M
table_cache = 128
sort_buffer_size = 2M
myisam_sort_buffer_size = 8M
query_cache_size = 16M

Additionally, I added a mythtv user to my Linux server system and edited the uid/gid values to be the same as on the MythDora system (1000/1000). This makes for more readable file owner/groups on both systems, especially as the same server holds my NFS partitions.

Prepare a database dump

The following occurs on the mythtv backend system that is currently running the database. At this point I shut down my mythtv system so that the database would not be changed during the following steps. I also ran the database optimizer.

# killall mythfrontend
# service mythbackend stop
# /usr/local/bin/optimize_mythdb.pl

I then dumped the database and turned off the mysqld server on this system.

$ mysqldump -u myth_user -p --extended-insert --databases mythconverg > mythdb.sql
# service mysqld stop
# chkconfig mysqld off

Load mythconverg on new server

After transfering this backup file to the new MySQL server machine, I was ready to import it to the new MySQL server.

$ mysql -u root -p mythconverg < mythdb.sql
(this will prompt for the mysql root user's password)

And allow mythtv to have remote access to this database with

$ mysql -u root -p mythconverg
(prompts for password)
mysql> grant all on mythconverg.* to mythtv@"%" identified by "mythtv";
mysql> flush privileges;
mysql> quit;

Configure mythbackend to use remote database

We're finally ready to bring it all together. Back on the mythtv backend system you need to configure access for the remote MySQL database server and restart mythbackend.

Access to the MySQL server on my MythDora system was configured in the mysql.txt file, found on my system in several places: /.mythtv/mysql.txt, /root/.mythtv/mysql.txt, and ~mythtv/.mythtv/mysql.txt. The change to make is

DBHostName=<mysql_server_name_or_IP>

I made this change to all 3 copies of mysql.txt found on my system.

Now I restarted the backend and frontend and verified all was well.

# service mythbackend start
$ mythfrontend
(watch some recordings, etc.)

Convert filing system from ext3 to xfs

MythDora automatically creates an LVM partition for the major storage of mythtv mounted as /storage, and formats it as ext3. xfs is a better performing filing system for large files. Here's how I converted my /storage to xfs.


Important.png Note: Must be root for the following

Converting MythDora /storage to xfs:

* be root
* make sure to have xfs-tools installed (if needed: # yum install xfsprogs)
* shut down access to /storage (myth[front|back]end, maybe mysql, etc., or init 1)
* unmount any NFS mounts
* cp -a /storage (to a safe place on another volume)
* mkfs.xfs /storage
* cp -a (saved /storage to) /storage
* edit /etc/fstab to account for the new fs type
* restart stuff (myth[front|back]end, etc., or init 5)

I used a feature of xfs to preallocate disk space in 512 MB increments. This reduces the total number of extents that a file will consume, especially with multiple files growing (more than 1 program recording simultaneously). This was accomplished with this line in my fstab:

/dev/sdb1    /storage    xfs    defaults, allocsize=512m 0 0

Files created after this change will contain far fewer extents than previously. Verify with

$ cd /storage/recordings
$ filefrag <file_name>

Add Another Disk to /storage LVM

At install time MythDora creates recording space for MythTV in a separate partition configured as LVM and mounted on /storage. Once disk space started filling up and I began losing shows before they were watched, I found this to be quite useful. Here's how I added a new disk to my system's /storage. I've done this both for an ext3 formatted /storage (default configuration) and an xfs formatted /storage.

I first made sure to watch up as much TV as possible and delete everything I could to minimize the time required to backup and restore data. These instructions assume you've already installed the disk into the computer chassis and performed any data backup you will be doing.

Warning.png Warning: If your mythtv data (or pictures, music, etc.) in /storage is important to you, then make sure to perform a backup beforehand.

You may need to unmount /storage. This will require stopping mythfrontend and mythbackend, as well as any other processes that might be using this partition.

# killall mythfrontend
# /sbin/service mythbackend stop 
# umount /storage

If you have trouble with this, then try single user mode:

# init 1

Get volume group name with mount and lvdisplay, which look something like this:

# mount
...
/dev/mapper/VolGroup00-LogVol01 on /storage type xfs (rw,allocsize=512m)
...
# lvdisplay /dev/VolGroup00/LogVol01
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                rEftR4-7mDC-6Vng-IyHO-a1eM-w15F-FlN1bA
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                453.72 GB
  Current LE             14519
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1

On MythDora 3.2 I found the volume group name to be videovg instead.

Use pvcreate to initialize the device for use with LVM. You will need your device name; on my system it was /dev/sdb.

# pvcreate /dev/sdb

Use vgextend to add this device to the volume group.

# vgextend VolGroup00 /dev/sdb

Then use lvextend to make the new space available. You'll need to know how much space you have to add.

# pvs /dev/sdb
# lvextend -L +465.75G /dev/VolGroup00/LogVol01

Now for formatting. With xfs formatting you only need:

# xfs_growfs /storage

While for ext2/3 you'll need a more involved procedure.

single user mode: init 1 (since otherwise the volume group is busy)
unmount the volume group: umount /dev/videovg/videolv01
force checking disc: e2fsck -f /dev/videovg/videolv01
resize the volume group: resize2fs /dev/videovg/videolv01
remount: mount /dev/videovg/videolv01
check: df -h
return to multiuser mode: init 5
OR reboot: init 6