summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/local-website/htdocs/mythtv-doc/mythtv-HOWTO-24.html
blob: 32a0eb574fe27bba8818cdf2ab8b7d703100586f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
 <TITLE>Installing and using MythTV: Example Configurations.</TITLE>
 <LINK HREF="mythtv-HOWTO-23.html" REL=previous>
 <LINK HREF="mythtv-HOWTO.html#toc24" REL=contents>
</HEAD>
<BODY>
Next
<A HREF="mythtv-HOWTO-23.html">Previous</A>
<A HREF="mythtv-HOWTO.html#toc24">Contents</A>
<HR>
<H2><A NAME="s24">24.</A> <A HREF="mythtv-HOWTO.html#toc24">Example Configurations.</A></H2>

<H2><A NAME="LVM"></A> <A NAME="ss24.1">24.1</A> <A HREF="mythtv-HOWTO.html#toc24.1">Logical Volume Manager (LVM) </A>
</H2>

<P>LVM greatly increases the flexibility you have in managing your storage
than traditional physical partitions. This section will provide some brief
notes on how to use LVM to create storage space for your video files and how
to add additional disk space in the future. There's lots more that can be
done with LVM, so check the LVM HOWTO 
<A HREF="http://tldp.org/HOWTO/LVM-HOWTO/">http://tldp.org/HOWTO/LVM-HOWTO/</A> document for details.</P>

<P>
<FIGURE>
<EPS FILE="stop.eps">
<IMG SRC="stop.png">
<CAPTION><B>NOTE</B>:  If you are running MythTV 0.21 and you are using LVM to
create one large filesystem to store your recordings, it's no longer
recommended that you go the LVM route. The preferred solution is to use 
<A HREF="mythtv-HOWTO-9.html#storagegroups">Storage Groups</A>.  They're more flexible and less
likely to lose all of your recordings if you have a drive failure.</CAPTION>
</FIGURE>
</P>
<P>If you don't understand how to partition a drive, or how to change the
partition type you should stop and look at documentation on how to perform
these steps.</P>
<P>
<FIGURE>
<EPS FILE="stop.eps">
<IMG SRC="stop.png">
<CAPTION><B>BIG FAT WARNING</B>:  Using an incorrect parameter can make your files
inaccessible, prevent your computer from booting, etc.  Be careful!</CAPTION>
</FIGURE>
</P>
<P>Make sure your kernel configuration includes LVM support or that it's
available as a module. Today, most vendors include this by default. You'll
also want to ensure that you have a copy of the LVM utilities; check your
distribution, or get the latest versions from 
<A HREF="http://www.sistina.com/products_lvm.htm">http://www.sistina.com/products_lvm.htm</A> and build them manually.</P>
<P>Check that the <B>vgscan</B> program is being run at some point during
your boot sequence - most distributions do this by default. Look for a
message during boot up that looks like this: <CODE>vgscan -- reading all
physical volumes (this may take a while...)</CODE> If you don't see any
messages during boot, you may need to install a LVM init script or confirm
that you have all of the LVM packages installed from your distribution.</P>
<P>LVM uses a few concepts you should be familiar with before starting.
<UL>
<LI>PV (Physical Volume).  The actual partition on the hard drive.</LI>
<LI>VG (Volume Group).  The aggregation of all the PVs make a VG.</LI>
<LI>LV (Logical Volume).  Subdivision of the pool of space available in
the VG into individual chunks, like /usr, /var/video, etc.</LI>
</UL>
</P>
<P>The following example assumes that you want to create a LVM partition from a
chunk of space in /dev/hda5, using a reiserfs filesystem and mounted on
/var/video. You later decide to extend this filesystem by adding a new disk:
/dev/hdb.</P>
<P>You need to create at least one LVM partition for a physical volume. Use
<B>fdisk</B> or your favorite partition editor to set the type to LVM
(0x8e). If you're using an entire disk, create one big partition rather than
using the device itself. e.g. use /dev/hdb1 not /dev/hdb.  </P>
<P>In the following example, you have a 15GB disk.  The first 6GB are set as
your boot partition.  <CODE>/dev/hda2</CODE> was added as an extended partition,
and within that partition you created the <CODE>/dev/hda5</CODE> linux (ext2)
partition.</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
# fdisk /dev/hda

The number of cylinders for this disk is set to 1823.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/hda: 15.0 GB, 15000330240 bytes
255 heads, 63 sectors/track, 1823 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       764   6136798+  83  Linux
/dev/hda2           765      1823   8506417+   5  Extended
/dev/hda5           765      1823   8506417   83  Linux

Command (m for help): t
Partition number (1-6): 5
Hex code (type L to list codes): 8e

Command (m for help): p

