Days of Dead Disks

So I had to recover data from my mom’s iBook a week ago. That took a while, and was a pain in the butt.

Sunday, around 9am, my wife tells me that my mail service isn’t working – so I have to go into the city to fix it. And cancel a U-Haul truck ($50 fee) which was going to haul crap from my old place to my new place. I go in, and my server is reporting both drives (RAID) are gone. I reboot, and it says one is gone. Fine, I put in another disk and let the RAID rebuild.

45 minutes to an hour or so later, I look at the server – and the new disk is dead! WTF!? So luckily, I have another, and I put that in. That fails the rebuild after just a few minutes. I called in reinforcements. Another rebuild attempt on another drive – failed. What the hell is going on?! In a fit of desperation, I decide to move the drives out of that chassis into another. Put in a new disk, the rebuild starts…and…no disk errors! It was a bad chassis.

Next day, I have to do data recovery for a client (his home disk had died, whereas his work disk was dying a few weeks prior, but I think my boss did the fix for that one). I use my time-honored technique (next blog posting, better title for it) to get the data off, and fsck the image, and it looks good. Ready to do the restore, just waiting on a new drive.

My boss shows up with a drive at 5pm (thanks, boss). I try to use asr to copy the data and…failure!

At this point, I’m beginning to doubt myself.

I try several different methods – the image file I just created won’t mount anymore. as a ‘crazy thing to try’ I move the image file off of the firewire disk, and onto the new disk, and figure I can try an in-place recovery. As soon as the data is copied, BLAM, the disk image is mountable again. So the firewire disk was failing.

Disks suck. Fucking suck. I’m surprised we trust our data to such awful, spinning, magnetic demonic devices. and I think my own personal good luck with disks has run its course, and I’m getting payback.

How to recover data from a dead or dying Mac Hard Drive

I’ve done this twice now, so I thought I would document it for Google’s sake.

first, dd the drive

Use Disk Utility to find out the /dev/ name of the disk (/dev/disk0s2, /dev/disk1, etc). Click the disk and hit ‘Info’ to get its name.

sudo dd if=/dev/diskname of=outputfilename.dmg conv=sync

the conv=sync bit makes it put zeros where it can’t read the data.

It will take a long time. The more messed up the disk, the longer it will take. You can use the Finder to see how big your .dmg file has gotten and compare that to the disk size for a very rough estimate.

When done, do:

sudo hdiutil attach outputfilename.dmg -nomount -readwrite

it should spit out a new pseudo-device name, like /dev/disk3, for your thing.

You may be able to get DiskWarrior to run on that pseudodevice (though I had trouble, but that was because my disk image was itself on a bad disk(!)). or you can use:

sudo fsck_hfs -f /dev/pseudodevname (-f forces it if it has a journal)

when done, detach using

hdiutil detach /dev/pseudodevname

Now try mounting the disk. If you’re lucky, it worked.

The restore can be done with Disk utility – choose source, and destination (and for fast and friendly block copy, choose ‘erase destination’).

I do command line, usually, so I try to use:

sudo asr restore --source diskimage.dmg --target /dev/newdisknum --erase

The (Actually Helpful) New York Visitor’s Guide

I originally thought of writing a sarcastic, whiny diatribe against the Tourists who plague my beautiful city.

