Strategic Informatics

A blog about the strategic application of technology

By

Recovering a hard driving using SpinRite on a Mac using VMWare Fusion

I recently found myself faced with a 2.5″ NTFS formatted laptop hard drive from a 5 year old laptop that wouldn’t cooperate and would constantly fail so I decided to try and recover what I could from the drive by running SpinRite, a great application from Steve Gibson of Gibson Research that I have used successfully many times in the past to recover damaged or unreadable magnetic based media.  The last time I actually used it was about 12 years ago over the course of several days to recover a failing HD.  Computing and hard drive technology has changed a lot since then but they are still very much part of our day-to-day IT lives.  When I encounter a problem that needs extensive evaluation I would just run SpinRite on the x86 based PC from which the hard drive came.  However, after creating a bootable CD and USB key with SpinRite for use on the 5 yo laptop neither one would work so I decided to take a different route.  Without another PC handy I decided to assess my options…  My daily laptop is a MacBook Pro, doesn’t (thankfully) have an internal 2.5″ SATA bay and is sealed tighter than the sub in the Hunt for Red October…  So what’s a Mac user to do with an NTFS formatted magnetic HD that can’t be read, an old Laptop that won’t boot SpinRite, and no other PC’s within easy reach?  Try to run SpinRite from a Virtual Machine on a Mac of course….

Now for those of you who don’t know SpinRite was written in assembly and does very low level reads and writes against a computers magnetic mass storage drives.  FreeDOS has been incorporated into SpinRite distribution to allow it to boot to a bare-metal PC and mount any connected drives so you can exercise the individual bits of 1’s and 0’s stored on the drive, exercising it enough to get a magnetic drive in as good a working condition as the physical hardware will allow.  With any luck it will operate just well enough to get your information to a readable state and backed up before you have complete hardware failure…   Running SpinRite from a VM was a bit more involved to configure via VMWare Fusion on a Mac and I wasn’t completely sure it would work… so I thought I would share my experiences.

 

I created a spinrite.iso file from another Windows VM I use.  I then created a new MS-DOS based VM mounting the SpinRite.iso created from the SpinRite.exe file.  It booted to a familiar screen without any issues.

SpinRite_and_Blank_website__Blank_site__Nothing_to_see_here_

SpinRite_and_Blank_website__Blank_site__Nothing_to_see_here_

Now the challenge was to get the physical hard drive mounted to the VM…  Looking through the settings there was no way to get RAW access to a physical HD.  I used a SATA to USB adapter and had to connect the drive to my Macbook Pro ensuring it was mounted to the Mac not the VM.

I needed to create a Raw Disk vmdk to make the RawDisk accessible to the VM so I did the following:

From a Mac terminal (I prefer iTerm) type:

diskutil list

In my case the 160GB HD came up as /dev/disk2 but your particular configuration may be different.

1__bash

 

Next from the terminal run the following command to list the partitions that rawdiskCreator can see:

/Applications/VMware Fusion.app/Contents/Library/vmware-rawdiskCreator print /dev/disk#

Note: Ensure that the last entry /dev/disk# is changed to the drive you are targeting for raw access.  In my case it was /dev/disk2

1__bash

