Linux Software RAID Quick Reference

Create A RAID-1 Array
mdadm --create /dev/md0 --level=1 /dev/sda /dev/sdb

Scan For Disks
mdadm --detail --scan

Add Disks To mdadm.conf
mdadm --detail --scan >> /etc/mdadm/mdadm.conf

Check Status
cat /proc/mdstat

Mark Disk as Failed
mdadm --manage /dev/md0 --remove /dev/sda

Remove Failed Drive
mdadm --manage /dev/md0 --fail /dev/sda

Add Disk To Array
mdadm --manage /dev/md0 --add /dev/sda

T100 slow charging issues, solved.

My 1-month old tablet, the Asus Transformer T100 tablet started draining slowly while it was plugged in.

Today I drained the battery down to around 30%, plugged it in, and continued with web-browing and streaming music.  An hour later I noticed that the battery percentage wasn’t climbing, and it had actually discharged another 5%.  Windows claimed it was “plugged in, charging” and the LED on the power button was lit up like normal, but the battery percentage was still slowing going down.  Once the battery was below 20% I decided to shut it down and let it charge with the system off.

I waited about an hour to power it back up, when I found it only charged 2%.  I also felt the AC adapter, and it didn’t feel warm at all.  I tried another cable, using a different 5V 2A charger that I knew to be good, but nothing changed.  I wiggled both cables around to see if there were any bad connections, but the light never turned off, so I assumed both were fine.

I searched Google a bit and found a few forum posts where people reported similar issues.  A few said that this was fixed in firmware version 220, but I was already running 220.  223 is available on their site, so I flashed it, but it didn’t fix my charging issue.

I was thinking about cutting up a USB cable so I could meter the power used while charging, but I found some software that promised to tell me the battery’s charge rate, BatteryBar.  Lifehacker checked it out in 2009, along with a few other reptable sites, so It’s nothing new.  It looks just like the battery meter that comes on some on Lenovo laptops.  

I decided to give it a try.  The software runs perfectly on Windows 8.1.  I found that both cables I tried earlier were only charging at ~2500mW, which was right around or below the discharge rate.  I then tried a new 5′ long cable that I picked up from Monoprice.  With this cable BatteryBar claims the charge rate is 4500-5000mW on both of the AC adapters I tried, and now it’s actually charging!

5000mW at 5v is only 1A, but I don’t know how the accurate the charge rate is.  Also the PC might be drawing more power since it’s on AC, thus possibly using the full 2 Amps available.  I’ll check the total current draw through a meter another day.

Before I throw away the two ‘bad’ cables, I want to find out what is wrong with them.  When I plug the stock Asus cable in to my phone and to my PC, the device is recognized by Windows, I’m able to copy files over, but it doesn’t even try to charge.  The second cable I tried is apparently a charge-only cable.  It will charge my phone, but my PC doesn’t recognize a device has been plugged in.

TL;DR: T100 charged slow because of bad USB cables. 

Mount partitions in Linux using GUID

If you’ve ever managed a linux machine, you’ve likely manually editied the /etc/fstab file to automatically mount filesystems.  If you manually specify it’s location (/dev/sdb1) you may know that adding other devices can change location, meaning you will need to change your fstab.

If you’ve looked at modern Linux distributions, you may notice that the fstab file does not contain any /dev devices, but instead uses the partition’s GUID.  From what little reading I’ve done, I’ve found this is a feature of ext2 and up filesystems.  A /etc/fstab in a recent version of Ubuntu will show you that you need to run blkid to print the UUID for a device, and then use GUI= as a prefix in place of the device location.  Run blkid as SU (sudo blkid) and you will see something like this: 

tim@cr48:~$ sudo blkid
/dev/sda1: UUID=”818bded8-51fc-4c02-be9e-abb99517c905″ TYPE=”ext4″
/dev/sda5: UUID=”283cf494-e3be-441d-b098-034869407e6e” TYPE=”swap”
/dev/sdb1: LABEL=”cr48_home” UUID=”cab2cac5-fb0d-4afb-9561-66f97c939412″ TYPE=”ext4″
In this case, I want to use the /dev/sdb1 device as my home directory, so in my /etc/fstab file I’ve added the following.
UUID=cab2cac5-fb0d-4afb-9561-66f97c939412 /home         ext4          0 errors=remount-ro      1
Now the partition will automatically be mounted to /home reguardless to it’s device location.  
If you’re using an old Linux install that’s been updated many times, your fstab file may still be using the device instead of it’s UUID.  It’s a good idea to fix this while you can.  It’s not uncommon to reboot with a new disk installed and it changing the address of all of your exising devices.

