Saturday, December 8, 2012

Add physical disk to VMware Fusion guest OS

This was not a big deal on VMware Workstation on my old Windows laptop, however today I realized that I'm unable just to add any external physical hard drive (attached to one of the USB ports) to VMware Fusion on my Mac.

After a few minutes of goggling, I realized that I have to create a .vmdk file that will represent a connection to my external hard drive and then add it to my guest OS container.

So, here is a step-by-step guide about how to add a physical HDD or SSD to your guest OS under Mac OS X 10.8 (should be work fine on 10.7 and 10.6 I suppose):
  1. First of all we should to figure out our hard drive name:
    1. launch Disk Utility (select Finder, click on the Go menu, select Utilities, launch Disk Utility.app)
    2. select your hard drive and press Info button on the top-left.
    3. remember Disk Identifier specified in the Information window ("disk1" in my case).
  2. Fire up Terminal.app (it is also located in the Utilities folder)
  3. Change current directory in Terminal to the WMware.app Contents/Library folder (you can simply copy and paste the following line: cd "/Applications/VMware Fusion.app/Contents/Library/")
  4. Now we should create a .vmdk file that will point to our external hard drive:
    1. paste the following line into the terminal (change disk1 to the disk name you've found in the step 1):
      ./vmware-rawdiskCreator create /dev/disk1 fullDevice ~/external-hdd ide
    2. This will create a new external-hdd.vmdk file in your home folder.
  5. OK, we're almost done. Now let's find our VMware guest os container and add to it just created link to our hard drive.
    1. open Finder and go to a folder where your virtual machines are located. (Documents › Virtual Machines in my case)
    2. do a right click on desired Virtual Machine to display a pop-up menu, select "Show Package Contents" this will allows us to view a directory with all corresponding files to this VM.
    3. move or copy external-hdd.vmdk from your home folder into this one
    4. do a right click on a file named like current VM with .vmx extension, select Open With › TextEdit
    5. scroll to the end of file, add following lines:
      ide1:1.present = "TRUE"
      ide1:1.fileName = "external-hdd.vmdk"
    6. save and quit
  6. That's it, now you can launch VM with attached external HDD or SDD!
BTW: If you want to boot from the external hard drive you've just attached, you have to modify boot order in the VMware BIOS.

If you know easiest way to do the same task, share it in the comments.

20 comments:

  1. Nice writeup!

    My external USB drive has 4 partitions, only one of which I'm trying to use to boot my ML VM guest. At first I tried just adding the one partition, but Disk Utility couldn't set the Startup Disk (could not bless). So I went back and followed your instructions more closely, and now all 4 partitions are available and I can choose the Startup Disk.

    I am prompted for my password every time - 'VMWare Fusion requires administrative privileges for accessing Boot Camp disks'. And when I start the VM the partitions are unmounted from my host.

    Works for me!

    thanks,

    chris

    ReplyDelete
  2. Awesome Jack!

    I had my old MBP HDD running externally that already had a very limited partition of Win7x64 through Bootcamp and my older Snow Leopard OSX, and was using the docked Bootcamp section with VMWare Fusion through my new MBPr Mountain Lion.

    I needed to desperatly expand the Windows partition so I made a WinClone copy of the Win7x64 section, removed the external Bootcamp partition and Snow Leopard through disc tools within OSX Mountain Lion, reinstalled the Win7 through WinClone but could not get VMWare Fusion to recognize the external OS.

    After searching for some time, I finally stumbled on your writeup and it set me straight so now everything is working as it should.

    Thank you for making my day and for the fantastic writeup!

    //Mark

    ReplyDelete
  3. I successfully added a hard drive to a Win7 Guest OS and used it for several days with a video server app. After time the virtual image grew to around 400GB and eventually stopped the system from working. Did I miss something in the install?

    Thanks,
    John

    ReplyDelete
  4. Worked well I'm writing a shell script to do this all for me. I will post it when it's done. You will have to unmount the disk in disk utility before vmware will get access to it. You can fix the issue with have to type your password everytime I believe by doing a chown "youruser" on the rawdisk.vmdk file that you create.

    ReplyDelete
    Replies
    1. Still trying to get this to work. I checked the ownership of the externaldisk.vmdk and it shows that the admin user is the owner ls -al (admin:staff) - Were you able to get this to work without the admin prompt popping up every time you boot? In a VMWARE post someone states you can actually disable the prompt but I have not figured out how. Any input would help thanks!
      https://communities.vmware.com/message/2280205

      Delete
    2. NM I found it. Menu: Virtual Machine: Settings: Advanced: Administrative privileges for bootcamp disks: Never ask - now I don't get prompted on boot.

      Delete
    3. I couldn't find it when I went to settings advanced. Using vmware 7.1.1

      Delete
  5. This will save my live for running VM at Mac from my HDD

    ReplyDelete
  6. Ok - I am trying to use an existing USB 3.0 bootable drive AS the boot disk and cannot seem to find how to BOOT from the external physical disk.
    Is there a way of setting the BOOT device to a USB drive?

    ReplyDelete
  7. "unable to copy the source files to the destination files." - when i run "/Applications/VMware\ Fusion.app/Contents/Library/vmware-rawdiskCreator create /dev/disk4 fullDevice /Volumes/DATA/VMware/External/external_drive ide"
    anybody know what to do?

    ReplyDelete
  8. I liked the content on this site. Would like to visit again.

    Hand Therapy CT & Work Injury Therapy

    ReplyDelete
  9. If guest OS used AHCI:
    Create custom VM with new disk. In advanced options change bus type to SATA.
    And replace in your vmx file:
    sataX:Y.fileName=”external-hdd.vmdk”

    ReplyDelete
  10. VMware Fusion 7 just complained that I had a IDE slave without a master, so I had to change to this to make it work:
    ide1:0.present = "TRUE"
    ide1:0.fileName = "external-hdd.vmdk"
    Oh, and thanks A LOT for this post!

    ReplyDelete
  11. Also don't forget to add the this string:

    firmware = "efi" )

    ...if your IDE Drive was previously configured with UEFI firmware. I also had to change my ide settings, b/c I was not using the extra vm scsi disk.

    ide1:0.present = "TRUE"
    ide1:0.fileName = "external-hdd.vmdk"

    Again, thanks for this great trick, I'm now running a Hackintosh on my ASUS laptop with the use of it stock drive in VMWare Fusion! Your Rock my friend!

    ReplyDelete
    Replies
    1. correction - its: firmware = "efi"

      butt dialed the extra ")" character... :-)

      Delete
  12. Newbie question: I can remove the physical disk from VMWare and access it directly at a later date? (assuming the OS/filesystem is the same)

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Worked fine but then the grey Apple showed up. Then: spinning wheel and finally, barred circle ("prohibited sign").
    Tried different solutions. None of them worked.
    VMware Fusion 8.5, OS X 7.5 (guest system), host: El Capitan.

    ReplyDelete
  15. What a fucking king. Can't believe the shit UI can't offer that. Add disk, add existing disk, add your mother. 5 hours later. I discovered I was fine accessing it if it was connected as an external disk with an USB cable, but if it was internal it just costed me time and money. Fuckkkkkkkkkkkkkkkkkkkkkkkkkkkkk!

    Should be ide1:0.present nowadays though:

    ide1:0.present = "TRUE"
    ide1:0.fileName = "../mount/external-hdd-SP1.vmdk"

    ReplyDelete