Fail Safe Firmware

Motivation
"Fail Safe" is always relative, but maybe this firmware modification makes it at least safer to a certain amount. In fact, the factory firmware has a bug and so have other releases to:

Terastation comes with several mdadm configured devices, md0, md1, md2 beeing the first the system partition and the latter the data partitions. They are run from the kernel with the raid=autodetect option. In some cases, due to racing conditions while building the mdXXX partitions, md0 - being the system partition - is not started or is stopped by the kernel. This case is not handled by the initrd script 'linuxrc' which is the first start script. If you have root access, you can see the initscript by creating /initrd and rebooting the system, so the content of the initial ramdisk is mounted. To verify that this script does not handle the error mentioned above you need a serial console. When the system asks to press a key for kernel options, press enter and then type

root=/dev/md0 raid=noautodetect

This disables mdadm's autoscanning of the drives, md0 is not run and the initscript boots into emergency mode.

This happened with my terastation after a sudden power cut. It never came up again. As I didn't want to loose my data, I made a backup from either one of my raid1 data partitions and reflashed the firmware. To mention a very positive behavior of the system: When reflashing the system, the data partions are untouched and as their configuration is saved into the flash, they even show up in the reflashed system immediately.

But the "power cut error" remains, if all md partitions are out of sync you have a good chance your system never boots normally again until you reflash it.

The fix??
I modified the linuxrc script in a way, that it can handle md0 if it is not started. If md0 is down, it reads /proc/mdstat and stops all partitions found here. Then it starts md0 manually. If md0 does not come up here, it is a good reason to go into emergency mode.

Further modifications
The modification allows


 * to login as root in emergency mode (no password)
 * to create a system backup which can boot from usb (disk or stick): Emergency Boot
 * to boot from different locations than md0 (e.g. extra disk) without hex-edit of kernel: Boot Option

Modified (telnet enabled) firmware
You can download all stuff here:

http://homepage.ntlworld.com/itimpi/buffalo.htm#TERA_TELNET

... last but not least

 * How to do a Firmware Modification
 * some words about the Booting Process of the terastation

How-to courtesy of André. Original at http://terastation.wiki.homelinux.net