VMware Communities
TheoGoldin
Contributor
Contributor
Jump to solution

Access Physical Disk from VM on USB OS X Boot Disk

In order to perform drive repair and maintenance on an internal OS X hard drive, I would like to be able to:

1) Boot off an external (USB) drive into OS X (which I can do, using a clone of a working OS X installation and pressing the Option key when booting, then selecting the USB disk as the boot disk).

2) Run VMWare Fusion 2.x (which works fine).

3) Load a DOS VM and run Spinrite off of the CDROM drive (which works fine and can access any drive attached to the VM), and

4) Give Spinrite (which is running in the VM off the USB drive) access to the internal physical hard drive on the Mac (this is where I need some instructions).

Its easy to attach external USB drives or internal IDE drives (CD ROM) to the VM, but the Fusion interface does not provide an option for attaching an internal hard drive to the VM. I need to give Spinrite access to the physical drive, not to a shared folder or a single partition, but to the physical drive.

I've seen some posts that are oriented towards people who are using bootcamp to run VMWare from a physical partition, but that is not my situation. I can run VMWare off of an OS X virtual disk with no problem. The issue is how to give the VM control over the internal physical hard drive rather than to let OS X have control over it. I would greatly appreciate it if someone knows how to do this or could think it through.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
WoodyZ
Immortal
Immortal
Jump to solution

I'm going to provide this following information strictly as a proof of concept however I strongly advise not running low level disk utilities such as this through a Virtual Machine on a Raw Disk and if you choose to ignore this then at a minimum make sure all User Data has been backed up and that the computer is connected to an Uninterrupted Power Supply and have nothing more than what's necessary to be running and do not use the computer for anything else during the process.

Using my MacBook Pro which has a 120GB hard drive I booted using an external FireWire drive that had OS X 10.5 and VMware Fusion 2.0.4 and I manually created a virtual hard drive that pointed to the internal hard drive as a raw disk.

The attached file SpinRite.zip contains three files, SpinRite.vmx (the virtual machines configuration file), RawDiskN.vmdk (the virtual hard drive that will need to be edited to match your case use scenario) and SpinRite.nvram (the virtual machines BIOS that is set to boot the CD first.).

Another word of caution is in order and that is Apple does not guarantee the BSD Name of the disk between reboots and therefore the configuration information within the RawDiskN.vmdk as far as the disk number may not remain accurate between reboots of the Host.

To determine a couple pieces of information necessary in the RawDiskN.vmdk file I use the following command in a Terminal (/Applications/Utilities/).

sudo fdisk /dev/disk0 | grep Disk

And on my system the output was as follows:

You can compare the information in the RawDiskN.vmdk file and see where the information in the above output is plugged into that file and then replace my output with the output from yours. The image above and below highlights the information comparing the output of the fdisk command and what needs to be set in the RawDiskN.vmdk file.

7859_7859.png

Also note that you must unmount the target disk before starting the Virtual Machine and you also will be prompted for a password as the Virtual Machine is started.

(In the above image the Virtual Machine was booted from a SpinRite Floppy Disk Image however it will also boot with the CD/DVD using an ISO Image or Physical Optical Media.)

Again let me make this perfectly clear that if you choose to do this it is totally at your own risk and you have been warned!!!

File Attached: SpinRite.zip

Message was edited by: WoodyZ - Updated SpinRite.vmx in SpinRite.zip.

View solution in original post

0 Kudos
7 Replies
WoodyZ
Immortal
Immortal
Jump to solution

From GRC...

"It can even be used to repair and recover Apple Macintosh and Tivo hard drives by temporarily moving them into an Intel-based PC."

That said, even if you wanted to consider that an Intel-based Mac was compatible then I would just boot natively and directly from the CD and not bother going through a Virtual Machine.

0 Kudos
TheoGoldin
Contributor
Contributor
Jump to solution

I would love to be able to boot off the Spinrite CD instead of using a VM, but the Spinrite CD can't boot an Intel-based Mac, presumably because it requires a BIOS, which the Mac does not have. I would like to be able to use Spinrite on the internal drive without having to remove the drive and put it in a PC. It seems like this should be able to work in a VM, but I'm not having any luck getting access to the internal drive from the VM. Alternately, if you know how to make a CD that will boot DOS on an Intel Mac, that would work I think. BTW, Spinrite uses FreeDOS as its OS.

