24 Jun

MythTV – Storage Groups and Linux Hard Drives

Last night completed the second to the last step of my Mythbuntu adventure:  Adding in the second hard drive.

Well, this would all be easier if I wasn’t trying to do it so low rent.  Right now in the Myth box there is only 512MB of RAM and two 40GB Western Digital Hard drives.  After everything is setup that only gives me about 65-ish GB for video recording.  Not alot, but not great either–right around 40 hours of recording space.

So, I should get a larger hard drive…

Well, when I do, I’ll have to repeat this same process.  Obviously, first one has to install the hardware and make sure that the BIOS can see it.  If you don’t have this, you don’t have anything.  Now to the Linux part:

  1. Partition – Setup the drive to hold data.  The main drive is probably /dev/sda, making the OS install to be on /dev/sda1 and the swap partition to be on /dev/sda5 (at least on my box).  The second hard drive will probably be /dev/sdb, and so a third physical hard disk will be /dev/sdc, and etc.  I created one big partition on the new drive.
    1. sudo fdisk /dev/sdb
    2. n (new partition)
    3. p (primary partition)
    4. 1 (first primary partition)
    5. <enter> (default first cylinder)
    6. <enter> (default last cylinder)
    7. w (write the new partition table to disk)
  2. Format – Prepare the new partition for data.  Nothing big here, but one small caveat.  Since this is not a the boot drive, theres no need for reserve space.  Usually a format reserves 5% space incase the drive fills up–this helps keep from crashing on full drives.  I set the second drive to 1% reserve.
    1. sudo mkfs -t ext3 /dev/sdb1
    2. sudo tune2fs -m 1 /dev/sdb1
  3. Mounting – Add the new space to the filesystem.  Linux sees everything like one big directory tree–there are no C: and D: drives.  So, to mount this new drive I created a directory called /video on the root and some subdirectories called /video/livetv and /video/media.  And while I was doing it, I made a backup spot for my Myth database.  After the directories are made, I changed the file rights so they could be used by Myth.
    1. sudo mkdir /video
    2. sudo mkdir /video/livetv
    3. sudo mkdir /video/media
    4. sudo mkdir /var/dbbackup
    5. chmod a+wrx /video/livetv
    6. chmod a+wrx /video/media
    7. chmod a+wrx /var/dbbackup
  4. FSTAB – Edit the /etc/fstab so that the drive is mounted on bootup.  I don’t know if you like Vi, but I hate it.  So, I installed GEdit to make my life easier.
    1. sudo apt-get install gedit
    2. gksudo gedit /etc/fstab
    3. <add a line>/dev/sdb1   /video/media  ext3    defaults     0     0
    4. Save and Reboot (or sudo mount -a)
  5. Test – Make sure that the new drive is seen (sudo mount -l)
  6. MythTV Storage Groups.  I wanted to help utilize my space as well as possible.  Inside the MythTV Backend Setup, I set:
    1. LiveTV to /video/livetv/
    2. Default to /video/media/
    3. DBBackup to /var/dbbackup/

My theory is that the Live TV buffering will all happen on the drive with the least amount of space, as well as the dbbackups.  And (hopefully) all of the actual recordings will go to the second hard drive.  We’ll see how it works out.

It has been running Live TV on The Weather Channel for the last sixteen hours and the capture files are all going to the right spot.  One problem is that my demo subscription to Schedules Direct has ran out–I’ll have to pay the twenty dollars before I can go on to the last step–changing channels on the cable box.


Bryan said he doesn’t remember if he ever got this working a few years ago.  It is probably easier to do, now, with the new releases.  After I accomplish this last step, I will post a quick recap and include some other extremely cool stuff I found that works with MythTV.  Until then.

See you, Space Cowboy.

4 thoughts on “MythTV – Storage Groups and Linux Hard Drives

  1. Thanks for the guide, it helped a linux newbie like me add two new storage drives to his mythtv box…. nice name tanstaafl must be a econ major 😛

Comments are closed.