My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Monday, May 14, 2007

Adding a second hard drive

I needed some room for backups, so I bought a Western Digital SAA 300 250GB drive. Physically installing it was fairly easy, just took me a minute to find the open SATA plugs on the motherboard (about 2 inches below the two used ones for the primary drive and the DVD drive).

What follows are the steps to then get the drive operational.

First, looks like the drive was found on boot:

root@casey:/dev# dmesg | grep sdb
[17179574.992000] SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB)
[17179574.992000] sdb: Write Protect is off
[17179574.992000] sdb: Mode Sense: 00 3a 00 00
[17179574.992000] SCSI device sdb: drive cache: write back
[17179575.000000] SCSI device sdb: 488397168 512-byte hdwr sectors (250059 MB)
[17179575.000000] sdb: Write Protect is off
[17179575.000000] sdb: Mode Sense: 00 3a 00 00
[17179575.000000] SCSI device sdb: drive cache: write back
[17179575.000000] sdb: unknown partition table
[17179575.008000] sd 2:0:0:0: Attached scsi disk sdb
root@casey:/dev# ls -l /dev/sdb
brw-rw---- 1 root disk 8, 16 2007-05-14 20:22 /dev/sdb

Following directions at http://wiki.linuxquestions.org/wiki/Add_a_new_hard_drive, I first ran fdisk to partition the drive (one big partition in this case):

root@casey:/dev# fdisk /dev/sdb

The number of cylinders for this disk is set to 30401.
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): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-30401, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-30401, default 30401):
Using default value 30401

Command (m for help): p

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 30401 244196001 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
Looks like that worked, I now have a partition:
root@casey:/dev# ls -l /dev/sdb*
brw-rw---- 1 root disk 8, 16 2007-05-14 20:29 /dev/sdb
brw-rw---- 1 root disk 8, 17 2007-05-14 20:30 /dev/sdb1
Now to format the drive:
root@casey:/dev# mkfs /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
30539776 inodes, 61049000 blocks
3052450 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=62914560
1864 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Now I made a mount point and mounted the drive:

root@casey:/# mkdir /mnt/backup
root@casey:/# mount /dev/sdb1 /mnt/backup
root@casey:/# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 237517496 215500056 9952264 96% /
varrun 484776 160 484616 1% /var/run
varlock 484776 0 484776 0% /var/lock
procbususb 10240 116 10124 2% /proc/bus/usb
udev 10240 116 10124 2% /dev
devshm 484776 0 484776 0% /dev/shm
lrm 484776 17580 467196 4% /lib/modules/2.6.17-11-generic/volatile
/dev/sdb1 240362656 61464 228091392 1% /mnt/backup
Then added it to /etc/fstab so it gets mounted at boot:
root@casey:/# vi /etc/fstab
grep sdb1 /etc/fstab
/dev/sdb1 /mnt/backup ext2 defaults 0 0
Now I added the names of all the local users I wanted to be able to write to the volume to the backup group (in this case, I'll use the names user1 and user2):
root@casey:/# vi /etc/group
root@casey:/# grep backup /etc/group
backup:x:34:user1,user2
And made the backup directory writable by that group:
root@casey:/# chgrp backup /mnt/backup
root@casey:/# chmod 775 /mnt/backup
Now I added the new volume to the Samba-exported filesystems and restarted the samba deamon:
root@casey:/# cp /etc/samba/smb.conf /tmp/smb.conf
root@casey:/# vi /etc/samba/smb.conf
root@casey:/# diff -c /tmp/smb.conf /etc/samba/smb.conf
*** /tmp/smb.conf 2007-05-14 20:45:49.000000000 -0500
--- /etc/samba/smb.conf 2007-05-14 20:46:44.000000000 -0500
***************
*** 305,307 ****
--- 305,314 ----
browsable = yes
public = yes
writable = yes
+
+ [backup]
+ path = /mnt/backup
+ available = yes
+ browsable = yes
+ public = yes
+ writable = yes
+ valid users = user1 user2
+ guest ok = yes
root@casey:/# /etc/init.d/samba restart
* Stopping Samba daemons...
...done.
* Starting Samba daemons...
...done.
That did it. I could now mount the backup partition on my windows system and write to it.

Sunday, May 6, 2007

Automatic MythTV Front End Start on Boot

So I wanted MythTV to start automatically when the system boots. Here are the steps that causes this to work for me.

Under System / Administration select Login Window. Select Security Tab and click "Enable Automatic Login" and select the username for the account you want to run MythTV from. Click Close.

Then, running as the automatic login user from the first step, under System / Perferences select Sessions. Select the Startup Programs tab. Click Add and enter /usr/bin/mythfrontend. Click Close.

Reboot and you should get logging in automatically and MythTV should fire up.

Friday, May 4, 2007

Ubuntu automatic update

I wanted to set up automatic updating of all of packages, based on the directions at AutoWeeklyUpdateHowTo I did the following:
# apt-get install cron-apt
# vi /etc/cron.daily/auto-update
# cat /etc/cron.daily/auto-update
#!/bin/bash
/usr/sbin/cron-apt
/usr/bin/apt-get dist-upgrade
# chmod 755 /etc/cron.daily/auto-update



[This process has been updated]

A few other MythTV Configuration Settings

To get channel changing working right:
  • Under "Utilities / Setup" / Setup / TV Settings / General (Basic) set "Change channels immediately without select"
  • Under "Utilities / Setup" / Setup / TV Settings / Playback / View Recordings (Recording Groups) unselect "Show 'LiveTV' recordsings when using "All Programs" filter" and make sure "Default group filter to apply" is "All programs"

Tuesday, May 1, 2007

Blootube-wide MythTV Theme

On the avice of a friend, I added the BlooTube-Wide MythTV Theme:

# cd/tmp
# wget http://downloads.mythtvtalk.com/mythtv/themes/blootube-wide.tar.bz2
# wget http://downloads.mythtvtalk.com/mythtv/themes/blootube-osd.tar.bz2
# cd /usr/share/mythtv/themes/
# tar xvjpf /tmp/blootube-wide.tar.bz2 -C /usr/share/mythtv/themes/
# tar xvjpf /tmp/blootube-osd.tar.bz2 -C /usr/share/mythtv/themes

Then enable it under "Utilities/Setup" / Setup / Appearances / Theme by selecting blootube-wide for Theme and then under "Utilities/Setup" / Setup / TV Settings / Playback / On-screen Display by selecting blootube-osd for OSB theme.