What you should see next is your drive partitions…  My particular drive was split into two partitions (#1 was very small and #2 made up the bulk of my 160G HD)

With your partitions known and visible by the rawdiskCreator tool you can create the vmdk file that refers to the physical hard disk you are trying to mount and make it available to the existing SpinRite VM you created earlier.  You will need to know the location of the Disk and the partitions you want to mount from the previous command, which in my case is /dev/disk2 1,2 which says it’s disk2 and both partitions 1 & 2.  You will also need the path to the actual SpinRite .vmwarevm Virtual Machine that you created earlier (in my case ~/Documents/Virtual Machines/SpinRite.vmwarevm/rawDiskFile).  Now I used rawDiskfile but this is the name of your vmdk file and can be called whatever you like.  Make sure to include the ide designator at the end so the VM knows how to mount the drive.

/Applications/VMware Fusion.app/Contents/Library/vmware-rawdiskCreator create /dev/disk2 1,2 ~/Documents/Virtual Machines/SpinRite.vmwarevm/rawDiskFile ide

After you execute this command successfully you can option click the SpinRite.vmwarevm file and choose Show Contents.  Here you should see the files that makeup the .vmwarevm file including the new .vmdk file (if that’s what you named it) for each partition you listed above (1,2).  In my case it was rawDiskFile.vmdk & rawDiskFile-pt.vmdk

If you boot the VM now you won’t see the additional drive so you have to manually edit the configuration file for the VM to recognize the drive.  With the VMWare file contents still being displayed in finder you need to edit the .vmx virtual machine configuration file.  In my case it was called SpinRite.vmx because SpinRite is what I named my VM…  You should probably back up this file incase there is a problem and you need to start over.  Use your favorite editor (BBEdit, TextWranger, TextEdit, etc…) to edit the .vmx configuration file.  You want to insert the following lines to your configuration file being careful not to duplicate an existing ide#:# entry:

ide0:1.present = “TRUE”
ide0:1.fileName = “rawDiskFile.vmdk”
ide0:1.deviceType = “rawDisk”
suspend.disabled = “TRUE”

If the VM already has in its .vmx configuration ide0:1, use another port such as ide1:1.  It is also possible to use scsi#:# or sata#:# if the VM is somehow configured to use a SATA or SCSI controller.   The suspend.disabled=”TRUE” entry prevents the VM from suspending and being out of sync with the attached HD.  Important since most of SpinRite’s scans can take a long time to run.

The last step is to power on the VM and select your HD…  You may be prompted to enter your administrators password to get RAW access to the HD as the VM powers up.

Screenshot_4_30_15__4_12_PM

If you run into trouble it may be necessary to unmount the HD from your Mac by ejecting or un-mounting from Disk Utility prior to turning the VM on.

I won’t go into detail on how to use SpinRite as the tool is pretty self explanatory but the 160GB HD partition did appear in the interface ready to begin SpinRite’s operations.

SpinRite

SpinRite_and_Blank_website__Blank_site__Nothing_to_see_here_

SpinRite

 

Again this certainly isn’t an ideal setup as SMART access to the HD wasn’t available from within SpinRite menu options because, and I’m guessing here, of the SATA to USB setup but it might work in a pinch.  Hopefully it proves useful to your IT Toolkit and helps you extend the life of your SpinRite license which is worth every penny…

Update:  I tried a couple of drives and while it worked for one drive there was an error that completely stopped SpinRite and the VM in it’s tracks…   It only occurred on a specific section of the hard drive where there was clearly an issue…

SpinRite

SpinRite

By

Installing a 500 GB HD in a 17″ Macbook Pro

Here is how I replace my 160 GB hard drive with a Hitachi 500GB 2.5″ HD in my 17″ Macbook Pro. There are several sites and even video’s on the web that outline how to do this but to complement my post on how I moved both my HFS (OS X) and NTFS (Vista) partitions to a new hard drive I thought I would also post pictures of my install. My Macbook is less than a month away from being out of warrantee so I decided to go ahead and save the $80 or so that Apple charges to install a 320G drive and do it on my own with a 500G drive. This was actually a really easy project so don’t be put off by the steps as I’ve just detailed the steps and included pictures. Total time was about :30 minutes from start to finish.

Important: Installing this new hard drive was an intermediary step between my initial backup and restore of my data. Look a the “Restoring OS X and Boot Camp Partitions to a new hard drive” post for backing up your data to prepare this hard drive for installation and also for restoring. If you follow these steps when you install this HD you will have a bootable OS X partition just as you had before and will be ready for restoring your boot camp partition if you had one.  Also last but not least this process will void your Apple warranty so keep this in mind.  Apple will do a hard drive upgrade for you for $80, so if you are inclined to take this route there are other options for you to pursue.

Tools Required:

1 #00 Phillips Head Screwdriver

1 T6 size Torx Screwdriver (Star shaped head)

1 non-metalic driver to assist with lifting tape and connectors

1 multi-compartment case to hold several of the lilliputian screws used to piece this notebook together.

Note: A grounding pad would be a wise idea. I don’t have one in these pictures but what you don’t see is the grounding strap I used to be on the safe side since I didn’t want to risk doing any damage to the internal components.

Step One:
Remove the battery from the bottom of your MacBook Pro. I’m assuming you know how to do this. Just pull back on the two battery release tabs on the underside of your MacBook Pro.

Step Two:
Remove four Philip head screws that hold the cover for the memory in place.

CIMG3024.jpg

Step Three:

Turn the MacBook Pro 180 degrees around to access three Phillips head screws. These are at an angle so keep this in mind when you put them back in so as not to strip the screw holes.

CIMG3026.jpg

Step Four:

Remove the two Torx Screws just above the memory. You can see I removed my memory during this install just to play it safe.

CIMG3028.jpg

Step Five:

Remove four Phillips head screws across the bottom near the hinge that attaches the LCD screen.  Below are the two of the four screws on the left

CIMG3030.jpg
Below are the two remaining screws on the right
CIMG3031.jpg

Step Six:

Remove four screws on both sides of the notebook

Below is the left side of the notebook where the magnetic power adapter fits

CIMG3032.jpg
Below is a picture of the other side of the notebook where the DVI connector is located.
CIMG3033.jpg

There is also two screws on the back of the hinge that need to be removed as well.

Step Seven:

Turn your notebook over and open the lid. You can start to remove the top portion of the keyboard by starting at the hinge and gently lifting and moving your way down the sides toward the front of the notebook. I included pictures to show how this will look as you remove it.

CIMG3034.jpg
Another shot of the other side with the top cover coming off.
CIMG3035.jpg
CIMG3036.jpg

Gently lift the bottom of the keyboard assembly up. If you lift the keyboard assembly strait up you will exceed the length of the ribbon cable inside so lift gently.  You must remove the ribbon cable connecting the keyboard assembly to the motherboard as indicated here.  If there is tape holding down the connector just use a non-metallic screwdriver to work the tape off the circuit board then gently pull up on the connector and it should come off. Don’t worry it will pop back in by applying a little pressure.

CIMG3038.jpg

Step Eight:

Remove the hard drive ribbon cable that connects to the motherboard

CIMG3042.jpg

If there is a ribbon cable over your current HD just lift up on the tape to free it from the drive you will be replacing. Also, to the right of the drive is a bracket holding the drive in place. You must remove this assembly by unscrewing the two Torx screws holding it down.

CIMG3043.jpg

The tape at the top portion of the drive wraps to the back of the drive and across the drive ribbon cable. You need to lift this tape up and out of the way in order for you to remove the ribbon cable that connects the motherboard to the hard drive. Gently lift up on the right side of the drive to remove it from its housing.

CIMG3044.jpg
CIMG3045.jpg

Step Nine:

Once you remove the drive from the laptop you will need to remove the rubber grommets and screws that allows the hard drive to sit snugly and quietly in the notebook and move these to the new hard drive.

Below is a picture of the right side of the SATA drive the connector is on the right of the picture.

CIMG3046.jpg
Below is a picture of the left side of the drive.  The connector is on the left of the picture
CIMG3047.jpg

Step Ten:

The silver colored screws that you put on your new hard drive fit into the black rubber grommets in the hard drive bay of your notebook. Just slide the hard drive into these holes, reconnect the ribbon cable and lower the hard drive into it’s new home. Put the hard drive bracket back in place to secure the unit.

CIMG3051.jpg

Note: There is a size difference between the original 9mm 160GB (left) and the 12.5mm 500GB (right) drives but the new 500GB drive fit perfectly in the 17″ Macbook Pro case.  Some visitors have asked about 15.4″ cases but everything I have read online says there is not enough height in the 15.4″ MBP drive bay to accommodate the 12mm drives.

CIMG3049.jpg
Below is a picture of the newly installed drive.  As you can see there is enough room for the additional height of the 500GB 12mm drive.
CIMG3053.jpg

Just place the ribbon connectors back over your new hard drive and reconnect the hard drive ribbon cable back to the motherboard.

CIMG3052.jpg
The drive ribbon cable easily connects back onto the circuit board located immediately below the left cooling fan.
CIMG3054.jpg

Step Eleven:

Reconnect the Keyboard assembly back onto the Motherboard.  Remember that you can’t stand the keyboard assembly straight up so you will have to hold the keyboard at a slight angle while you connect the ribbon cable back to the bottom portion of the notebook.

CIMG3056.jpg

Lower the top assembly back down and put your screws back in reverse order to patch things up.

By

Moving OS X and Boot Camp partitions to a new higher capacity hard drive

The original HD that came with my Macbook Pro was a 160G 7200RPM Segate and suited my needs well. I had two partitions split about 50/50 between OSX and Vista via Boot Camp (~74GB-Vista) and 75GB-OS X). The solution was great as I was able to access my Vista partition through VMWare Fusion when running OS X and was able to boot straight into Vista when I needed to. I’ve had my Macbook Pro for about a year and have purchased and configured a variety of software for both Vista and OS X and was quickly running out of space to the point I couldn’t boot my boot camp partition via VMWare Fusion because I didn’t have more than 2G of available hard drive space. This quickly became a problem and moving files to and from my HD became too much of a chore so I decided to upgrade my hard drive rather than repartition OS X and take additional space from the Windows partition. There were several examples of how to backup and restore OS X HFS formatted partitions but only some untested suggestions on how to accomplish moving a boot camp NTFS formatted partition, so I thought I would share with you what I did to successfully upgrade the HD in my Macbook Pro and migrate the partitions to the new drive.