ProFusion X Digital Media Manager

Yesterday I wandered into an electronics store intending to buy nothing and walked out with an old computer, a “dmx ProFusion X Digital Media Manager”.

From what I can tell this was designed to play music in a store.  On the back it has connectors that convert the standard 3.5mm audio outpus to RCA’s that I’m assuming go to amplifiers. 

When I walked to the register with the PC, the clerk was wondering why the machine was on the floor in the first place.  He told me he couldn’t sell it because the hard drive was still installed and still had music on it.  I asked if he could sell it without the harddrive, he agreed and ripped it out, and I was on my way.

It came running a VIA C3 CPU at 800MHz and with a whopping 128MB of DDR333, but it came in a nice case for a project.  It’s face has 7 buttons and an LCD.  It attempts to display a DMX banner as soon as power is applied. By attempts I mean that about half of the display is dead.

Inside, the front panel has a ‘floppy’ power connector and a 10 pin ribbon which connects to two USB ports on the motherboard.  The usb connection is a FTDI usb to serial interface.  After some trial and error, I’ve discovered that it runs runs at 19.2k baud and the buttons are mapped to send the following codes. 

  1. Style Up
  2. Style Down
  3. Left: 
  4. Up
  5. *
  6. Down
  7. Right

When I send text to the display at the same baudrate it appears to display one LCD, but since the display is so bad it’s hard to see if the correct text is displayed, and I haven’t found what to send the display to set cursor position or clear the display.

I replaced the motherboard with and old socket 757 motherboard with a 1.8ghz AMD CPU, and I plan to make this a music jukebox at some point.  It’s burried deep on my todo list for now and if I come up with anything worth sharing I certainly will.

pfSense

I’ve recently replaced an aging Linksys WRT54G running DD-WRT with a PC running pfSense. 

Around a month ago I added a second NIC to an old mini-ITX 1ghz VIA motherboard I had lying around and dropped it in place of DD-WRT.  The PCI NIC started locking up daily about a week ago.  pfSense automatically restarts the interface after a minute or so, so it wasn’t very urgent.

I recently aquired a P4 machine with dual onboard NICs, so last night I swapped it in place of the VIA machine.  Since my internet connection peaks at around 40mbit,  I won’t be seeing any immediate benefit from the gbit nics.  I’ve been prepared with a DOCSIS 3 Motorolla Surfboard for around a year, so I’ve got my fingers crossed I’ll see Charter jump over the 100mbit barrier.  Besides, It’s nice to see more gigabit link lights lit.

Although CPU utilization was never very high with on VIA, the web configuration pages are much faster on the P4.  Now that I have more wiggle room, I will likely add a spinning hdd (or two) and play around with using it as a caching proxy (both forward and reverse), for VPN access, and possibly as my SIP PBX.

I currently run a few local web services on different machines behind some apache name-based reverse proxy vhost configurations   I’m working on moving these roles to pfSense, so I’m going to try to document my steps post an update when I’m done.

Creating Keyboard Shortcuts for the CR-48’s missing keys on Ubuntu Linux

Running an OS other than Chrome OS on a CR-48 turns it into a perfect portable computer that can do much more than when it was just a browser.  The biggest drawback I’ve found is that the keyboard is customized for the OS it came with:  It’s missing keys, the function keys are labeled only with icons, and there is a Search key where a caps lock key should be.  

Using Ubuntu, you can create shortcuts with “Keyboard Shortcuts” in the System menu under Preferences.  Just click the Add button, give a name and command, apply, click the row for the command you created under the Shortcut column, and key your desired shortcut.

To create keyboard shortcuts that control backlight brightness, you will need to install xbacklight, and for mapping shortcuts to missing keys you need xvkbd and xbindkeys.