But then I realized, I could actually say something that would be a little helpful to the Tourists as well as to my fellow city-dwellers:

  1. The Train is going to lurch – when you hear the “ding-dong”, GRAB A POLE. If you do not, you will fall on one of us. We are used to it, and you will embarassedly apologize all over yourself. We will say something short, simple and sweet, like “it’s ok” or something. So, unless you’ve been here for a while, grab a pole when you hear the door chime. Natives rarely even try to stand up on a train without a handhold.
  2. Ask for directions more often! but quickly – New Yorkers can actually help you – and most of them, if they’re not in a hurry, will be happy to. But you have to ask quickly. Here’s why:

    I remember once a couple coming up to me when I was waiting at the uptown 2/3 station. “I’m really sorry to interrupt, but can I ask you a question?” Or something like that the gentleman asked. Christ. So I expected him to say, “My girlfriend and I have gotten lost in the city, and are trying to get back to our home in Nowheresville. Can I have $20?” Instead, he asked, “Is this the downtown 2 train?” At which point my eyes stopped rolling and I said, “Oh! No, you go up the stairs, go across to the other side, and then you’ll be there!” But I nearly told the guy “Sorry, buddy, I can’t help you.” Be quick. “‘Scuse me, this downtown?” We talk quick.

    And more often than not, I see people futzing with maps and stuff. Look, just ask, if you see someone who’s not crazy, homeless, or walking very, very fast, ask them, and they’re happy to help. The stupid questions like “Is this uptown or downtown?” Or “Which way is 6th avenue?” we love to answer, because we know the answer, and it’s helpful to you.

  3. Do NOT walk wide – We are a city of walkers. What if we drove into your town and started having our cars straddle two or even three lanes? You’d shoot us. And sometimes, we want to shoot you for the same offence. Try and be sensitive to the fact that when you’re on our sidewalk, you’re on our freeway. Pull over to stop. Do not stop in the middle. And, most of the time, you’re not going to be able to walk all 7 of you all in a row. New Yorkers sometimes need to be reminded of this as well.
  4. Represent, yo – You can make wherever place you come from appear exotic, wonderful, and yourself to appear quant and pleasant. Or you can make us think you are all stupid hicks. That means – #1) Be Tolerant – we are a town of every single race there is, and every sexual preference, gender identification, and who knows what else. You may mock people of type X back at home, but here, you can get your ass kicked. I remember seeing a nice gay couple walking down 23rd st, hand-in-hand, and some stupid dude in a suit with his empty-headed bimbos started mocking them. Had there been some leather-wearing type gay dudes there, I should hope the gentleman would have handed his ass to him. And, needless to say, I didn’t like him and I don’t think any regular-type New Yorker would. #2) Be aware of your surroundings – I saw this chick on a train, and she was being EXTREMELY loud, and extremely Southern. And lots of people on the train are trying to have nice conversations and stuff, and she’s going on about Beyonce’s butt or something inane like that to noone in particular. Eventually, a gentleman told her, “Oh, you need to get on the Q train, across the platform,” to which she said (loudly), “Blah blah blah thanks! blah!” When the gentleman returned to his compatriots, they all gave him high-fives. Because he had told her incorrect instructions so she would get off his train. I hate to admit it, but I was proud of this guy, because I’m trying to play on my Nintendo DS or veg. out or whatever, and this stupid chick is preventing me from doing so.
  5. Go to the middle of the train – this is something you learn over time. But a frequent train-rider can get into the train, walk all the way into the middle of it (farthest away from the doors), and, at his/her stop, get all the way back out again. Try not to gum up the doors by standing right there because you’re terrified about getting off on time. If you have to do that, then at least wait till you’re one stop away, then start moving towards the doors. OK? And at Big Stops like 42nd street, the whole train may nearly empty and you’ll find it VERY easy to get off, even from the middle of the train.
  6. Let them off the train, then get on – many New Yorkers need to be reminded of this one. Stand aside from the doors, let them off, THEN get on. I’ve deliberately tossed many an elbow to many a douchebag who has stood in the way of everyone getting off the train.