I’ll be making a separate post of what I did to upgrade the Hardware but below are the steps I took to backup and restore my system to the new hard drive:

What you need:

  1. Carbon Copy or SuperDuper for Backing up and restoring OS X volumes. Both work great!
  2. Winclone for backing up and restoring your Windows NTFS partition.
  3. Boot Camp Assistant for partitioning your new hard drive.
  4. A new higher capacity SATA hard drive and enclosure that you can put it in. I bought the Thermaltake BlacX hard drive dock which allows me to slip in any 3.5″ or 2.5″ Serial ATA Hard Drive for approx. $34.  My drive of choice for my 17″ Macbook Pro was the 500GB Hatachi 5K500 which I got for about $230.

First Step:

Connect your new hard drive to your existing Mac. We will be erasing all data on this drive so be sure you don’t have anything you want to keep on this drive. I had already formatted it in Mac OS Extended (journaled) using Disk Utility but this may be an unnecessary step but for consistency sake this is what I did.

Open SuperDuper! and in the first drop down list next to Copy choose your source volume or your existing Macintosh HD. In the next drop down choose your backup hard drive.

SuperDuper!.jpg

Make sure that the “Backup – all files” option is selected next to using. This will erase your external drive and begin to backup your current OS X volume and make the external drive bootable.  Note that the entire drive or partition is used for this step.  So at this point I had a single 465GB OS X partition after everything was said and done.

