From owner-freebsd-questions@FreeBSD.ORG Thu Sep 2 13:19:16 2010 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 AF4A610656E4 for ; Thu, 2 Sep 2010 13:19:16 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms16-1.1blu.de (ms16-1.1blu.de [89.202.0.34]) by mx1.freebsd.org (Postfix) with ESMTP id 2A3D88FC08 for ; Thu, 2 Sep 2010 13:19:16 +0000 (UTC) Received: from [193.31.11.193] (helo=current.Sisis.de) by ms16-1.1blu.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Or9hA-000632-KD for freebsd-questions@freebsd.org; Thu, 02 Sep 2010 15:19:12 +0200 Received: from current.Sisis.de (current [127.0.0.1]) by current.Sisis.de (8.14.3/8.14.3) with ESMTP id o82DJCux004398 for ; Thu, 2 Sep 2010 15:19:12 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by current.Sisis.de (8.14.3/8.14.3/Submit) id o82DJC14004397 for freebsd-questions@freebsd.org; Thu, 2 Sep 2010 15:19:12 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: current.Sisis.de: guru set sender to guru@unixarea.de using -f Date: Thu, 2 Sep 2010 15:19:12 +0200 From: Matthias Apitz To: freebsd-questions@freebsd.org Message-ID: <20100902131912.GA4381@current.Sisis.de> Mail-Followup-To: Matthias Apitz , freebsd-questions@freebsd.org References: <4C7241C2.2000305@otenet.gr> <20100823112621.GA4367@current.Sisis.de> <4C725BFC.90006@otenet.gr> <20100824084225.GA2160@current.Sisis.de> <4C739A78.4070303@otenet.gr> <20100827072416.GA2516@current.Sisis.de> <4C778001.3030809@otenet.gr> <20100830093112.GA3071@current.Sisis.de> <20100831131351.GA3592@current.Sisis.de> <20100901091649.GA3409@current.Sisis.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20100901091649.GA3409@current.Sisis.de> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 8.0-CURRENT (i386) X-Con-Id: 51246 X-Originating-IP: 193.31.11.193 Subject: Re: installing FreeBSD in VMWare-player X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 13:19:16 -0000 I wrote a small howTo for such a migration for others in the same situation. Comments/Impromvements are welcome; Thanks matthias $Id: moveFreeBSDintoVM.txt,v 1.2 2010/09/02 10:55:29 guru Exp $ How to move a complete FreeBSD installation into a VM Matthias Apitz 1. Preparations in the running FreeBSD system Save the current FreeBSD partition layout to paper, i.e. print: - /etc/fstab - output of 'df -kh' - output of 'bsdlabel ad8s4' (or whatever your disk is) so you later know the sizes you will need in the new VM. Reboot the system to single user mode, run fsck(8) in all file systems and mount them read only, while staying single user. Do dump(8) of all the partitions to some external media you later can use in the VM a) physically and b) could be mounted in FreeBSD. I used an USB disk with an UFS file system on it as /dev/da0s1a: # mount -t ufs /dev/da0s1a /mnt # dump -0au -f /mnt/usr.dump /usr # dump -0au -f /mnt/var.dump /var # dump -0au -f /mnt/root.dump / Finally shutdown the system. 2. Prepare the VM Attach resources big enough to reflect your real system to the VM. I used: RAM: 2 GByte IDE: 164 GByte (as one file in the host) Make sure that the VM's boot order is: 1st CD/DVD, 2nd disk, so you later can easy decide from where to boot by just attaching or not the CD/DVD to the VM, even if the disk has already a MBR. Copy an ISO image of the so called "FreeBSD livefs" to the host and attach this as CD/DVD to the VM 3. Partitioning of the disk This part is a bit tricky because the "FreeBSD livefs" does not really guide through it. Boot from "FreeBSD livefs" and - define country and keyboard - run "standard installation" from the menu - fdisk(8) the disk, use entire disk for FreeBSD - let it install FreeBSD's boot manager - partition the slice to the layout of your old system, i.e. to the following result: /dev/ad0s1a 1 GByte / /dev/ad0s1b 4 GByte swap /dev/ad0s1d 2 GByte /var /dev/ad0s1e 6 GByte /tmp /dev/ad0s1f (rest 146 GByte) /usr - commit the "last chance before scribbling on disk" The installer will now do the real fdisk(8) and BSD-label of the partitions. It will newfs(8) the above file system and try to install FreeBSD in it, which is not on the CD/DVD and which is not what we want. Answer all questions as "NO" to get finally back to the main menu of sysinstall(8) tool. Reboot again into the "FreeBSD livefs" and go to the fixit repair mode menu, start a shell. The above mentioned file systems are created fine and even the boot manager is fine in place (ofc it would not find anything to boot). The file systems are already polluted which things we don't want (because we later will restore from dumps). Run newfs(8) in all file system devices again: # newfs -m 0 -o space /dev/ad0s1a # newfs -m 0 -o space /dev/ad0s1b # newfs -m 0 -o space /dev/ad0s1d # newfs -m 0 -o space /dev/ad0s1e # newfs -m 0 -o space /dev/ad0s1f We now have clean file systems (and boot manager installed). 4. Restore the dumps First restore the old root file system using the booted "FreeBSD livefs", mount the new root as /mnt and the USB disk containing the dumps as /usb: # mount /dev/ad0s1a /mnt # mkdir /usb # mount -t usf -o ro /dev/da0s1a /usb # cd /mnt # restore rf /usb/root.dump # cd / # umount /mnt One could as well restore the other dumps the same way, but it's better to see if the new root file system already boot fine, because restoring the /usr dump will take many hours (in my case 9 hours for 120 GByte), Reset the VM (no need to worry, nothing is mounted), detach the CD/DVD and reboot the old/new root file system into single user mode. Remount the /root writable and restore the /usr dump: # mount -o rw / # mount -t usf -o ro /dev/da0s1a /mnt # mount /dev/ad0s1f /usr # cd /usr # restore rf /mnt/usr.dump (after 9 hours) # mount /dev/ad0s1d /var # cd /var # restore rf /mnt/var.dump Check and edit the /etc/fstab to reflect the new device names (in my original system the disk was /dev/ad0s8 and not /dev/ad0s1). Make /tmp writable for all users # mount /dev/ad0s1e /tmp # chmod 1777 /tmp The system is now installed and should be boot up fine to normal multi user mode, just reboot normally. 5. Final changes Edit some system files to reflect the new VM environment: /etc/rc.conf: - network interface is now em0, and not wlan0 /boot/loader.conf - sound (still not working) /etc/X11/xorg.conf - recreate the X11 config file the normal way install the vmware-tools for FreeBSD (still pending) 6. Some notes about performance The host is Dell Precision M4400 with Dual Core CPU of 3.09 GHz and runs Windows 7 Professional. It took 9h to restore a dump of /usr which was produced in ~2h. The compared write performance for a copy of a 8 GByte file is: native in the same hardware as well: $ date ; dd if=XPdisk of=XPdisk.copy ; date jueves, 2 de septiembre de 2010, 08:25:53 CEST 16777216+0 records in 16777216+0 records out 8589934592 bytes transferred in 419.996931 secs (20452375 bytes/sec) jueves, 2 de septiembre de 2010, 08:32:53 CEST VM: $ date ; dd if=XPdisk of=XPdisk.copy ; date jueves, 2 de septiembre de 2010, 08:25:17 CEST 16777216+0 records in 16777216+0 records out 8589934592 bytes transferred in 1491.054456 secs (5760980 bytes/sec) jueves, 2 de septiembre de 2010, 08:50:08 CEST i.e. 7 minutes ./. 25 minutes, three times slower. The boot times are like this (min:secs): 0:56 Windows 7 is ready for login 1:22 Windows desktop is up to launch VM 3:15 FreeBSD is booted to login: 4:42 KDE-3 desktop is up The felt performance in KDE (start of windows, terminals, Evolution, Firefox) is reasonable well. -- Matthias Apitz t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e - w http://www.unixarea.de/ Solidarity with the zionistic pirates of Israel? Not in my name! ¿Solidaridad con los piratas sionistas de Israel? ¡No en mi nombre!