sudo apt-get install xbacklight xvkbd xbindkeys

The search key by default is mapped to Super/Mod4, which is usually the Windows key. After running Windows on the CR-48 for a few months I’ve grown familiar to using the search key as the Windows key, so I’ve decided to use it as the modifier key for my shortcuts.  Here’s how I have configured mine.  You can edit these to your liking.

“Brightness Down” maps Mod+F6 to
xbacklight -steps 1 -dec 20

“Brightness Up” maps Mod4+F7 to
xbacklight -steps 1 -inc 20 

“Press Home” maps Mod4+Left to
/usr/bin/xvkbd -xsendevent -text “\[Home]”

“Press End” maps Mod4+Right to
/usr/bin/xvkbd -xsendevent -text “\[End]”

“Press Page Up” maps Mod4+Up to
/usr/bin/xvkbd -xsendevent -text “\[Prior]”

“Press Page Down” maps Mod4+Down to
/usr/bin/xvkbd -xsendevent -text “\[Next]”

“Press F11” maps Mod+F4 to
/usr/bin/xvkbd -xsendevent -text “\[F11]“

For volume control, instead of creating custom commands, I’ve edited the existing audio keys to be my modifier plus the function keys with the correct icon.  (F8 for mute, F9 for volume down, and F10 for Volume up)

You may find that using the mapped keys with extra modifiers do not work.  For example, I have a habbit of using shift home and shift end for selecting from current cursor position to beginning and end of lines, and ctrl shift home/end for selecting from current cursor position to beginning/end of a page.  For any combination modifiers using shortcut keys you will need to create more shortcuts.

“Shift End” maps Shift+Mod4+Right to
/usr/bin/xvkbd -xsendevent -text “\S\[End]”

“Shift Home” maps Shift+Mod4+Left to
/usr/bin/xvkbd -xsendevent -text “\S\[Home]”

“Ctrl Shift End” maps Ctrl+Shift+Mod4+Right to
/usr/bin/xvkbd -xsendevent -text “\C\S\[End]“

“Ctrl Shift Home” maps Ctrl+Shift+Mod4+Left to
/usr/bin/xvkbd -xsendevent -text “\C\S\[Home]“ 

Thats all I have for now.  I’m still trying to find a way to enable bottom left and right clicking on the touchpad without disabling two finger scrolling, which is possible when using Windows.  If you know how to do this or you have anything else to add please comment.

Does the route to Netflix servers pass through Comcast for everyone?

I’m in St. Louis and use Charter for my internet. Just for kicks, I ran “tracert netflix.com” at a Windows command prompt and it seems that from here to Illinois, its all charter hops, but through IL, NY, and VA, the hops are various comcast.net domains.

I do realize that netflix.com likely isnt the domain of the servers actually doing the streaming, but this is still very interesting to me.

1     2 ms     2 ms     4 ms  DD-WRT [192.168.0.1]
2    12 ms    15 ms    13 ms  10.163.128.1
3    22 ms    19 ms    43 ms  96-34-52-84.static.unas.mo.charter.com [96.34.52
.84]
4    11 ms    14 ms    12 ms  bbr01olvemo-tge-0-1-0-2.olve.mo.charter.com [96.
34.2.86]
5    20 ms    19 ms    17 ms  bbr02chcgil-tge-0-1-0-4.chcg.il.charter.com [96.
34.0.65]
6    22 ms    27 ms    22 ms  prr01chcgil-tge-2-1.chcg.il.charter.com [96.34.3
.11]
7    78 ms    81 ms    72 ms  be-10-805-pe01.350ecermak.il.ibone.comcast.net [
75.149.231.205]
8    19 ms    19 ms    21 ms  pos-1-8-0-0-cr01.chicago.il.ibone.comcast.net [6
8.86.87.129]
9    88 ms    76 ms    64 ms  pos-2-12-0-0-cr01.newyork.ny.ibone.comcast.net [
68.86.87.21]
10    52 ms    56 ms    56 ms  pos-0-12-0-0-cr01.ashburn.va.ibone.comcast.net [
68.86.85.29]
11    69 ms    54 ms    52 ms  pos-0-2-0-0-pe01.ashburn.va.ibone.comcast.net [6
8.86.86.70]
12    51 ms    54 ms    58 ms  66.208.228.10
13    54 ms    67 ms    51 ms  xe-1-1-0.jnrt-edge01.iad1.netflix.com [69.53.244
.253]
14   116 ms   106 ms   107 ms  xe-0-0-0-100.jnrt-edge01.sv1.netflix.com [69.53.
230.213]
15   125 ms   109 ms   120 ms  te1-7.csrt-agg01.dc2.prod.netflix.com [69.53.230
.230]
16   103 ms   102 ms   112 ms  www.dc2.netflix.com [208.75.79.17]