After this is complete I would ensure that you can boot to your newly cloned OS X drive by rebooting and holding down the “option” key on your keyboard during the boot process. When you are presented with the available boot device options choose the external drive you just cloned.  Make sure the drive boots up successfully before moving forward otherwise you may have trouble getting your system working when you physically install this new drive into your Mac.

Second Step:

Open Winclone and choose your current boot camp partition from the drop down list. My boot camp drive  was titled “UNTITLED” (Note the image below shows new HD not my old 75GB partition…I upgraded my windows partition for more storage but we’ll get to that in a bit).

WincloneHD_Resize.jpg

Click on the “Image…” Button to start the backup process. You will be prompted for a location. I chose to store this file on the external drive formatted as HFS (Mac OS Extended (Journaled) from earlier.  What Winclone does is creates a single file consisting of all the data in your NTFS partition. (Note: Winclone now backups NTFS and FAT according to their site so backing up either should work for you). So, you need to make sure that the drive you are backing up to supports file sizes greater than 4GB which HFS+ does so we are in good shape. Once you have chosen the name and location for your backup file let this application work through your partition and create the single image of your Windows parition. The larger your partition the longer it will take.  For my 75G (60 Used) it took about 2 hours over a USB 2 connection.

Third Step:

With a copy of both your OS X partitions and Windows partitions you can shutdown and replace your current HD with your cloned HD. There are several sources that describe how to do this, like ifixit.com, but I’ll post my own efforts in another post.

With your new replacement hard drive installed and your Macbook all buttoned up your system should boot as it did before the upgrade.  If your Windows backup image from Winclone is on the same drive you just replaced then you are free to move to the next step.  Otherwise just connect a different drive with your Winclone image we performed in the previous step to prepare the next step of restoring your boot camp partition.

Fourth Step:

With your new drive installed and working properly with OS X you now need to re-partition your new drive using boot camp as you did initially when you first installed boot camp on your Mac.
Launch the Boot Camp Assistant and proceed to create your new boot camp partition.

2-Boot Camp AssistantHD_Resize.jpg

I decided that I would give my Windows volume a little more space so I expanded it from the original ~74G to 101G.  I simply moved the slider in the middle of these two drives to the left until I felt I had a big enough partion for both OS X and Vista.  My original boot camp share was ~74G with 15G available.  I work a lot in Windows sometimes for work so I wanted to ensure I gave myself enough room to install other software and keep files in this partition if I needed to so I increased the portion from my original 74GB to 101GB.  When you are ready just click on the “Partition” button.  The partitioning is fairly quick.  When you are done you will see the dialog box below…

3-Boot Camp Assistant-1HD_Resize.jpg

Since we are restoring and not re-installing Windows choose the Quit & Install Later button.  You now have a complete boot camp ready partition to restore your old boot camp partition to.

Fifth Step:

Now we are ready to restore your Windows partition you backed-up earlier using Winclone.

Open Winclone and choose Restore at the top of the application screen.

6-Winclone-1HD_Resize.jpg

Select where your Restore Image is located by clicking on the “Select Image” button. Remember this can be local on your newly installed HD or come from a different external HD you put your backup image on.

The Destination location will be the newly created BOOTCAMP partion we just created.  Click on the Restore Button and be patient as the data gets restored back to your new Boot Camp partition.

After this is finished you are almost done… If you are like me an use VMWare to run your Windows partition as a virtual machine in OS X you need to make another step to get things working properly. If you try to boot your newly restored windows partition VMWare fusion will give you an error stating it can’t find the boot camp volume; least this is what happed to me.   After checking that everything worked by booting into Windows directly by holding down the option key during a reboot and choosing Windows I looked for another solution.  I found that if I removed the directory “Boot Camp” in Documents/Virtual Machines/ within OS X I was then able to boot into the new partition.

Overall the entire process took 4 hours to do the backups of OS X and boot camp partitions, about :30 minutes to do the hard drive replacement, and another four hours for the repartitioning and restore to complete but given the additional hard drive space 160GB -> 500GB it was well worth the effort considering I didn’t have to reinstall any operating systems or software and I let most of the backups and restores run while I was off playing with the kids or sleeping.  The best part was not having to go through the long process of re-authorizing my Vista OS or Office software on my windows partition. I picked up right where I left off on both systems.

I’ve finally got the space I need to keep my media and applications flowing smoothly and will probably move my Linux virtual machines back to my laptop instead of keeping them on a separate hard drive. Good luck with your installation!

Update:  I was experiencing a considerable slowdown when running the virtualized boot camp partition after this was finished however after a little digging I discovered that my virtual session was only allocating 512MB of RAM not the typical 2GB I had originally assigned before the transfer.  This occured when I deleted and re-added the boot camp profile.  VMWare uses this as a default value for new virtual machines.  So just be sure that you assign the proper amount of RAM back to your Virtual Machine when everything is said and done.