And I have decided I’m going to keep adding bits to this as I think of it, even though it goes against regular Blogulism.
Addendum 1

  1. Jaywalk! – A bonus here in New York, is you can cross any time the street is clear. Us natives have this down to a science – so you can use the Sheep Method (follow everyone else) or if you feel adventurous, just look to see if cars are coming and cross. This isn’t legal, but I’ve seen people do it in front of cops and they don’t care. If you get yourself killed though, they might get peeved.
  2. Times Square – We gave up on this place. You can go ahead and walk however you want – wide and/or slow – or do whatever you want there. We don’t go there. It’s yours. Enjoy. And when we do go there, we will curse and try to walk in the street, but too bad for us. The smarter ones just don’t go there.
  3. Metrocards – These get you on the subway. Watch how everyone else swipes the card, and you swipe at roughly the same speed. Too fast, it won’t work, too slow, it won’t work. “Swipe Again” means you should try again, maybe at this turnstile, maybe another. “Swipe Again At this turnstile” means swipe again, DO NOT MOVE ELSEWHERE! If you get really screwed, talk to the station person and they will let you in. And if you get the 1-day unlimited, that only works for one person. And you can only use it every 18 minutes – trying to use it again it will say, “JUST USED”. And don’t get in the turnstile until you have the metrocard ready to swipe. I hate people who walk up and insert themselves in the turnstile and _then_ start to fumble around for their metrocards. They prevent people from using it and other people from exiting.

Addendum 2

  1. Starbucks – yes, we have a lot of them. If you have never been to one, don’t let anyone know, because you’ll sound stupid. Unless you’re one of those anti-corporate Brooklynite baseball-cap wearers with an ironic haircut. In which case, you shouldn’t be reading this, and I hate you. The reason I mention this is because I actually witnessed some fellow American having their Starbucks virginity gently removed from them, and it made me cringe. You don’t have to order in Starbucks-ese (Venti Drip, no room. Iced Grande Caramel Machiatto with Whip), they can translate. I like to order in Starbucks-ese because I’m a weenie.
  2. Making Conversation, smiling, or eye contact – are expressly forbidden. And we like it that way. This is not because we’re cold, heartless bastards, but because we are sensitive human beings, who live on top of eachother and within eachother’s personal space, all the time. If every time you saw a homeless person, your heart broke, you would die here. And in the same vein, if every person you met on the streets said, “Hi, how are you?!” you’d have to say that 2000 times just getting to work. Like I said, we actually can be nice people. We just talk fast.

Long Time

I watched a client fire their CTO. The guy made some decisions I wouldn’t have made, but was basically a good guy. Much better than me on the ‘presence’ and executive-swagger thing. Now they seem to have kinda given up on having one at all, and elevated one of the programmers to a similar effective spot. I’m curious to see what happens.

Blackberry? Treo? what?
I am thinking about getting a Blackberry. Or a Treo. Or something. I just really would like a mobile ssh and mail terminal, and even some web browsing could be nice. I may see a client today who has them, so maybe we’ll see. Strangely enough, for the amount of phone I use (very little) and the amount of Internet I would use (nearly unlimited), Sprint is actually the best carrier for me. But they don’t subsidize their handsets much, and, well, that’s where I’d need some help… I made a little spreadsheet with the total cost over two years of all of the different options – a t-mobile BB is cheapest, and a somewhat-distant second is the Treo 700p on Sprint. I love the Palm Calendar, and can’t live without it. I didn’t really like the Blackberry one (I used a friend’s one yesterday.)

AppsLink NetServOS Whatever
I wrote a letter to the BizDev dude over at 37signals, the guys who wrote Ruby on Rails and Basecamp and stuff. I thought I would ask about the integration idea thing I mentioned like a gajillion blog postings ago, and see if they would be interested in developing to an API. The guy actually ended up responding – and relatively quickly:

Hi Brad-

close enough

Thanks for emailing us.

We’re entirely consumed by our own work on our own products.
Basecamp and Backpack have APIs and you are free to use
them to integrate with whatever you’d like, but that’s the
extent of what we can do with you right now, sorry.


Which is interesting, and I think kinda telling. I imagine the answer for lots of different services like these would be the same. So perhaps the federated authentication model isn’t something I need to worry about – for now, at least.

I’m thinking about writing up some documentation on protocols – and some basic explanation of how everything works and why – and maybe we’ll see where that goes. I’ve sketeched out some interesting things, thus far.