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-browsing 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 reputable 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.