Wednesday, January 14, 2015

dd, the Mac OS X (Unix) native solution to hard drive testing, cloning, drive recovery ...

App.net’s gaelicwizard posted this approach to hard drive testing back in Oct 2013. I’d lost it for a while but just found it again today:

$ dd if=/dev/disk1s2 of=/dev/null If it hangs indefinitely, replace the hard drive. If it I/O Error’s, replace the the hard drive. If it completes without problem, the hard drive has no bad blocks.

I’ve not seen this mentioned anywhere else recently, but I found a related MacOS X Hint from 2005 that explains what dd is, and how it can be used for drive recovery and as an alternative to “Norton Ghost”:

The Unix program dd is a disk copying util that you can use at the command line in order to make a disk image. It makes a bit-by-bit copy of the drive it's copying, caring nothing about filesystem type, files, or anything else. It's a great way to workaround the need for Norton Ghost.

Normally, in order to make a disk image, the disk you're copying from has to be able to spin up and talk -- in other words, it's OK to make a copy if the disk is healthy. But what happens when your disk is becoming a doorstop? As long as it continues to spin, even with physical damage on the drive, dd and Mac OS X will get you out of the fire.

We had a situation recently where a friend sent a disk to us that had hard physical errors on it. It would boot in Windows, but then it would hit one of these scratch marks and just die. We fired up dd, and it started OK, but stopped at the same physical error location -- complaining about a Hard Error.

So the workaround was to designate the dd mode as noerror -- which just slides over the hard stops, and to add the mode sync, which fills the image with nulls at that point. We did it on BSD Unix, but as long as you can get the hard drive attached to your Mac, the command is the same:

dd bs=512 if=/dev/rXX# of=/some_dir/foo.dmg conv=noerror,sync

… Once you’ve established the disk image (in this example, foo.dmg), you're almost home. Here's where your Mac OS X box is far and away the best thing to have. In this example, the dd output file is foo.dmg. You have to realize that this is an exact copy of a busted drive, but the "holes" are filled with nulls. As long as the damage isn’t to the boot sector, though, when you double-click on it, Mac OS X mounts it without breathing hard … who cares if it's FAT32, NTFS, whatever...

On a Mac or Unix machine “man dd” will provide the explanations of the parameters in @gaelicwizard’s example:

  • if=file Read input from file instead of the standard input.
  • of=file  Write output to file instead of the standard output. 

So the command reads every byte of disk1s2 and writes it to “null” (Nowhere). Why disk1s2? It’s a common boot drive. You can use “diskutil list” to find out the name of attached drives. On my machine the result looks like:

/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Stanford 999.3 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *2.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_HFS Media 2.0 TB disk1s2
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *3.0 TB disk2
1: EFI EFI 209.7 MB disk2s1
2: Apple_CoreStorage 3.0 TB disk2s2
3: Apple_Boot Boot OS X 134.2 MB disk2s3
/dev/disk3
#: TYPE NAME SIZE IDENTIFIER
0: confidential *102.4 MB disk3
/dev/disk4
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS BACKUP_B *3.0 TB disk4

I tested dd on disk4 (my backup disk). I found I had to run from my admin account, I needed to use sudo, and I had to unmount the drive first (or I got “resource busy” error message):

Admin$ sudo dd if=/dev/disk4 of=/dev/null

Please be careful what you type — especially for the of parameter. One little typo and you could be writing data anywhere.

It runs silently, you can stop with a Ctrl-C. It then reported:

1451352+0 records in

1451352+0 records out

743092224 bytes transferred in 48.218709 secs (15410869 bytes/sec)

I’ll let this run overnight on one of my backup drives some time, but it looks like an inexpensive way to test a hard drive. I’m surprised it’s not described more frequently. gaelicwizard knows the dark arts.

Monday, January 05, 2015

Aperture Tip: ⌘↑ or ⌘↓ will change focus to selected image

You select an image in Aperture, one among thousands. Now scroll up. How do you get back to your selected image? ⌘↑ or ⌘↓ will change focus to selected image.

Sunday, January 04, 2015

Google Voice for the home - Obihai SIP/VOIP devices and porting landline number to Obihai/Google Voice.

Obihai Technology is marketing Google Voice use with their Obi VOIP-landline bridge products (SIP & OBiTALK VoIP services, $40 on Amazon).

Unfortunately there’s no way to port a landline number directly to an Obi device. Instead you have to use the T-mobile hack - port to T-Mobile then port to Google Voice (best documentation of this hack I’ve seen by the way). Once you’ve made this irksome port however, you do get to use GV’s great features from a home landline and VOIP. (Compare, however, to mix of GV, Bluetooth, Mobile, landline.)

Alas, the future of Google Voice is problematic — we know it’s going to be replaced by Hangout, but we don’t know what Google Voice features will survive. 

