Importing Solaris VMDK image into Virtual Box

Virtual Box 1.6 has been released and is no longer in beta for MacOS X.  One of the advertised features is the ability to import VMDK image files from VMware into Virtual Box.  Being the eternal optimist, I decided to try it.  How long could it take?  A few minutes maybe?  I have quite a few different VMs in Fusion and did this with Solaris 10 08/07.

Virtual Box is:

  • a type 2 hypervisor
  • Free
  • Open Source
  • supported on a variety of host OSes (Windows, Linux, Macintosh and OpenSolaris)
  • capable of running a variety of guest OSes
  • now owned and being developed by Sun Microsystems as part of the open source xVM family of virtualization products

The first part was easy. Extract the VMDK file and import it into Virtual Box

  • Right click on your chosen VM.  Choose "Show Package Contents"
  • Find a file with a .vmdk suffix.  Click once to select
  • Command-D (duplicate it) Wait a few minutes while Mac OS copies the multi-GB file
  • Drag the copied file to another location
  • Start Virtual Box
  • File > Virtual Disk Manager
  • Click Add.  Locate and select the copied .vmdk file. Click OK.
  • Create a New VM as usual using the added vmdk file
  • Boot the VM

That should have been it, right?  Unfortunately, after seeing the grub screen and attempting to boot Solaris, I entered an infinite loop of rebooting OS.  Obviously, it's mostly working but something is still wrong.  Luckily, inside of Sun, we archive our mail aliases and Rudolf Kutina had already posted a solution to the problem.

The rebooting sequence resulted from the fact that VMware Fusion emulates SCSI disks (c0t0d0s0) while VBox emulates IDE disks (c0d0s0).  Because of this, the Solaris device trees and vfstab mount entries are not correct.  Rudolf's solution is not for the weak of heart but DOES work.  After all, it's all just a virtual machine and if I screw it up, I just make another copy.  What have you got to lose?

  1. Boot into Solaris Safeboot mode. You can get access at the Grub menu, usually is the 2nd or 3rd option.
  2. Mount the found Solaris partition on /a , Safeboot will usually find the slice on the disk with Solaris and ask if you want it to mount on /a. Select Yes.
  3. Move /a/dev, /a/devices, and /a/etc/path_to_inst to another name (I just append .orig) and then create new directories, (mkdir) /a/dev and /a/devices, and touch file /a/etc/path_to_inst.
  4. Run "devfsadm -r /a" to rebuild the device tree
  5. set TERM so we can use 'vi', TERM=vt100; export TERM
  6. Now we need to fix boot disk patch changes Edit /a/boot/solaris/bootenv.rc and fix the line with "setprop bootpath '/pci@0,0....' to match the path you'll find mounted for /a (i.e. run a 'df -k' command, and you should see /a mounted from /dev/dsk/c1d0s0 or something, then run 'ls -l /dev/dsk/c1d0s0' or whatever your device listed was, and you should see the actual link point to ../../devices/pci@0,0/...ide..)
  7. Fix also disk naming in /a/etc/vfstab to match IDE "c0d0sx" scheme. Change each instance of c1t0d0s0 to c0d0s0 etc.
  8. Recreate archive "bootadm update-archive -v -R /a" to rebuild the boot-archive on /a
  9. Force to reconfigure on next boot with 'touch /a/reconfigure'
  10. Delete /etc/dhcp.e1000g0 /etc/hostname.e1000g0 create /etc/dhcp.pcn0.
  11. Run "cd /; sync; sync; sync; umount /a"
  12. reboot with 'init 6'

Enjoy your new Virtual Box machine.

Instructions are also available for importing a Windows XP .vmdk file to Virtual Box.

Comments:

would be good solution to explain how to boot Solaris 11 in safemode if GRUB has no relevant menu item

Posted by guest on October 02, 2013 at 10:37 AM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Jim Laurent is an Oracle Sales consultant based in Reston, Virginia. He supports US DoD customers as part of the North American Public Sector hardware organization. With over 17 years experience at Sun and Oracle, he specializes in Solaris and server technologies. Prior to Oracle, Jim worked 11 years for Gould Computer Systems (later known as Encore).

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today