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 http://tldp.org/HOWTO/LVM-HOWTO/ document for details.
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.
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 http://www.sistina.com/products_lvm.htm and build them manually.
Check that the vgscan 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: vgscan -- reading all
physical volumes (this may take a while...)
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.
LVM uses a few concepts you should be familiar with before starting.
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.
You need to create at least one LVM partition for a physical volume. Use fdisk 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.
In the following example, you have a 15GB disk. The first 6GB are set as
your boot partition. /dev/hda2
was added as an extended partition,
and within that partition you created the /dev/hda5
linux (ext2)
partition.
# 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
#
Create the LVM physical volume from the partitions (repeat if you have multiple partitions to use):
# pvcreate /dev/hda5
Create a LVM volume group out of this physical volume called "VGforMyth" that is
allocated in chunks that are a multiple of 64MB
# vgcreate VGforMyth -s 64m /dev/hda5
Create a logical volume of 5GB called "video" and then create the reiserfs
filesystem and mount it:
# lvcreate --name video --size 5G VGforMyth
# mkreiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video
Now create a 3GB volume for mythmusic files if you like:
# lvcreate --name music --size 3G VGforMyth
# mkreiserfs /dev/VGforMyth/music
# mount /dev/VGforMyth/music /var/music
Display the volume group status:
# vgdisplay -v
Now, lets suppose you want to add a 60GB hard disk to the system as hdb and allocate 50GB of it to video storage.
First, create a single partition /dev/hdb1 covering the whole disk and make it type 0x8e using your partition editor.
# fdisk /dev/hdb
.... create partition, set type, save and reboot if it says you have to
Create the new LVM physical volume:
# pvcreate /dev/hdb1
Add the new physical volume to the volume group:
# vgextend VGforMyth /dev/hdb1
/dev/ide/host/bus/target/lun/etc
format.
Make the logical volume used for video bigger:
# lvextend --size +50G /dev/VGforMyth/video
Unmount, resize and remount the filesystem. Technically, you don't need to unmount and remount the ReiserFS.
# umount /var/video
# resize_reiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video
LVM comes with a program called e2fsadm.
Unmount, resize and remount the filesystem. The filesystem must be unmounted during this procedure.
# umount /var/video
# e2fsadm --size +50G /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video
XFS does not need to be unmounted to extend the size:
# lvextend --size +50G /dev/VGforMyth/video
# xfs_growfs /var/video
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.
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 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 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.
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 (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 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.
The Air2PC card has the capability to capture over-the-air HDTV signals (8VSB). The Air2PC card is installed as a DVB device and is supported within MythTV.
First, you must compile a version of the Linux kernel to support the new tuner device.
$ su
# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.15.tar.bz2
# tar -xjf linux-2.6.15.tar.bz2
# pushd .
If you already have a 2.6 kernel running, copy the .config
file and
use it as your starting point. If not, then go straight to the make
menuconfig
portion below.
On Debian with a 2.6.10 kernel:
# cp /lib/modules/`uname -r`/build/.config .
# make oldconfig
Read the prompts that come up; for the most part you should be able to
answer "No".
# make menuconfig
For Gentoo:
# emerge genkernel udev hotplug coldplug
# genkernel --menuconfig --udev --save-config all
Go to the Device Drivers->Multimedia->Digital Video Broadcasting Devices
Enable DVB for Linux and select B2C2/Technisat Air/Sky/CableStar 2 PCI.
Exit menuconfig, then compile modules and the kernel. (Gentoo will do this automatically as a part of the genkernel step.
# make modules
# make
# make install modules_install
Make any modifications necessary to your boot configuration files (lilo or grub) as required to boot your new kernel.
Download and compile the dvb applications you'll need to configure the card. At the password prompt, press ENTER.
$ cvs -d :pserver:anonymous@linuxtv.org:/cvs/linuxtv login
$ cvs -d :pserver:anonymous@linuxtv.org:/cvs/linuxtv co dvb-apps dvb-kernel
$ cd dvb-apps
$ make
NOTE: As of 2005-02-16, the compile aborts with an error, however
not before the azap is compiled, so you should be able to continue.
$ su
# cp utils/szap/azap /usr/bin
Download the firmware for the card. Go to http://www.linuxtv.org/download/dvb/firmware/ and download what is appropriate for your hardware.
On Gentoo, execute the following:
# mkdir /lib/firmware
# cp ~/dvb-fe-nxt2002.fw /lib/firmware
# echo skystar2 >> /etc/modules.autoload.d/kernel-2.6
# exit
On Debian:
# cp ~/dvb-fe-nxt2002.fw /usr/lib/hotplug/firmware
# exit
Shutdown your machine, install the card and restart. Ensure that you're using your newly compiled kernel.
Once you've rebooted, confirm that the card is detected. If you type dmesg, you should see something like this:
drivers/media/dvb/b2c2/skystar2.c: FlexCopIIB(rev.195) chip found
drivers/media/dvb/b2c2/skystar2.c: the chip has 38 hardware filters
DVB: registering new adapter (SkyStar2).
DVB: registering frontend 0 (Nextwave nxt2002 VSB/QAM frontend)...
If you are using 8VSB (Over-the-Air HDTV), run the azap program. Replace ZIPCODE with your zip code. The perl script will connect to http://www.antennaweb.org to obtain your HDTV channels.
$ cd /usr/src/dvb-apps/util/szap/channels-conf/atsc
$ test ~/.azap || mkdir ~/.azap
$ perl ./make_atsc_chanconf.pl ZIPCODE >~/.azap/channels.conf
$ /usr/bin/azap wsvn
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 183000000 Hz
video pid 0x0000, audio pid 0x0000
status 00 | signal fff0 | snr ea60 | ber 00000000 | unc 00000000 |
status 1f | signal f840 | snr ce6e | ber 00000068 | unc 00000000 | FE_HAS_LOCK
status 1f | signal f600 | snr d2d8 | ber 00000018 | unc 00000000 | FE_HAS_LOCK
status 1f | signal f290 | snr cd54 | ber 00000008 | unc 00000000 | FE_HAS_LOCK
status 1f | signal f340 | snr c658 | ber 00000030 | unc 00000000 | FE_HAS_LOCK
CTRL-C
$
NOTE: if you have anything in the unc column ("uncorrectable
errors") you will probably have problems with HDTV. Check your antenna,
cables, etc.
Once you have confirmed that your card is able to lock onto a HDTV signal it is time to configure MythTV. Start the mythtv-setup program, and in the Capture Cards section change the card type to "Digital Video Broadcast".
For HDTV you do not need to use the Advanced configuration.
(This information is a work in progress - 2005-07-15.)
In the following examples, we are going to create an environment which can be used to boot a diskless workstation using PXE.
There are two machines in this scenario: the backend, a Debian Sarge system which has the disks and which will run the necessary support software, and the "basement" machine, an Intel D865PERL motherboard with 512MB of DRAM, a NVidia 440MX video card, a Microsoft MCE USB remote and a HD44780 16x2 Vacuum Fluorescent Display.
The backend machine needs to provide the support software for the services needed to boot a diskless workstation.
$ su
# apt-get install dhcpd3-server atftpd syslinux
Much of the information in this section comes from http://archive.ubuntulinux.org/ubuntu/dists/warty/main/installer-i386/current/doc/manual/en/apcs03.html
Download debootstrap so that your system knows how to locate the files required to build an image. Find the latest version of the debootstrap program and download it. At this time, the latest is debootstrap_0.3.3.0ubuntu1_all.deb
$ lynx http://archive.ubuntulinux.org/ubuntu/pool/main/d/debootstrap/
Cursor down to the latest file, then press "D".
Install it:
$ mkdir temp1
$ mv debootstrap_0.3.3.0ubuntu1_all.deb temp1
$ cd temp1
$ ar -xf debootstrap_0.3.3.0ubuntu1_all.deb
$ su
# tar -xzf data.tar.gz
# mkdir -p /nfsroot/basement
# debootstrap --arch i386 breezy /nfsroot/basement/ http://archive.ubuntulinux.org/ubuntu
Once that's done, we'll need to chroot into the newly created directory structure for some initial setup.
$ su
# chroot /nfsroot/basement
Set the hostname that you'd like this machine to display at login and at the shell:
# echo "basement" > /etc/hostname
Add the IP address of this host to /etc/hosts
# echo "127.0.0.1 localhost" >> /etc/hosts
# echo "192.168.10.51 basement" >> /etc/hosts
Put something into the /etc/fstab
file. The ^D
indicates
that you should press CTRL-D.
# cat >> /etc/fstab
proc /proc proc defaults 0 0
sys /sys sysfs defaults 0 0
^D
Configure your keyboard:
# dpkg-reconfigure console-data
Setup resolv.conf
. These values need to be appropriate for your configuration.
# cat >> /etc/resolv.conf
search .local
nameserver 68.87.66.196
nameserver 68.87.64.196
nameserver 63.240.76.4
^D
Create the initial configuration:
/usr/sbin/base-config new
Create a xorg.conf
file:
# xorgconfig
Edit your /etc/apt/sources.list
and look at the bottom of the file.
It should end up looking like this:
deb http://us.archive.ubuntu.com/ubuntu/ hoary main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ hoary main restricted
## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://us.archive.ubuntu.com/ubuntu/ hoary universe
deb-src http://us.archive.ubuntu.com/ubuntu/ hoary universe
deb http://security.ubuntu.com/ubuntu hoary-security main restricted
deb-src http://security.ubuntu.com/ubuntu hoary-security main restricted
deb http://security.ubuntu.com/ubuntu hoary-security universe
deb-src http://security.ubuntu.com/ubuntu hoary-security universe
deb http://archive.ubuntu.com/ubuntu hoary multiverse
deb-src http://archive.ubuntu.com/ubuntu hoary multiverse
Finally, exit out of the chroot:
# exit
sudo apt-get install subversion distcc bind9 bind9-doc
edit /etc/default/distcc to start it and allow other hosts
edit /etc/default/dhcp3-server. add interface
option domain-name "local";
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.10.50, 68.87.66.196, 68.87.64.196, 63.240.76.4
# Turn on Dynamic DNS:
ddns-update-style interim;
ddns-updates on;
# Don't allow clients to update DNS, make the server do it
# based on the hostname passed by the DHCP client:
deny client-updates;
allow unknown-clients;
allow bootp;
allow booting;
#option ip-forwarding false; # No IP forwarding
#option mask-supplier false; # Don't respond to ICMP Mask req
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.1;
# range 192.168.10.100 192.168.10.250;
}
group {
next-server 192.168.10.50; # IP address of your TFTP server
default-lease-time 864000;
max-lease-time 864000;
host basement {
hardware ethernet 00:13:20:11:a3:ea;
fixed-address 192.168.10.51;
filename "/tftpboot/pxelinux.0";
option root-path "/nfsroot/basement/";
option host-name "basement" ;
}
}
sudo apt-get build-dep mythtv
sudo apt-get install libqt3c102-mysql
svn co http://svn.mythtv.org/svn/trunk/mythtv svn co http://svn.mythtv.org/svn/trunk/mythplugins svn co http://svn.mythtv.org/svn/trunk/myththemes
First time in, it will create .mythtv/mysql.txt, but it's pointing at the wrong server (ie, there is none on the frontend).
Exit out at this point (should be the language selection screen), and edit .mythtv/mysql.txt
Then restart
Disable xscreensaver: System->Preferences->ScreenSaver. Mode: Disable Screen Saver Advanced: Power Management Enabled: uncheck
System->Preferences->Sound uncheck Enable sound server startup