From owner-freebsd-questions@FreeBSD.ORG Fri Nov 2 02:47:18 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4215216A419 for ; Fri, 2 Nov 2007 02:47:18 +0000 (UTC) (envelope-from dave.list@pixelhammer.com) Received: from smtp1.tls.net (smtp1.tls.net [65.196.224.82]) by mx1.freebsd.org (Postfix) with ESMTP id E14B113C465 for ; Fri, 2 Nov 2007 02:47:17 +0000 (UTC) (envelope-from dave.list@pixelhammer.com) Received: (qmail 20685 invoked from network); 2 Nov 2007 02:55:46 -0000 Received: by simscan 1.2.3 ppid: 20676, pid: 20681, t: 0.2383s scanners: attach: 1.2.3 clamav: 0.91.1/m:44/d:4654 spam: 3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on smtp1.tls.net X-Spam-Level: X-Spam-Status: No, score=0.2 required=20.0 tests=ALL_TRUSTED,TVD_RCVD_IP autolearn=disabled version=3.2.1 Received: from 208-70-44-170.bb.hrtc.net (HELO ?192.168.0.109?) (ldg@tls.net@208.70.44.170) by auth-smtp1.tls.net with ESMTPA; 2 Nov 2007 02:55:46 -0000 Message-ID: <472A9D99.7000102@pixelhammer.com> Date: Thu, 01 Nov 2007 22:46:33 -0500 From: DAve User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: 'User Questions' References: <003e01c81cf2$27ff3840$77fda8c0$@com> In-Reply-To: <003e01c81cf2$27ff3840$77fda8c0$@com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: Duplicate existing FreeBSD Server in VM X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2007 02:47:18 -0000 Terry Sposato wrote: > Hi, > > > > I have just installed a machine and have it setup running a web based CRM > solution. I want to have an exact duplicate of this machine running as a VM > for redundancy reasons. > > > > What is the best way to go about getting this exact machine transferred to > the VM? Both machines exist on the same network and will be able to talk to > each other, I have been thinking of a couple of different ways to get all my > data across which is the easy part, but I want to match everything that is > installed, base system, ports etc. > > > > Anyone have any ideas or point me into the right direction? > You can use dump over ssh easily enough, here are my notes from using it to create multiple production machines from a single test server. There are better ways I am sure, but this is quick and easy if you are familiar with FreeBSD installs. Note #1 In the first comment line I say to boot the live file system CD, that is what you would do in the VM, just as you would normally boot an installer CD, but use a Live filesystem CD instead. Note #2 I used several slices with sizes some may not agree with. It was a choice we made for various reasons, the servers have been running for three years. You may have more or less slices of varying sizes, adjust the steps below to your preferences. Note #3 You will need to check and WRITE DOWN which slice is which mount point, /, /var, /usr and so on. Your disks may be different if you choose not to create a seperate /tmp, or /var. I'll be out of the office for a week, but you can try and adjust as needed, it won't hurt anything and you can always overwrite and try again. WRITE IT DOWN. Works for us, I've used it several times, adjusting as needed for the system I am cloning. DAve ==================================================== # boot live filesystem cd # use disklabel to check/create slices /stand/sysinstall /dev/ad0s1b 256mb swap /dev/ad0s1a 256mb /mnt/ufs.1 softupdates /dev/ad0s1e 256mb /mnt/ufs.2 softupdates /dev/ad0s1d 256mb /mnt/ufs.3 softupdates /dev/ad0s1f all /mnt/ufs.4 softupdates /dev/ad1s1d 20000mb /mnt/ufs.5 # unmount the new slices umount /mnt/ufs.1 umount /mnt/ufs.2 umount /mnt/ufs.3 umount /mnt/ufs.4 umount /mnt/ufs.5 # make newfs on each slice newnfs /dev/ad0s1a newnfs /dev/ad0s1e newnfs /dev/ad0s1f newnfs /dev/ad0s1d newnfs /dev/ad1s1d # remount the slices mount -t ufs -o rw /dev/ad0s1a /mnt/ufs.1 mount -t ufs -o rw /dev/ad0s1e /mnt/ufs.2 mount -t ufs -o rw /dev/ad0s1d /mnt/ufs.3 mount -t ufs -o rw /dev/ad0s1f /mnt/ufs.4 # fetch the filesystems from the test server # you will need to enable root ssh access on the test server for this. cd /mnt/ufs.1 ssh root@10.0.240.130 dump -0L -f - /dev/ad0s1a | restore -rf - /dev/ad0s1a cd /mnt/ufs.2 ssh root@10.0.240.130 dump -0L -f - /dev/ad0s1e | restore -rf - /dev/ad0s1e cd /mnt/ufs.3 ssh root@10.0.240.130 dump -0L -f - /dev/ad0s1f | restore -rf - /dev/ad0s1f cd /mnt/ufs.4 ssh root@10.0.240.130 dump -0L -f - /dev/ad0s1d | restore -rf - /dev/ad0s1d # change the following entries in rc.conf, remember everything is mounted under /mnt! # X = the ecluster number 1,2,3,4,5,6,7,8, etc. hostname="new_server_X" ifconfig_em0="inet 10.0.240.13X netmask 255.255.255.0" Reboot the new server, it should come up just fine. -- Three years now I've asked Google why they don't have a logo change for Memorial Day. Why do they choose to do logos for other non-international holidays, but nothing for Veterans? Maybe they forgot who made that choice possible.