20 October 2011

Working with Bootable SD Cards

My experience with bootable SD media is specific to microSDHC cards in the Nook Color tablet/ereader, but the issues people encounter will probably apply to any device, particularly any Android device, that boots first from its SD reader. These issues are also largely Windows-specific, but some of the concepts apply more broadly.

The ability to boot first from external media makes modifying or repairing a device much simpler and more straightforward in a lot of ways, but it also introduces concepts and processes that may be as unfamiliar to veteran Android rooters and flashers as they are to total tech neophytes (aka n00bs).

Bootable Media

Anyone who has installed a computer operating system (OS) or run a Linux live disk is aware that nearly all full-fledged computers check to see if any of their optical drives (CD, DVD, Blu-Ray) and/or USB ports and/or flash card readers contain any bootable media before loading the OS on the primary system drive. Most programs run inside of an OS. For external media to be bootable, it must provide an alternate framework within which its program(s) can run: an OS of its own, however simplified in most cases. As long as all of the host device's hardware is intact, no matter how badly the native OS is screwed up or how tightly it's locked down, bootable external media can do things like reset factory defaults, run hardware diagnostics, in some cases extract, move, or erase data, or install a whole new OS.

No ADB? No Root? No Problem.

In terms of Android modding, particularly running custom ROMs (volunteer-built alternative OSes), bootable SDs allow us to skip some preliminaries like installing developer software packages and drivers on our PCs, rooting our device's stock firmware, and replacing stock recovery with custom utilities. It all but eliminates the risk of "bricking" (rendering the device permanently unable to boot), because again, no matter how badly you screw up the software, you can always plug in a bootable SD, wipe the system clean, and start over. Because you didn't overwrite the stock recovery, you may even have the option of triggering a built-in factory reset. Moreover, because SD cards are almost identical to an Android device's internal flash storage, complete custom ROMs can often be run stably from SD cards without altering the stock software at all.

Obstacles, Ordeals & Misunderstandings

While bootable SDs are often more direct, safer, and more flexible than other modding tools, they can also be less familiar and intuitive than some of the install-and-click root methods out there.

  • Software: You'll need a disk-imaging program like WinImage (shareware) or Win32DiskImager (free and open source). The latter is designed more with developers than average users in mind, and the installation process can be daunting. Both are intended more for backing up and managing images than writing a downloaded image to a new disk, so it's by no means obvious at first glance how to accomplish our task, though most modding guides give specific instructions. In WinImage, it's Disk | Restore Virtual Hard Disk Image on Physical Drive. Make sure you know your card's drive letter, then select file type All Files.
  • Hardware: Not all card readers that can read SD are reliable for writing images. Your laptop's all-in-one cardhole probably won't work. Even a regular-size SD slot and an adapter may not work. Some people (including me, making my first card) have success using a tablet, phone, or camera as their reader via USB, but if the connection is interrupted, the card may be rendered unreadable. Your best bet is a USB É¥SDHC reader, which are quite inexpensive. The other options are worth a try, but if the image isn't writing, the reader may be to blame.
  • Cards and Class: If you're only making the card to run a rooting utility or a custom recovery like ClockworkMod, any card will do. For running ROMs from SD, however, class 2, 4, and unclassed SanDisks seem to outperform most other cards. Card class measures only how fast a card can read and write large, sequential files, like high-megapixel digital photos; indeed, few devices other than a newer SLR camera will benefit in any way from a class 10 card. An OS relies more heavily upon small, random reads and writes, which are not measured by card class and often suffer in higher-class cards.
  • Partitions: Some bootable images, particularly a complete OS, will need to divide the card into multiple partitions (separate virtual disks on one physical disk) to function properly, but Windows Explorer only looks for the first partition. So, Windows may tell you your 8GB SD is now only 103MB: DON'T PANIC. It's perfectly normal. If you need to erase the card, use SD Formatter. If you still don't see the whole card, use EASEUS Partition Manager's slider interface to delete all but one partition and stretch that one to take up the remaining space on the card, then format again.
  • Downloads: they get corrupted sometimes. Check the md5 sum of your image files if available, or if an image doesn't write successfully, delete and re-download.

4 comments:

Mr. Inflatable said...

Thanks, the tip about the microSD reader got me over a hump with installing the market.

taosaur said...

I didn't mention, and it's probably self-evident, but the same software you use to write bootable images can be handy in managing non-bootable SDs, too.

Yesterday, I picked up a 32GB SD to replace the 16GB SD in my tablet, which would then replace the 2GB SD in my phone. To ensure a smooth transition, I made images of the 2GB and 16GB cards, wrote them to the 16GB and 32GB cards, respectively, then used EASEUS partition manager to reclaim the unallocated space on each card.

Anonymous said...

Hi Quick question. I have a 16GB mSd card with android on it (got it from Ebay) and its working great, but for some reason, my NC thinks I only have 1GB of internal storage. I think its reading a partition on the card, but Im not sure how to change it. Can I use the Partition slider program you mentioned in your article? Or will that mess up my card?

Thanks,

C
thegalaxycorp@yahoo.com

taosaur said...

Sorry, C, but your NC probably does only have 1GB of user-accessible space. All NCs since June-ish have been set up that way, with 5GB of hidden space for B&N content (apps, books, magazines) only. Your best bet if you want to reclaim that space is to:
1. make a ClockworkMod card: http://forum.xda-developers.com/showthread.php?t=987735

2. use that card to flash a repartitioning zip: http://forum.xda-developers.com/showthread.php?t=1094371

If you have ROM Manager on your existing card, you could also "Flash ClockworkMod Recovery" from within the app, but that will install it to your internal recovery partition, blocking future B&N updates and preventing the 8-failed-boots automatic recovery from working.