From owner-freebsd-questions@FreeBSD.ORG Mon Apr 6 19:00:37 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B852373 for ; Mon, 6 Apr 2015 19:00:37 +0000 (UTC) Received: from smarthost1.sentex.ca (smarthost1.sentex.ca [IPv6:2607:f3e0:0:1::12]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "smarthost.sentex.ca", Issuer "smarthost.sentex.ca" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 393E6378 for ; Mon, 6 Apr 2015 19:00:37 +0000 (UTC) Received: from [IPv6:2607:f3e0:0:4:f025:8813:7603:7e4a] (saphire3.sentex.ca [IPv6:2607:f3e0:0:4:f025:8813:7603:7e4a]) by smarthost1.sentex.ca (8.14.9/8.14.9) with ESMTP id t36J0YHZ028203; Mon, 6 Apr 2015 15:00:34 -0400 (EDT) (envelope-from mike@sentex.net) Message-ID: <5522D7DA.7070304@sentex.net> Date: Mon, 06 Apr 2015 15:00:42 -0400 From: Mike Tancsa Organization: Sentex Communications User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: David Newman , freebsd-questions@freebsd.org Subject: Re: creating a virtual clone References: <5522C5DE.1050005@networktest.com> In-Reply-To: <5522C5DE.1050005@networktest.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.75 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2015 19:00:37 -0000 On 4/6/2015 1:43 PM, David Newman wrote: > To test some new software, I'd like to replicate a 9.3-RELEASE machine > and run it as a virtual machine (in this case inside VMware vSphere, but > I'm open to using other hypervisors if this isn't possible with VMware). > > The 9.3 host is itself virtual, running as a VPS instance in a colo. > > What's the best way to do this? Not sure the best way to convert directly to VMWare, but if you have a spare machine with VirtualBox on it, you can use its tools to create a .ovf file which you can then import. (there might be a similar tool on VMWare). I just did one from dump files not too long ago. You could use dd, but the nice thing about dump is, you can size the disk to what you want. truncate -s10G importfile.dd mdconfig -t vnode -f importfile.dd gpart create -s mbr md0 gpart add -t freebsd md0 gpart set -a active -i 1 md0 gpart bootcode -b /boot/mbr md0 gpart create -s bsd md0s1 gpart bootcode -b /boot/boot md0s1 gpart add -t freebsd-ufs -s 1G md0s1 gpart add -t freebsd-swap -s 1G md0s1 gpart add -t freebsd-ufs -s 2G md0s1 gpart add -t freebsd-ufs md0s1 newfs -U -O1 /dev/md0s1a #O2 for RELENG7 and above newfs -U -O2 /dev/md0s1d newfs -U -O2 /dev/md0s1e mkdir /mnt/root mkdir /mnt/usr mkdir /mnt/var mount /dev/md0s1a /mnt/root/ mount /dev/md0s1d /mnt/var mount /dev/md0s1e /mnt/usr cd /mnt/root gzcat /backups/dump-root0.gz | restore -rf - cd /mnt/usr gzcat /backups/dump-usr0.gz | restore -rf - cd /mnt/var gzcat /backups/dump-var0.gz | restore -rf - # You might need to adjust /mnt/root/etc/fstab to reflect the new locations umount /mnt/root umount /mnt/var umount /mnt/usr mdconfig -d -u -0 Then lets convert the file VBoxManage convertfromraw importfile.dd target.vdi --format VDI Now we create the VM and attach the disk. Easiest is through the web/gui interface new VM BSD 32bit BSD (or 64 if its a 64bit image) Use existing HD, and point it to target.vdi You can then export, or try importing the .vdi directly into vmware as a disk ---Mike -- ------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada http://www.tancsa.com/