Monthly Archives: September 2009

Howto: Live migrate to software RAID 1

Feel insecure about your data? Don’t trust your harddrive anymore? Use this howto to migrate your running Ubuntu Linux system to software RAID 1.

Before starting off, I assume you have your running system on /dev/sda and your new harddrive is called /dev/sdb.

Boot up your system and install the mdadm package. We now have to create partitions on sdb that are the same as sda. Because I have identical disks, I just copy the partition table from sda to sdb like so:
sfdisk -d /dev/sda | sfdisk /dev/sdb
After that, I use partprobe to let the Linux kernel know I have changed the partition table.

Next step is to create a degraded RAID array on sdb which we can copy the files to and than add sda to the array. For every partition you have to run:
mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb1

Where you replace sdb1 with the partition you want. Now create filesystems on these new raid devices:
mkfs.ext3 /dev/md0
Again, run this for all your mds.
After copying all the files to your new array, we have to modify a few files.

  • /boot/grub/menu.lst
  • /etc/fstab
  • /etc/initramfs-tools/conf/resume

All these files contain references to UUIDs that are no longer correct. I simply replaced them with /dev/md0 for example. You can try to use UUIDs, but I believe that the (striped) partitions have the same UUIDs as the raid devices (the mds). If you’ve changed everything, run:
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
And don’t forget to update your initrd:
initramfs -u

That’s all! You can now enjoy the safety of RAID 1 without to much hassle. To check the status of your array, look in /proc/mdstat. Also make sure you setup a mail server or ssmtp, because the mdadm tools will try to send you an email if one of your RAID devices is degraded/corrupt.

pinnacle_dvb-t_stick_remote

Pinnacle DVB-T stick remote

Another post about that Pinnacle DVB-T stick? No, this one is about the remote! I wrote that the remote wasn’t completely working yet. Apparently, there is a driver for this remote or the stick that converts the buttons from the remote to “keyboard events”. Meaning I can type the number 0-9 with my remote for example. However, the “change channel” buttons appear to send a keycode that is above 255 and the X11 protocol only reserves one byte for keycodes. This means those keycodes can’t be send to the X11 server and will disappear. There’s a bug about this in the X.org bugzillay: http://bugs.freedesktop.org/show_bug.cgi?id=x11-keycode-limit and their solution: Change the X11 protocol (meaning: start development on the X12 protocol) or remap those keyevents somewhere between the kernel and X.org. I think the last solution is probably the simplest. I only have to figure out how to remap those keys with hal.

pinnacle_dvb-t_stick

Pinnacle DVB-T stick on Ubuntu Jaunty

Yesterday I decided to buy the Pinnacle DVB-T Stick (also known as Pinnacle TV Stick 72e) to watch some free-to-air channels. In the shop I searched on Google for Linux support, to make sure I didn’t have to return the product. The first few hits seemed positive (2 years ago), so I decided to take the plunge.

After arriving at home, I plugged the device in an empty USB port and saw this in my dmesg:


[11906.080060] usb 1-6: new high speed USB device using ehci_hcd and address 5
[11906.214249] usb 1-6: configuration #1 chosen from 1 choice
[11906.245886] dib0700: loaded with support for 8 different device-types
[11906.246212] dvb-usb: found a 'Pinnacle PCTV 72e' in cold state, will try to load a firmware
[11906.246222] usb 1-6: firmware: requesting dvb-usb-dib0700-1.20.fw
[11906.252816] dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
[11906.471526] dib0700: firmware started successfully.
[11906.972059] dvb-usb: found a 'Pinnacle PCTV 72e' in warm state.
[11906.972135] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[11906.972367] DVB: registering new adapter (Pinnacle PCTV 72e)
[11907.186126] DVB: registering adapter 0 frontend 0 (DiBcom 7000PC)...
[11907.369975] DiB0070: successfully identified
[11907.370122] input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00/0000:00:12.2/usb1/1-6/input/input12
[11907.396132] dvb-usb: schedule remote query interval to 50 msecs.
[11907.396140] dvb-usb: Pinnacle PCTV 72e successfully initialized and connected.
[11907.396744] usbcore: registered new interface driver dvb_usb_dib0700

Great! All drivers and firmware load automatically in Ubuntu 9.04 Jaunty.

Next step: actually getting video on my screen. After Googling I found out I first had to scan for channels using dvbscan. However, it gave me the non-informal message “Unable to query frontend status”. Apparently there is also another scanning program called scan. I ran it like this:
scan /usr/share/dvb/dvb-t/nl-All > ~/.mplayer/channels.conf
Now I could start mplayer dvb:// and enjoy watching DVB-T digital television! Note you can switch channels with h (next) and k (previous). Last thing I need to figure out is how to use the remote for this (I can change the volume already).