Disk /dev/hda: 15.0 GB, 15000330240 bytes
255 heads, 63 sectors/track, 1823 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       764   6136798+  83  Linux
/dev/hda2           765      1823   8506417+   5  Extended
/dev/hda5           765      1823   8506417   8e  Linux LVM

Command (m for help): w

#
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Create the LVM physical volume from the partitions (repeat if you have
multiple partitions to use):
<BLOCKQUOTE><CODE>
<PRE>
# pvcreate /dev/hda5
</PRE>
</CODE></BLOCKQUOTE>

Create a LVM volume group out of this physical volume called "VGforMyth" that is
allocated in chunks that are a multiple of 64MB
<BLOCKQUOTE><CODE>
<PRE>
# vgcreate VGforMyth -s 64m /dev/hda5
</PRE>
</CODE></BLOCKQUOTE>

Create a logical volume of 5GB called "video" and then create the reiserfs
filesystem and mount it:
<BLOCKQUOTE><CODE>
<PRE>
# lvcreate --name video --size 5G VGforMyth
# mkreiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video
</PRE>
</CODE></BLOCKQUOTE>

Now create a 3GB volume for mythmusic files if you like:
<BLOCKQUOTE><CODE>
<PRE>
# lvcreate --name music --size 3G VGforMyth
# mkreiserfs /dev/VGforMyth/music
# mount /dev/VGforMyth/music /var/music
</PRE>
</CODE></BLOCKQUOTE>

Display the volume group status:
<CODE># vgdisplay -v</CODE></P>
<P>Now, lets suppose you want to add a 60GB hard disk to the system as hdb and
allocate 50GB of it to video storage.</P>
<P>First, create a single partition /dev/hdb1 covering the whole disk and make
it type 0x8e using your partition editor.</P>
<P><CODE># fdisk /dev/hdb</CODE>
.... create partition, set type, save and reboot if it says you have to</P>
<P>Create the new LVM physical volume:</P>
<P><CODE># pvcreate /dev/hdb1</CODE></P>
<P>Add the new physical volume to the volume group:</P>
<P><CODE># vgextend VGforMyth /dev/hdb1</CODE></P>
<P>
<FIGURE>
<EPS FILE="stop.eps">
<IMG SRC="stop.png">
<CAPTION><B>NOTE</B>:  You may get errors at this point stating that there are no
physical volumes available for adding to the LV, even though you know for a
fact that there are.  You may need to specify the physical volume in the <CODE>/dev/ide/host/bus/target/lun/etc</CODE> format.</CAPTION>
</FIGURE>

Once you've completed one of the following two procedures, use <B>df</B>
to check that you've got more space.</P>
<P>Make the logical volume used for video bigger:</P>
<P><CODE># lvextend --size +50G /dev/VGforMyth/video</CODE></P>
<H3>ReiserFS</H3>

<P>Unmount, resize and remount the filesystem.  Technically, you don't need to
unmount and remount the ReiserFS. 
<BLOCKQUOTE><CODE>
<PRE>
# umount /var/video
# resize_reiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video
</PRE>
</CODE></BLOCKQUOTE>
</P>

<H3>ext2 or ext3</H3>

<P>LVM comes with a program called <B>resize2fs</B>.</P>
<P>Unmount, resize and remount the filesystem.  The filesystem <EM>must</EM> be
unmounted during this procedure.
<BLOCKQUOTE><CODE>
<PRE>
# umount /var/video
# resize2fs --size +50G /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H3>xfs</H3>

<P>XFS does not need to be unmounted to extend the size:
<BLOCKQUOTE><CODE>
<PRE>
# xfs_growfs /var/video
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H2><A NAME="advancedpartitionformatting"></A> <A NAME="ss24.2">24.2</A> <A HREF="mythtv-HOWTO.html#toc24.2">Advanced Partition Formatting </A>
</H2>