Still, it’s amazing to watch the twisty-turny evolution of voice communication. This is NOT what we expected back in 1994; then we expected voice communication to become essentially “free” by 1998. Remember that the next time someone predicts the evolution of the marketplace based on technological innovation. The market is very good at fighting back - for example. (Use a fax machine lately?)

See also

Saturday, January 03, 2015

Wanted - a way to make an old style landline work over a cellular connection.

My 93 yo father is a resident of a Canadian Veterans long term care facility. He’s doing pretty well there, but it’s a bugger to reach him. Their landline costs are very high, and installation seems to take eons. Vets who can use a cell phone are fine, but that’s hard for him.

What I need is a cell phone that looks and acts like this phone:

1

I’m sure they make these for the China market, they’ve turned everything into a cell phone.

The closest I can find in the US market is the Panasonic Link2Cell Phone (note, however, complex compatibility grid.pdf - 3GS is borderline).

Screen Shot 2015 01 03 at 8 22 52 PM

I could put an old iPhone in his room, leave it permanently plugged in and maybe this would work. It’s pretty complicated though he has used similar devices. (I think these are sold to people who  get rid of their landline and transfer the landline number to a cheap cell, but want to share a home phone.)

I fear what I really want is only sold in China  It’s either mobile that looks just like old red except that it has a plug rather than a phone cable, or it’s a bluetooth device that fools an old style phone into thinking it’s on a phone line.

Update: I found a few other options…

2

Tuesday, December 30, 2014

Mac 2014 - I go into full Windows XP mode

I bought a Panasonic 8086 in 1986. Over the next 30 years I’d often use a Mac (Classic) at work or school and sometimes at home — but DOS/Windows and OS/2 were my primary environments.

That was not a pleasant time. The one happy memory I have is DOS 3.1 zooming on a 80386. Otherwise the Wintel world was a long, hard, slog. I bought an iBook in 2002, and a couple of years later we went all Mac. I’ve never regretted that — though I’ve written hundreds, maybe thousands, of posts about Apple bugs and issues.

You can guess where this is going. In 2014 the Mac feels a lot like Windows in 2002. iTunes 12 is a widely recognized disaster and iOS 8 is little better. The modern Mac doesn’t do nearly enough to diagnose and expose issues in our increasingly complex hardware environments. Every OS X version since Snow Leopard has been a regression.

It’s taken a while to get my head around this. Until last Friday I was in denial. Today, though, today all my XP experience came back to me. 

I’m now treating my OS X and iOS devices the way I used to treat Windows XP machines. 

I’ve configured Mavericks to restart at 6am daily. No more running weeks without a reboot.

I’ve configured mosts of our iOS devices to backup to iCloud and I no longer use a USB hub to charge iOS devices and sync to iTunes [2]. I bought a Brooks endorsed6 port Photive 50W USB charger and most of my devices now sync there. All this is to minimize interactions with iTunes and my iMac.

I’ve also removed Launchbar. I’ve used that utility for about 10 years, but, honestly, I never mastered it and it uses a huge amount of system memory. I can do most of what I need using Spotlight. No more TSRs.

For the few iOS devices I’m still syncing to iTunes I’m using Apple cables directly connected to a single USB port. 

Now to wait and see if Apple reboots itself. Otherwise, it’s gonna be XP for all of us … forever …

- fn -

[1] A very cheap passive USB 3 way splitter picked lets one port charge Fibit, bike lights and other oddball devices when needed. The other 5 ports are all for iDevices — we have nine currently.

[2] I’ve used a Plugable USB 2.0 10 port hub for about 2 years to simultaneously sync and charge, The power supply output says 5V and 2.5 Amps, that would be about 12.5W — but maybe it gets useful power from the iMac’s USB port. An iPhone charger supplies 5W, so I’ve been making a 12.5W-20W device do the work of a 60W device. I’m surprised it still runs.

Blogger's internal search is now very broken

I tried a search from Blogger’s web view. it returned 19 posts, the oldest from 2009. Using other methods it’s easy to find results back to 2003.

I don’t know when this stopped working, but Google turned off its Blog Search a few months ago.

I’ve been running a microblog on WordPress for a few years, but I’d put off migrating my primary blogs. Blogger has been a very reliable service — especially because Google largely leaves it alone. I guess I have to stop putting off the inevitable. This is gonna hurt.

Cancel Videotron internet service for a parent

My mother lived in Pointe Claire and received internet service through Videotron, a Quebec ISP. To cancel you have to call 1-888-433-6876 and have your name on the service. In our case my mother had passed, so a phone call from her would be supernatural.

I’d maintained her service, so I had her user name/password. Videotron’s web site doesn’t support canceling their service, but they do support adding a name to the service. I did that to add my name and contact information; then I was able to call and cancel. 

Cancellation went quickly once I mentioned she’d died. They need her cable modem and power supply back within 1 week or they’ll charge us $69, when it’s returned we have to provide her account number.