Endian Hell - 2007-03-29 05:11:37
A week ago I got it in my head to upgrade my little NSLU2 to a more recent debian with better package availability.
In the process it trashed my RAID completely. After the upgrade it couldn't see the component partitions as parts of a RAID at all. My nice chunk of data was gone gone gone. Some of it was annoying to lose - mainly Kian's farsi videos. I could recreate them from the various DVDs and VCDs, but it's a serious pain and chances are some of those discs are scratched beyond readability by now if not snapped in half.
Anyway, today I had a "clunk" moment and realised that my upgrade will have moved me from a big endian system to a little endian system (because ARM is silly and lets you choose). Which means all I need to do is get a BE system back and copy the files across to the new RAID.
So now I have various backup images for the new system (of the firmware and of the thumb drive I use the root partition) on my desktop and a bare bones BE install on the hardware.
It took me *ages* to get the data up. Installing mdadm package doesn't install the md kernel module package - spend some time working out why it won't assemble. Installing the md kernel module package doesn't install the various raidN kernel module packages - spend more time working out why after assembling it is stuck in the "inactive" state.
Now, however, half a gig of data is going back and forth between the NSLU2 and my desktop machine. I'd already reused the disks in the original RAID, but since I knew the data was still there and that I'd work it out one day, I kept a copy on my desktop hard drive of two of the disk images (of the three disk RAID). The "R" in RAID means those two are all I need.
So the Windows desktop machine is exporting a Windows share with usb1.img and usb2.img on it - both 250GB (or so - disk manufacturer GB not real GB) files. The NSLU2 has that windows share mounted via smbfs. The NSLU2 then has those two files mapped via the joyous loopback interface in linux to the block devices /dev/loop0 and /dev/loop1. "mdadm -A /dev/md0 /dev/loop0 /dev/loop1" and "mdadm -o /dev/md0" and "mdadm -R /dev/md0" command later and those loop back devices are part of a RAID and we have:
# cat /proc/mdstat
Personalities : [raid5]
md0 : active (read-only) raid5 loop0[1] loop1[2]
487331584 blocks level 5, 64k chunk, algorithm 2 [3/2] [_UU]
"mount /dev/md0 /mnt/foo -o ro" and the data is back and accessable.
So now the windows desktop machine is copying the data back via scp. Of course since the disk images are actually on the desktop machine the data is going: dektop->NSLU2->desktop. And the NSLU2 step has a bunch of layers to it smbfs->loopback->raid5->ext3fs. It also means the room is full of blinking disk activity LEDs (some of which are those annoying blue ones).