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.

Rest In Peace CR-48 / My first Thinkpad

Have you ever been afraid to open a package?

On the first day of Feburary, 2011, St. Louis had a major ice storm.

On this day, the ice was so bad that I couldn’t get my work truck out of my driveway, which was impressive because it slightly slants down toward the road.  Before I had a chance to call into work to let them know, my boss called me and said it’s not worth trying to drive, and to stay home try to do a bit of work remotely and answer phone calls.

I noticed around noon that there was a package left on the doorstep.  I didn’t order anything at all, but it was addressed to me with no return address.

After a few minutes of head scratching I cautiously opened the package.  It was a laptop!  From Google!  For free!

Google was taking applications for the Pilot program earlier in the year, maybe even late 2010.  Before applying, I made sure that I had signed into my Chrome browser and installed some “Apps” and synced my bookmarks.  I also may have hinted that I was also interested in developing my own extensions for Chrome.

How, why, its not clear, but Google gave me a gift.  A 1.6ghz Intel Atom PC, 16GB SSD.  It wasn’t fast, but it was FREE.  I used ChromeOS for a few weeks, but quickly realized that I wanted more than just a web browser out of a laptop.  Apparently someone received a CR48 with a standard BIOS, and it was then dumped and shared.

I ran Windows on it for a while, but eventually settled on Ubuntu.  It was great for a light browsing machine, and I used on and off for over a year.  After the year of abuse, the hinges were completely shot.

A few weeks ago I got a wild hair to try to repair it.  I drilled some holes in the back of the plastic and put screws through it, and it was then stronger than ever.  I installed a new version of Ubuntu with XFCE and realized how nice the machine still was.

This seemed the rebirth of my free laptop.  Next I had the urge to upgrade the little 16GB SSD.  I ended up buying a 120gb MSATA disk.  When I disassembled the machine to install the SSD, I noticed I lost one of the nuts that I used to repair the hinge and decided to beef up the hinge even more.  I took a trip to the hardware store and picked up some bigger hardware, and some new drill bits.

When I got home, while enlarging a hold, my brand new drill bit binded up and what was left scraped across the motherboard near the RAM slot.  It looks like a few leads were severed and now it won’t boot anymore.  The SSD I ordered was useless because I didn’t have any other machine that supported MSATA SSDs.

What did I do?

I ordered a used Lenovo Thinkpad X220 from eBay, and a Bluetooth adapter, ExpressCard 54 USB 3.0 card, and an upgraded Intel 802.11n card from Amazon  The Lenovo supports the MSATA SSD, as well as a standard 2.5″ drive.  So I’ve now got 120GB of solid state storage for my OS and software, and a 320GB 2.5″ HDD for storage.  It would be roughly the same size and weight as the CR48 if I didn’t have the 9 cell battery sticking out the back.  It’s got a matte screen too, which is something I grew to love on the CR48.

I’ve never been happier with a laptop keyboard than I am with the X220.  It feels great to type on, has dedicated volume and mute keys, and with all the function keys.  This was a huge step up from the limited key count of the CR-48.

The only grip I momentarily had (and apparently I’m not alone) is that the very bottom left key is the function key, instead of ctrl like almost any other keyboard.  I found its just an option in the BIOS to swap the two keys, so I immediately change it.  The two keys are not the same size on this model, so I can’t physically swap them like you can on some Lenovos.

The trackpad at first sight was hideously small.  I was shocked that the buttons were above the trackpad instead of below.  What I didn’t realize is that the trackpad is one that physically clicks just like the CR48 and Macs do.  It’s a lot smaller than the one on the CR48 though, but that’s a trade-off for having a bigger keyboard in a compact machine.  It has one of the nub/eraser head/nipple pointer sticks too, but I can’t use it as efficiently as the touchpad.

I’m not trying to do a full review of an almost 2 year old laptop.  This is just some of my impressions coming from a cheap free laptop to my first Lenovo.

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.