97-03 Climate Control Diagnostics

This is a quick reference for how to use the diagnostic mode built into the dual zone digital climate control system which came installed in some 1997 through 2003 Pontiac Grand Prix Models.

Every time I want to look this up I always have trouble remembering the terms I need to search for to retrieve it, so I have stolen mirrored this from This Forum Post.

To enter diagnostics mode:
Press and hold both the Driver and Passenger knobs in simultaneously until the display changes to read "-00". To change position, turn the Driver knob to the desired number and turn the Passenger knob one click to view the data for that position.
Position Description US Observed on mine Canada
-00 Error codes (List of Trouble Codes Below!)
-01 (servo position) 103-107 43-162
-02 (servo position) 128 120-202
-03 (servo position) 150 162-194
-04 CJ2 Fan Speed Low=15, 29, 44, 58, 71, 86, 110=High, CJ2 Unit will adjust to other increments as needed
-05 (servo position) 93 88-191
-06 (servo position) -152 00-252
-07 (servo position) 00 0, 34-255
-08 (servo position) -155 00-255
-09 (servo position) 00 0, 23-255
-10 ? 04 04
-11 CJ2 Vent Mode 1=Def, 2=Bilevel, 3=Auto, 4=Lower, 5=Def+Lower
-12 Engine Coolant Temp -60 degrees 80=104, 95=131, 100=140 Peak@135°F
-13 Actual Vehicle Speed in MPH
-14 (servo position) 00 21=0
-15 ? 39 44
-16 Radiator low fan turn on temp -106 207
-17 Radiator low fan turn off temp 196 199
-18 ? 50 51
-19 (servo position) 162-169 40-172
-20 Affected by cabin temp sensor 89 50-172
-21 (servo position) 00 ?
-22 Sunload Sensor -117 LIGHT=126, 218=DARK
To return to normal operation, press the MODE button next to the Passenger temperature knob.
This is a list of the Trouble Codes displayed by the CJ2 Unit.
A two digit code indicates a current fault while a three digit code indicates a historic fault.
Trouble Code Description
00 No System Fault
01 or 101 Inside Air Temperature Sensor Short
02 or 102 Inside Air Temperature Sensor Open
03 or 103 Ambient Outside Temperature Sensor Short
04 or 104 Ambient Outside Temperature Sensor Open
05 or 105 LH Electric Actuator Open or Short
06 or 106 RH Electric Actuator Open or Short
07 or 107 UART Serial Data Line Fault
08 or 108 Solar Sensor Open
To clear codes from the CJ2 Unit, press the A/C Mode button.

SquareSpace.com First Impressions

Last night I signed up for the 2 week trial of SquareSpace.com after hearing the advertisement on Leo Laporte’s TWiT network.  He’s said he will not advertise products he doesn’t actually approve of, so I figured I’d give it a shot.

It only took a few minutes to get it up and online.  I just picked a template, filled in some basic info, set up my cname from www.peq.me, wrote a quick about and welcome page.  Amazingly, this seems to be going exactly as advertised.

One of the things that drew me into trying this is that there is an iPhone app for updating.  The app seems very nice.  It opened quickly and seems to have a very usable interface- just as polished looking as the web editor does. I tested adding pictures by uploading some screenshots of the app.  

 

 

I’ve got nothing negative to say here.  If you’re looking for an extremely simple way to quickly get a website up and running, this is my new recommendation.  If you see this page still alive more than two weeks from 5.4.2010, then I’ve become a paying member.