0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

I'm going to provide this following information strictly as a proof of concept however I strongly advise not running low level disk utilities such as this through a Virtual Machine on a Raw Disk and if you choose to ignore this then at a minimum make sure all User Data has been backed up and that the computer is connected to an Uninterrupted Power Supply and have nothing more than what's necessary to be running and do not use the computer for anything else during the process.

Using my MacBook Pro which has a 120GB hard drive I booted using an external FireWire drive that had OS X 10.5 and VMware Fusion 2.0.4 and I manually created a virtual hard drive that pointed to the internal hard drive as a raw disk.

The attached file SpinRite.zip contains three files, SpinRite.vmx (the virtual machines configuration file), RawDiskN.vmdk (the virtual hard drive that will need to be edited to match your case use scenario) and SpinRite.nvram (the virtual machines BIOS that is set to boot the CD first.).

Another word of caution is in order and that is Apple does not guarantee the BSD Name of the disk between reboots and therefore the configuration information within the RawDiskN.vmdk as far as the disk number may not remain accurate between reboots of the Host.

To determine a couple pieces of information necessary in the RawDiskN.vmdk file I use the following command in a Terminal (/Applications/Utilities/).

sudo fdisk /dev/disk0 | grep Disk

And on my system the output was as follows:

You can compare the information in the RawDiskN.vmdk file and see where the information in the above output is plugged into that file and then replace my output with the output from yours. The image above and below highlights the information comparing the output of the fdisk command and what needs to be set in the RawDiskN.vmdk file.

7859_7859.png

Also note that you must unmount the target disk before starting the Virtual Machine and you also will be prompted for a password as the Virtual Machine is started.

(In the above image the Virtual Machine was booted from a SpinRite Floppy Disk Image however it will also boot with the CD/DVD using an ISO Image or Physical Optical Media.)

Again let me make this perfectly clear that if you choose to do this it is totally at your own risk and you have been warned!!!

File Attached: SpinRite.zip

Message was edited by: WoodyZ - Updated SpinRite.vmx in SpinRite.zip.

0 Kudos
TheoGoldin
Contributor
Contributor
Jump to solution

Woody, thanks very much for taking the time to answer this question and illustrate how I can apply it to my disk. I have confirmed that this works!

Based on some of your other posts, I assumed that in addition to what you said above, I should also add the following lines to the SpinRite.vmx file:

snapshot.disabled="TRUE"

suspend.disabled="TRUE"

0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

Woody, thanks very much for taking the time to answer this question and illustrate how I can apply it to my disk. I have confirmed that this works!

Your welcome and I'm glad it worked for you and I hope you understand that the cautionary tone in my post is necessary as this type of scenario is outside of the normal case use due to its advanced nature should only be preformed by those that understand the risks and are comfortable taking them. Smiley Happy

Based on some of your other posts, I assumed that in addition to what you said above, I should also add the following lines to the SpinRite.vmx file:

snapshot.disabled="TRUE"

suspend.disabled="TRUE"

You should only need to add "suspend.disabled="TRUE"" because the "ide0:0.deviceType = "rawDisk"" parameter disable the ability to take a Snapshot,

Note: I've updated the SpinRite.vmx in SpinRite.zip to include the "suspend.disabled="TRUE"" and thanks for the catch as this is another reason why this should only be done by those comfortable taking risks.

0 Kudos
palba
Contributor
Contributor
Jump to solution

HI,thanks for this great topic!

Just few questions. Can I apply this technique at an external esata mac disk?

From your experience could spinrite fix a disk that has many files unvisible?

My disk seem to work properly but is completely empty.

It's a 500Gb disk with only 75Gb of free space.

Something is in it!

Many thanks in advance for any suggestion!

Paul

0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

palba wrote:

My disk seem to work properly but is completely empty.

It's a 500Gb disk with only 75Gb of free space.

Something is in it!

If there is nothing on the drive then have you tried removing/creating the partition using Disk Utility?  Or are you attempting to try and recover what's not showing but taking up the space?

0 Kudos