==================================================
SOLVED - Quick Successful Virtualization of Physical Server to Run in VirtualBox
(Based on Above Posts in this Thread)
==================================================
1. From your workstation that will run the VirtualBox virtual machine, ssh to the physical server and dd the file server_disk.img back to your workstation:
(Many thanks to danbi for the command!)
Code:
$ ssh root@server dd if=/dev/ad0 bs=128k > server_disk.img
2. On your workstation convert the server_disk.img file to virtual_disk.vdi with:
(If your .img file is big this will take a few minutes to convert to .vdi.)
Code:
VBoxManage convertfromraw -format VDI server_disk.img virtual_disk.vdi
3. Create a virtual machine in VirtualBox to represent your physical server using the virtual_disk.vdi as the hard disk, and boot!
If the virtual machine doesn't boot to the FreeBSD install imaged from your physical server, this may be caused by an option that you have or haven't ticked in the VirtualBox Settings for your VM.
Troubleshooting in VirtualBox Settings
------------------------------------------------
In the System settings, make sure you have ticked the option for hard disk to boot (first), and below this make sure you have ticked the Hardware clock in UTC time option.
I unticked all the Acceleration settings options, though these may work for you.
In the Network settings I chose Bridged Adapter to give the VM access to the net and allow ssh to and from the host OS (OS X), though I probably should have selected NAT and tweaked this somewhere.
To first get the VM to boot properly I've tried to keep my virtual machine settings as simple and as close to my original server settings as possible, and thereafter will experiment with settings to optimize them.
If anyone has any methods, tips, etc from their virtualization of servers for VirtualBox, please add to this thread.
I hope this simple virtualization method works for you!
nx
==================================================

Many thanks to vermaden, danbi, and wblock!
@danbi
That's an awesome explanation of backup/imaging/restoration methods and the differences between them!
I've used dump/restore before but haven't yet had time to get rsync working. Thanks for the reminder. I'm keen to give it another try after reading your post.
Your ssh dd command worked perfectly for me - obvious from my post above the line - and allowed me to solve the first question I started this thread with. Woohoo!
Many thanks again!
@vermaden
I first tried your dd method, unfortunately only with partial success (due to a mistake on my part), by using:
Code:
1. # sysctl kern.geom.debugflags=16
Code:
2. # dd < /dev/ad0 bs=8M | ssh -c blowfish root@vm "dd > /dev/ad0 bs=8M"
which replicated the server to the virtual hard disk, but gave too many errors on boot for me to fix correctly, mostly likely caused by me creating the virtual hard disk to be too small by 1 or 2 megs.
I would like to revisit this approach again and do it right, and I would like to try the other methods you have described, as I'm sure they will be very handy when I'm not so time constrained in the future.
Thanks for presenting these alternative methods so promptly. I wish I knew more to use them sooner.
(It takes just over 2hours per ssh dd operation, so I'm using the method that works for me for now.)
Many thanks again!
@wblock
Your excellent page explaining
Disk Setup on FreeBSD cleared up my confusion about mounting new file systems, and your style of documentation is second to none. Please write more often!
Thank you for contributing the method of creating an empty image file and using this to mount individually dumped partitions. When I'm more confident I will certainly give this a try as I already have individual partition backups of my servers.
And thanks for reminding me to turn the 'safety switch' off to use dd by with sysctl.
Many thanks again!
I hope this thread helps a lot of others. It certainly has helped me.
Again, if others have any info from their virtualization of FreeBSD servers for VirtualBox, please add to this thread.
Thanks,
nx