From owner-freebsd-questions@FreeBSD.ORG Thu Nov 19 13:51:44 2009 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 9F867106566B for ; Thu, 19 Nov 2009 13:51:44 +0000 (UTC) (envelope-from sonicy@otenet.gr) Received: from kane.otenet.gr (kane.otenet.gr [83.235.67.31]) by mx1.freebsd.org (Postfix) with ESMTP id 26FD58FC14 for ; Thu, 19 Nov 2009 13:51:43 +0000 (UTC) Received: from pulstar.local (athedsl-4487278.home.otenet.gr [94.71.68.118]) by kane.otenet.gr (8.13.8/8.13.8/Debian-3) with ESMTP id nAJDpgNj011174; Thu, 19 Nov 2009 15:51:42 +0200 Message-ID: <4B054D6D.9040304@otenet.gr> Date: Thu, 19 Nov 2009 15:51:41 +0200 From: Manolis Kiagias User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: n dhert References: <8021a2660911190504s65a197d7r60205a648f27c187@mail.gmail.com> In-Reply-To: <8021a2660911190504s65a197d7r60205a648f27c187@mail.gmail.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: moving an entire system 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: Thu, 19 Nov 2009 13:51:44 -0000 n dhert wrote: > I want to move the contents of a freebsd72 system entirely to different > hardware (also Intel 64-bit), using dump/restore > These are the filesystems now: > /dev/da0s1a 2026030 650876 1213072 35% / > /dev/da0s1e 20308398 652820 18030908 3% /tmp > /dev/da0s1f 95719170 12449998 75611640 14% /usr > /dev/da0s1d 20308398 2960282 15723446 16% /var > /dev/da1p1 2175407698 168279068 1833096016 8% /home > How should one proceed? I have an 286 Gb external USB disk formatted with a > single > slice large enough to hold all dumps of all fileystems, mounted on /seagate > /dev/da2s1a 283810126 12 260463064 0% /seagate > > a. put the original machine in single-user mode > b. use dump (could L be left out if machine is in single-user mode?) > yes > /sbin/dump -0aL -f /seagate/dumpofroot.dmp /dev/da0s1a > /sbin/dump -0aL -f /seagate/dumpoftmp.dmp /dev/da0s1e > /sbin/dump -0aL -f /seagate/dumpofusr.dmp /dev/da0s1f > /sbin/dump -0aL -f /seagate/dumpofvar.dmp /dev/da0s1d > /sbin/dump -0aL -f /seagate/dumpofhome.dmp /dev/da1p1 > so far so good. You probably don't need to dump /tmp. > c. on the target machine, do a complete install of freeBSD72 from CD with > same partition layout as original machine > No need. Just boot using the DVD or LiveFS and select the fixit option, and the 'Use the Live CD/DVD filesystem' > (On the target machine /home will be on /dev/da0s1g (no longer on > /dev/da1p1)) > > d. target machine, plug in the external USB disk and mount it > # mkdir /seagate > # mount /dev/da2s1a /seagate > > e. restore file systems > How exactly ? is this ok for /home : > # umount /home > # /sbin/newfs /dev/da0s1g > # /sbin/mount /dev/da0s1g /mnt > # cd /mnt > # /sbin/restore rf /seagate/dumpofhome.dmp > # umount /mnt > # mount /dev/da0s1g /home > > for /tmp, /usr and /var? > It is safe to use same procedure? or else, how to do ? > > And what for / file system ??? > will same procedure work ? > First off, use the fdisk option of sysinstall to create a slice. Press w to exit, so the slice table is immediately written to disk. You may also use sysinstall to create the individual partitions, although this can be accomplished with bsdlabel once you are at the prompt. Install the MBR and boot blocks (assuming /dev/da0 is your boot disk and /dev/da0s1 is the FreeBSD slice): fdisk -B /dev/da0 bsdlabel -B /dev/da0s1 newfs all the new partitions, using -U for soft updates where needed. Usually soft updates are used in /var /usr and /tmp newfs /dev/da0s1a newfs -U /dev/da0s1d newfs -U /dev/da0s1e newfs -U /dev/da0s1f and so on. You may also add journaling (gjournal) at this point, it is actually quite easy. You will need two temporary mount points, one for your external drive and one for the partition you will be restoring. The /mnt is available as a mount point in the LiveFS cd, create another temporary one: mkdir /seagate Now, mount your backup in /seagate: mount /dev/da2s1a /seagate Mount one of the new partitions in /mnt: mount /dev/da0s1a /mnt cd /mnt TMPDIR=/seagate restore -rvf /seagate/dumpofroot.dmp Note: restore will need some tmp space, hence the TMPDIR Before you umount /, edit at least /mnt/etc/fstab and fix your device entries with the new ones. cd / umount /mnt Repeat with all other partitions. Don't forget to newfs the /tmp partition that you will not be restoring. I hope you get the general idea, you will have to adjust this slightly for your needs. After the first normal boot: chmod -R 1777 /tmp chmod -R 1777 /var/tmp (set sticky bit on temp space)