There are several reasons why one wants to revert an installation described the original guide. Powermanagement can be tricky or you just wanna sell your device. The steps here will restore the RAID 1 and have been worked out together with Hans van der Marel.


You did follow the steps in the original guide and did not install the stock debian on a new disk. In this case, the original RAID 1 partition with the system should still be intact.

One can do the reset in a oneshot without opening the drive if you carefully follow the steps. In case that something went wrong, one might fall back to removing the drive and attaching it to a linux computer to rebuild the array. Also it is can be helpful, if you can attach a serial converter to debug the boot process just in case.

Determine the RAID device

Boot the system and determine if /dev/md0 or /dev/md1 contain the old system, i.e. by checking the content of /proc/mdstat:

root@gondor:~# cat /proc/mdstat
Personalities : [raid1] [raid10] [raid6] [raid5] [raid4]
md1 : active raid1 sda2[1]
      1999808 blocks [2/1] [_U]

unused devices: <none>

In my case, md1 is the RAID device.

Reboot the old system

Next, we reboot the old system using the (degraded) RAID 1. To do this, we will modify the boot loader config to boot from the old partition. This is analogous to step UBoot Configuration in the original guide.

Create boot.cmd with following content:

echo Boot from U-boot configuration
setenv md1_args 'setenv bootargs root=/dev/md1 rw rootfstype=ext3 rootflags=data=ordered'
setenv load_sata 'sata init; ext2load sata 1:1 ${kernel_addr_r} /boot/uImage; ext2load sata 1:1 ${fdt_addr_r} /boot/apollo3g.dtb'
setenv boot_sata 'run load_sata; run md1_args addtty; bootm ${kernel_addr_r} - ${fdt_addr_r}'
echo ==== Loading Linux kernel, Device tree, Root filesystem ====
run boot_sata

Convert to binary bootloader config

mkimage -A powerpc -O linux -T script -C none -a 0 -e 0 -n 'Execute uImage' -d boot.cmd boot.scr
cp boot.scr /boot/

Now reboot and cross fingers.

Reassemble the RAID 1

Regain access to the original system

You have ssh access enabled on the old system so, just ssh into the rebooted system. Check if really the old system is running, i.e. by opening the WD UI.

Determine the correct partition

Determine which one is the current system and which one the system you wanna replace. Double check that md0 or md1 is mounted as root, and check the output of /proc/mdstat

Add the missing device (sda1 or sda2) to the RAID 1

mdadm --manage /dev/md1 --add /dev/sda1

Check /proc/mdstat and wait until the disk has been resynced.


Some hints in this guide were given by Hans van der Marel, thx for that!