# migrate physical freeBSD to virtual



## ccc (May 30, 2010)

hi

Howto migrate physical freeBSD to virtual in VMWARE?
I have freeBSD 7.0 and ESX3.5 Update2.


----------



## ptempel (May 30, 2010)

You could try cloning the disk to the VM using dump and restore like so:

http://tomclegg.net/freebsdclone

I have also copied filesystems with tar over ssh.  Assuming you want to copy /var, then:


```
pchost# cd /var
pchost# tar cfpB - . | ssh vmhost "(cd /new/mount/point/var; tar xfpB -)"
```

but you would have to do a few things before this:

- boot the DVD/CD in fixit mode
- ifconfig the network connection
- run disklabel to partition the disk
- run newfs to make new filesystems on each partition
- mount the new filesystem

before this would work.


----------



## ccc (Jun 1, 2010)

Thx, but what about create an image using FreeBSD Live and dd command?


----------



## dennylin93 (Jun 2, 2010)

dd() just copies the data directly from the disks. Don't think it would work.


----------



## wblock@ (Jun 2, 2010)

dd will work, but has some downsides.  The image produced will be exactly the same size as the whole original disk.  Since the original disk is likely not entirely full, you end up copying a lot of blank space and end up with a huge image.  This is particularly bad with dynamic-sized image files used by VMs.

dump and restore are the way that will let you create a differently-sized target and copy the system over to it.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/backup-basics.html#AEN25848 gives the basics.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#NEW-HUGE-DISK is related, and really what is being done.  Although the new disk might actually be smaller than the original.


----------



## ptempel (Jun 2, 2010)

dennylin93 said:
			
		

> dd() just copies the data directly from the disks. Don't think it would work.



I have used dd before with netcat (nc) to clone one system to another.  But this is only useful for two identical systems with the same size hard disk.  Since the OP mentioned going to a different system (VMWare), I didn't offer this.  Two examples where I used dd was to build 14 Sun Netra boxes (all with same disk) and to rebuild an IBM Blade system by cloning from another identically setup blade.  So I know it works but could take over 2 hours depending on how large the disk you're cloning from/to is.


----------

