Fri Jan 30 15:09:48 ICT 2015

How-to clone a FreeBSD virtual machine on VMware

There is no free tool to clone a FreeBSD virtual machine on VMware.

Instead, one can do the following:

  1. create the virtual machine with vSphere client
  2. boot the virtual machine using FreeBSD live CD
  3. partition the disk in FreeBSD
  4. enable and start the network interface:
    ifconfig en0 inet 192.41.170.xxx netmask 255.255.255.0
    
  5. in the source FreeBSD machine: in /etc/ssh/sshd_config, add the line:
    PermitRootLogin yes
    
    and restart sshd:
    /etc/rc.d/sshd restart
    
  6. make sure that dump and restore will have enough temporary storage:
    export TMPDIR=/mnt
    
  7. mount the root file system on the target machine:
    mount /dev/xxx /mnt
    
  8. copy the file system using dump and restore:
    cd /mnt
    ssh root@192.41.170.xxx "dump -u0 -f - -L filesystem" | restore -r -f -
    cd /
    umout /mnt
    
  9. repeat for each file system
  10. in the source FreeBSD machine: in /etc/ssh/sshd_config, remove the line PermitRootLogin yes and restart sshd:
    /etc/rc.d/sshd restart
    
  11. configure the Ethernet devices on the target FreeBSD
  12. configure the bootloader:
    mount /dev/root filesystem /mnt
    gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptboot -i 1 disk device
    
  13. update /etc/fstab in the target FreeBSD

Posted by Olivier | Permanent link | File under: administration, vmware, freebsd