Too bad all the tool for converting a physical server into a virtual server run on Windows or Unix.
Wenn, actually there is (quite) a simple way to do this. This method is independent of any product and can be used with any virtualization such as Parallels, VMware.
Just follow these steps:
On you physical server:
- Boot from an external volume and create a disk image of your server using 'Disk Utility'.
- After the disk image has been written, mount it and verify that it can be read and has all the data required on it.
- Select the image in the sidebar and run the menu 'Images > Scan Image for Restore'
- Turn off your physical server
- Copy your disk image to a server that is accessible via AFP
- Note down the address, path and the credentials needed to access this image via AFP.
- Create a new virtual machine for OS X.
- Make sure you have access to a bootable OS X media inside the virtualization. Normally this is done by using a disk image that is assigned to the virtual machine as a CD ROM drive. If you are unsure how to create such a medium, you can use an app like DiskMaker X to create a bootable USB stick from which you can create a bootable disk image.
- Create a HDD in the virtual machine that is large enough.
- Create a network interface that has access to a network, preferably one that assigns addresses via DHCP.
- Start the virtual machine
Inside the virtual machine:
- The VM will now boot using the disk image supplied. In this example I am using a bootable "OS X 10.9 Mavericks" but the same method works with other versions.
- Don't start the installation process!!! Remember: we want a virtualized copy of our physical server, not a new server
- From the 'Utilities' menu select 'Terminal'.
- Once the terminal is running make sure we have an IP address by typing 'ifconfig'. The line starting with 'inet' should now show a valid IP address.
- Now we need to mount our disk image. There is a little trick involved here. As we have to mount our server via command line, we need a folder to attach our mount to it. In order to do so, we need a writable directory.
- One directory that is writeable is the Trash. So we cd into that directory by typing the command 'cd Library/.Trashes'.
- We are now in the directory '/var/root/Library/.Trashes'. Check that it is writeable by creating a folder using the command 'mkdir mnt'. If you see this 'mkdir: mnt: Read-only file system' you have to find another folder that is writable. There is always one as the system itself need to write certain files.
- So once we have created our directory, we can mount the AFP share that host our disk image. This is done by issuing the command (by replacing 'myusername', 'myserver' and 'mysharedvolume' with you own data as noted above) 'mount_afp -i afp://myusername@myserver/mysharedvolume mnt'
- You are now requested for the password of the AFP user you use to mount the volume
- Once the volume has been mounted, you can verify everything is working by showing the contents of the mount volume by issuing the command 'ls -l mnt'.
- If your disk image is visible in here, we're almost done.
- Quit the Terminal
- Open 'Utilities > Disk Utility'
- Select the disk image of your virtual machine and go to the 'Restore' tab.
- In here, drag the disk you selected on the left that is now listed as 'Source' to the 'Destination field.
- Now we click on the button 'Image…' next to the 'Source' field. Here we select the image we created from our physical server that is now located on our AFP share we mounted in the steps above.
- Once this has been done, we can click on 'Restore'.
- The disk image of our physical server is now being restore to our virtual server.
- Once this has completed, we can quit 'Disk Utility' and go to 'Startup Disk…' that can be found in the menu under the Apple logo.
- Here we select our newly restored disk.
- Select 'Shut down' from the Apple menu
- Go to the settings of your VM and adjust network and RAM configurations as required. Detach the image file attached to the CD ROM drive.
- Start the VM.
- Et voilà ! An exact copy of your physical server is now virtualized.