<P>The partitions that your distribution sets up for you may not be
optimized for large files. Using LVM in conjunction with the following
techniques can be quite useful.</P>
<P>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.</P>
<P>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.</P>
<P>Fortunately, there are published tests (
<A HREF="http://aurora.zemris.fer.hr/filesystems/big.html">http://aurora.zemris.fer.hr/filesystems/big.html</A>) that provide
insight into filesystem performance under conditions relevant to MythTV
usage.  In addition, some limited testing (archived at 
<A HREF="http://www.gossamer-threads.com/lists/mythtv/users/52672">http://www.gossamer-threads.com/lists/mythtv/users/52672</A>)
with very large files (10 gigabytes) was reported in the MythTV Users
mailing list.</P>

<H3>Ext2</H3>

<P>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.</P>

<H3>Ext3</H3>

<P>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.</P>
<P>There are options available when formatting an Ext3 partition, as in:
<BLOCKQUOTE><CODE>
<PRE>
# mkfs.ext3 -T largefile4 /dev/hdb1
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>This example assumes that <CODE>/dev/hdb1</CODE> has already been created using
<B>fdisk</B>. If you're using LVM, <CODE>/dev/hdb1</CODE> may be something like
<CODE>/dev/VGforMyth/video</CODE>.</P>
<P>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).</P>
<P>You can check on your filesystem using the <B>dumpe2fs</B> program. See
the man page for details.</P>
<H3>ReiserFS</H3>

<P>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.</P>

<H3>JFS</H3>

<P>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.</P>

<H3>XFS</H3>

<P>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 (
<A HREF="http://aurora.zemris.fer.hr/filesystems/big.html">http://aurora.zemris.fer.hr/filesystems/big.html</A>), 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.</P>
<P>
<A NAME="migratingtoSD"></A> </P>
<H2><A NAME="ss24.3">24.3</A> <A HREF="mythtv-HOWTO.html#toc24.3">Migrating from DataDirect Labs to Schedules Direct</A>
</H2>

<P>MythTV v0.20.2 or later is required to natively support Schedules Direct. 
Code has been included to make the transition as simple as possible.</P>
<P><B>You do not need to delete your existing video sources or add new ones!</B>  </P>
<P>The following steps should work for most users:
<UL>
<LI>Create a Schedules Direct account and use the same information as your
existing lineups at Zap2It Labs.  Do not add or delete channels at this
time.</LI>
<LI>Shut down any running <B>mythfrontend</B> and <B>mythbackend</B> programs.</LI>
<LI>Perform a backup of your existing database.  See 
<A HREF="mythtv-HOWTO-23.html#backupdb">Saving or restoring the database</A> for instructions.</LI>
<LI>Run <B>mythtv-setup</B> -> Video Sources.  Change the grabber to
Schedules Direct, update the username and password fields with the account
information you created at Schedules Direct and select "Retrieve Lineups". 
Click Finish.</LI>
<LI>Exit <B>mythtv-setup</B> and run <B>mythfilldatabase</B>.  Check
if there were any errors.</LI>
<LI>Restart your <B>mythbackend</B> and <B>mythfrontend</B> programs.</LI>
</UL>
</P>

<H2><A NAME="ss24.4">24.4</A> <A HREF="mythtv-HOWTO.html#toc24.4">Caching support for Schedules Direct</A>
</H2>

<P>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.</P>
<P>Before beginning, perform a backup of your existing database.  See 
<A HREF="mythtv-HOWTO-23.html#backupdb">Saving or restoring the database</A> for instructions.</P>
<P>In the following scenario, assume that you have the following:
<OL>
<LI>A PVR-150 MPEG-2 encoder card connected directly to a CATV source.</LI>
<LI>A PVR-250 MPEG-2 encoder card connected via S-Video to a CATV Set Top Box.</LI>
</OL>
</P>
<P>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.</P>
<P>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.</P>
<P>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.</P>
<P>In <B>mythtv-setup</B>, 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.</P>
<P>Click "Finish" to return to the Video sources selector and then press the
ESC key to go back to the main screen.</P>
<P>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".</P>
<P>Set the start channel to an appropriate value.</P>
<P><B>NOTE</B>:  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:
<BLOCKQUOTE><CODE>
<PRE>
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
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>or, the "Please add channels to this source" message in the "Starting
channel" field stays on the screen.</P>
<P>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.</P>
<P>If you look at the text-mode console, you'll see this if the channel
retrieval is working:
<BLOCKQUOTE><CODE>
<PRE>
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 &amp; 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).
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>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.</P>
<P>Go back to Schedules Direct and re-enable the channels that you had
previously deselected, then click Save Changes.</P>
<P>Create a new Video Source, here called "SD-All Digital Channels".  Perform
the same "Retrieve Listings" you did before.</P>
<P>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 <EM>this</EM> device.</P>
<P>When <B>mythfilldatabase</B> 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
<B>mythfilldatabase</B> 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.</P>
<P>When you run <B>mythfilldatabase</B> to populate your database, you'll
need to run it like this:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
$ mythfilldatabase --remove-new-channels
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>You will also need to modify how the <B>mythbackend</B> calls
<B>mythfilldatabase</B> when it performs its automatic listings update.</P>
<P>In <B>mythfrontend</B>, select "Setup" -> "General".</P>
<P>Continue press ENTER until you reach the Mythfilldatabase configuration
screen.  In the "mythfilldatabase Arguments" field, type
--remove-new-channels</P>
<P>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.</P>
<HR>
Next
<A HREF="mythtv-HOWTO-23.html">Previous</A>
<A HREF="mythtv-HOWTO.html#toc24">Contents</A>
</BODY>
</HTML>