www.flish.co.uk

  • Photos
  • Black and White
  • Video
  • Articles
    • An Apple a Day
    • Work…
    • … Rest and Play
    • …. Cole!
    • …. Leah
  • The Rants
  • Running
  • Contact

Buffalo Terastation Raid Recovery (PPC) under Linux (i386)

  • Posted in: Articles,Rest and Play,Work...
  • on November 6, 2011
  • » Tags: big endian, buffalo, i386, intel, linux, little endian, power pc, ppc, raid, recover, software, software raid, terastation, x86
  • » 1 Comment

Buffalo Terastation Raid Recovery (PPC) under Linux (i386)

First off, a caveat, the data I had on my Terastation was not life or death, if this had failed the world would not have ended, in fact this had sat for 6 months un-attempted, that’s how un-important it was. Getting the data back was a ‘nice to have’, so this is not a safe or guaranteed process. If in doubt investigate using dd to backup partitions before atttempting – Don’t blame me! – But in essence Buffalo Terastation raid recovery is possible using an i386 generation donor box.

So, history, I had a Buffalo Terastation (model TS-1.0GL/R5) which is a Power PC (PPC) based NAS, fitted with 4x 250GB Western Digital drives. It went Pop :-(

In my case it was configured to use all the drives as one large pot, although that’s not really important, underlying I knew it was basically software raid (mdraid) and the XFS file system.

First attempt was using a Centos 6 (32bit) box I had to hand, guess what, no XFS support under 32 bit, try again. So I used the Openfiler 2.3 install CD I had (intention was to present the recovered data as a NAS again – but never quite got that far). Importantly Openfiler supports XFS and software raid, and is in essence a minimised Linux distro with a web front end.

Once booted up (hasten to add boot / OS drive was another drive, I’ve literally added the Terastation drives as additional SATA drives and done nothing with them), I ran fdisk on the first Terastation drive and saw;

fdisk /dev/sda: 250.0 GB, 250059350016 bytes
 255 heads, 63 sectors/track, 30401 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
 /dev/sda1 1 48 385528+ 83 Linux
 /dev/sda2 49 65 136552+ 82 Linux swap / Solaris
 /dev/sda3 66 30378 243481141 83 Linux
 /dev/sda4 30378 30401 192779 83 Linux

Which was promising, in fact all 4 drives had identical partition structures. The first partition (/dev/sda1) is actually a raw xfs partition and is the / partition of the Terastation if you want to be nosy.

/dev/sda2 is swap, if I’m honest I have no idea what /dev/sda4 is (/boot maybe? I didn’t look), but /dev/sda3 (and /dev/sdb3, /dev/sdc3, and /dev/sds3 are the big ones with my data, and the software raid). There was lots of poking, prodding, reading, giving up as a lost cause at this point. I’m more than comfortable hacking about in Linux, it’s part of my day job, but Software Raid and mdadm are not my regular toys, and whilst a Mac fan my indoctrination didn’t come till the Intel days, so am not a Power PC expert. But, end result was discovering that in essence a software raid array, created on a PPC (Big Endian) device was not going to ‘appear’ under an i386 Linux (Little Endian) appliance, so give up … or google a little more.

At this point mdadm –examine was seeing nothing, there was no hint of a software raid, it might as well have been not there, but I *knew* it was. Turns out that you can change the byte order (Big Endian vs Little Endian – google it if you want), you need to do this on all components of the array, so basically;

 mdadm -A /dev/md0 --update=byteorder /dev/sda3
 mdadm -A /dev/md0 --update=byteorder /dev/sdb3
 mdadm -A /dev/md0 --update=byteorder /dev/sdc3
 mdadm -A /dev/md0 --update=byteorder /dev/sdd3

At this point we can ask mdadm to have a look, and you should get something similar to;

mdadm --examine /dev/sdb3
 /dev/sdb3:
 Magic : a92b4efc
 Version : 00.90.02
 UUID : 39b220be:f9b75e99:849a28e5:f10c758f
 Creation Time : Sat Aug 29 11:09:31 2009
 Raid Level : linear
 Raid Devices : 4
 Total Devices : 4
 Preferred Minor : 1
Update Time : Sun Mar 6 17:05:45 2011
 State : active
 Active Devices : 4
 Working Devices : 4
 Failed Devices : 0
 Spare Devices : 0
 Checksum : f8cc653a - correct
 Events : 0.8
Rounding : 64K
Number Major Minor RaidDevice State
 this 3 8 51 3 active sync /dev/sdd3
 0 0 8 3 0 active sync /dev/sda3
 1 1 8 19 1 active sync /dev/sdb3
 2 2 8 35 2 active sync /dev/sdc3
 3 3 8 51 3 active sync /dev/sdd3

Bingo, we’re now acknowledging the raid array components, so stich back together with;

mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3
 mdadm: /dev/md0 has been started with 4 drives.

Then give it somewhere to mount (but read only for now, to be safe);

mkdir /mount/md0
 mount -o ro -t xfs /dev/md0 /mount/md0
 mount: /dev/md0: can't read superblock

Cock :-( At this point you may be laughing and busy copying off your data, but not for me. Am not an XFS filesystem expert, but some more googling suggested some options, and lots of warnings that *this may further corrupt your data* remember, I wasn’t too concerned if it ended badly, so you’ve been warned, at least twice!

xfs_repair /dev/md0
 Phase 1 - find and verify superblock...
 Phase 2 - using internal log
 - zero log...
 ERROR: The filesystem has valuable metadata changes in a log which needs to
 be replayed. Mount the filesystem to replay the log, and unmount it before
 re-running xfs_repair. If you are unable to mount the filesystem, then use
 the -L option to destroy the log and attempt a repair.
 Note that destroying the log may cause corruption -- please attempt a mount
 of the filesystem before doing this.

You have now been warned three times! Pressing on …

xfs_repair -L /dev/md0

… followed by similar output to above, confirming that the log had been zapped and recreated, but nothing else fatal, then to be sure;

xfs_check /dev/md0

Again nothing, so, try again;

mount -o ro -t xfs /dev/md0 /mount/md0

Bingo!

Openfiler saw the software raid array we’ve just re-created, but I’m assuming that because it relies mostly on LVM volume groups on top of physical disks / arrays it couldn’t do anything for me with an array of existing data, so I just fired up an SFTP client and copied everything off.

Hope this helps, please heed my warnings if your data is critical, but then if it were critical you’d have a backup, right?

Andy Flisher is a Software Developer based in the North East of England specialising in cross platform development. Mobile Development experience includes Windows Phone, Android, and iPhone Apps. Desktop Software Development includes bespoke Windows, Linux, and Mac Applications. Web Development Skills include PHP, Perl, Python, ASP (Classic and .NET) – Andy Flisher on Google+

Bupa Great North Run – 2011 – As run by Me

  • Posted in: Articles,Rest and Play,Running
  • on September 19, 2011
  • » Tags: 2011, bupa, butterwick hospice, great north run, running, September
  • » No Comments

My run chart of the Bupa Great North Run in 2011, although am pretty sure that long downhill in the middle never existed. Can’t embed the map to click the External link;

Link – Great North Run 2011 by Flish at RunKeeper

Official Chip Time was 2hrs 16 minutes and 14 seconds and was run in aid of Butterwick Hospice, sponsorship page still available at http://www.justgiving.com/Andy-Flisher-GreatNorthRun-2011

Official Chip Timing:

Number: 45037
Chip Time: 02:16:14 Position: 21,802

Middlesbrough 10k – 2011

  • Posted in: Articles,Rest and Play,Running
  • on September 5, 2011
  • » Tags: 10k, 2011, boro, middlesbrough, race, run, runkeeper, running, September, tees pride
  • » No Comments

The Middlesbrough Tees Price 10k – 2011 – As run by Flish

The embbedded route map is currently broken (Take note please Runkeeper, embedded maps still broken), so here’s a link to the actual page – Middlesbrough 10k 2011 Race

Official Chip Timing:

Number: 692
Gun Time: 00:56:50 Position: 1138
Chip Time: 00:54:14 Position: Unknown
Category: Vet Men 35-39 Position: Unknown
Gender: M Position: Unknown
Age Grading: 47.46%

RIP Cassey – 3/4/1998 – 27/12/2010

  • Posted in: Photos,Rest and Play
  • on December 28, 2010
  • » Tags: 2010, cassey, december, huskie, husky, rip, siberian
  • » No Comments

You’ll be missed, love Andy, Rachel, Cole and Leah x

RIP Cassey

RIP Cassey

DSCF0033
DSCF0035
DSCF0036
DSCF0041
DSCF0043
DSCF0043
DSCF0046
DSCF0050
DSCF0056
DSCF0061
DSCF0065
DSCF0072
DSCF0073
DSCF0074
DSCF0078
DSCF0079
DSCF0082
DSCF0086
DSCF0089
DSCF0090
DSCF0100
DSCF0100
DSCF0101
DSCF0103
DSCF0102
DSCF0104
DSCF0108
DSCF0109
DSCF0110
DSCF0117
DSCF0118
DSCF0010
DSCF0021
DSCF0026
DSCF0027
DSCF0029
DSCF0031
DSCF0033
DSCF0034
DSCF0035
DSCF0037
DSCF0038
DSCF0044
DSCF0047
DSCF0060
DSCF0061
DSCF0062

Middlesbrough 10k – 2010

  • Posted in: Articles,Rest and Play,Running
  • on September 5, 2010
  • » Tags: 10k, 2010, boro, garmin, middlesbrough, race, run, running, September
  • » No Comments

The Middlesbrough 10k – 2010 – As run by Flish

Official Chip Timing:

Number: 1713
Gun Time: 01:04:55 Position: 1729
Chip Time: 00:56:17 Position: 1393
Category: MOPEN Position: 763
Gender: M Position: 1298
Page 1 of 212»

Flickr-age

Today\'s light reading

Categories

  • Articles (31)
    • An Apple a Day (5)
    • External (5)
    • Here comes …. Cole! (4)
    • Here comes …. Leah (2)
    • Rest and Play (8)
    • The Rants of an Angry Web Developer (6)
    • Work… (8)
  • Media (51)
    • Photoart (2)
    • Photos (40)
      • Street Photography (2)
    • Video (10)
  • Running (4)

Backchat

  • Flish on Avoid Bristol Cameras
  • Bob Purdy on Avoid Bristol Cameras
  • KyK – The iPhone App for Zenoss – Why and How - dotUK on Contact
  • Ben on Buffalo Terastation Raid Recovery (PPC) under Linux (i386)
  • A .Ostacchini on Avoid Bristol Cameras

You are here: Home » Articles » Rest and Play

Latest on Flickr

Today\'s light reading

Recent Posts

  • H Jarvis – Support Software Case Study – dotUK
  • The iPhone App for Zenoss – That’d be KyK
  • Photos – Legoland Windsor August 2012
  • Photos – Stockton Internation Riverside Festival (SIRF) Photowalk 2012
  • Photos – Raby Castle

Recent Mutterings:

  • RT @jomusiclife: Vote Preston Hall and the mighty @mikeycphoto in this superb Art Find competition artfund.org/news/poll/muse… 15 hours ago
  • RT @nitr0usmx: Coding drunk. http://t.co/DN52pipwjT 15 hours ago
  • Today has mostly involved early starts, automating canoe pump stations, planning a seminar and contemplating Sage — posts.app.net/5774173 17 hours ago
  • Anyone know if b&i cup final is on the goggle box tomorrow, or streamed even? #fb 1 day ago
  • Oops, forgot twitter existed today, try again tomorrow 1 day ago

Follow Me

Copyright 2010 Onwards- All rights reserved Andy Flisher [ North East Web Development by dotUK - Web Developer in Stockton on Tees]

  • Go to top ↑