From mwm@mired.org  Thu Sep 21 00:39:05 2000
Return-Path: <mwm@mired.org>
Received: from guru.mired.org (zoom0-004.telepath.com [216.14.0.4])
	by hub.freebsd.org (Postfix) with SMTP id 5F89037B422
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Sep 2000 00:38:39 -0700 (PDT)
Received: (qmail 75057 invoked by uid 100); 21 Sep 2000 07:37:57 -0000
Message-Id: <20000921073757.75056.qmail@guru.mired.org>
Date: 21 Sep 2000 07:37:57 -0000
From: mwm@mired.org
Reply-To: mwm@mired.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: I'm tired of telling people how to copy a disk.
X-Send-Pr-Version: 3.2

>Number:         21443
>Category:       docs
>Synopsis:       I'm tired of telling people how to copy a disk.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 21 00:40:00 PDT 2000
>Closed-Date:    Fri Sep 22 11:41:02 PDT 2000
>Last-Modified:  Fri Sep 22 11:42:04 PDT 2000
>Originator:     Mike Meyer
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Meyer Consulting
>Environment:

	freebsd-questions@freebsd.org

>Description:

	Seems like we daily (ok, but more than once a week) get
	someone asking "I just put on <whopping big new disk>, how do
	I move my data to it?
	
>How-To-Repeat:

	Read -questions, and answer them for a while (and if you
	aren't doing that, why aren't you?)

>Fix:


Add this to the FAQ, under the "System Administration" section:

Q: How do I move my system over to my huge new disk?

A: The best way is to reinstall the OS on the new disk, then move the
user data over. This is highly recommended if you've been tracking
-stable for more than one release, or have updated a release instead
of installing a new one. You can install booteasy on both disks with
boot0cfg(8), and dual boot them until you are happy with the new
configuration. Skip the next paragraph to find out how to move the
data after doing this.

Should you decide not to do a fresh install, you need to partition and
label the new disk with either /stand/sysinstall, or fdisk(8) and
disklabel(8). You should also install booteasy on both disks with
boot0cfg(8), so that you can dual boot to the old or new system after
the copying is done. See the formatting-media tutorial at <URL:
http://www.freebsd.org/tutorials/formatting-media/index.html > for
details on this process.

Now you've got the new disk set up, and are ready to move the
data. Unfortunately, you can't just blindly copy the data. Things like
device files (in /dev) and symbolic links tend to screw that up. You
need to use tools that understand these things, which means dump(8)
and tar(1). I recommend doing the data moves in single user mode, but
it's not required.

You should never use anything but dump(8) and restore(8) to move the
root file system. Tar(1) may work - then again, it may not. You should
also use dump(8) and restore(8) if you are moving a single partition
to another empty partition. The sequence of steps to use dump to move
a partitions data to a new partition is:

	1. newfs the new partition.
	2. mount it on a temporary mount point
	3. cd to that directory
	4. dump the old partition, piping output to the new one

For example, if you are going to move root to /dev/ad1s1a, with /mnt
as the temporary mount point, it's:

	# newfs /dev/ad1s1a
	# mount /dev/ad1s1a
	# cd /mnt
	# dump 0uaf - / | restore xf -


If you are going to rearrange your partitions - say, splitting one
into two, or combing two into one, you may find yourself needing to
move everything under a subdirectory to a new location. Since dump(8)
works with file systems, it can't do this. So you use tar(8). The
general command to move /old to /new for tar is:

	(cd /old; tar cf - .) | (cd /new; tar xpf -)

If /old has file systems mounted on that, and you don't want to move
that data or unmount them, you just add the 'l' flag to the first tar:

	(cd /old; tar clf - .) | (cd /new; tar xpf -).

>Release-Note:
>Audit-Trail:

From: Oliver Fromme <olli@secnetix.de>
To: freebsd-gnats-submit@FreeBSD.org, mwm@mired.org
Cc:  
Subject: Re: docs/21443: I'm tired of telling people how to copy a disk.
Date: Thu, 21 Sep 2000 12:00:29 +0200

 For what it's worth, cpdup works perfectly fine to copy a
 disk (or any directory tree), even the root FS.  It's easier
 to use and more efficient than dump/restore, and it's not
 restricted to whole file systems.  Therefore I'd suggest
 mentioning cpdup in this FAQ section (unfortunately I'm not
 a native English speaker, otherwise I'd try to formulate
 an appropriate paragraph myself).
 
 cpdup is in the ports collection in the sysutils category
 (I really wish it was in the base system).
 
 Best regards
    Oliver Fromme
 
 -- 
 Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 Mnchen
 Any opinions expressed in this message may be personal to the author
 and may not necessarily reflect the opinions of secnetix in any way.
 
 "All that we see or seem is just a dream within a dream" (E. A. Poe)
 

From: Mike Meyer <mwm@mired.org>
To: Oliver Fromme <olli@secnetix.de>
Cc: freebsd-gnats-submit@FreeBSD.org, 
Subject: Re: docs/21443: I'm tired of telling people how to copy a disk.
Date: Thu, 21 Sep 2000 05:27:46 -0500 (CDT)

 Oliver Fromme writes:
 > 
 > For what it's worth, cpdup works perfectly fine to copy a
 > disk (or any directory tree), even the root FS.  It's easier
 > to use and more efficient than dump/restore, and it's not
 > restricted to whole file systems.  Therefore I'd suggest
 > mentioning cpdup in this FAQ section (unfortunately I'm not
 > a native English speaker, otherwise I'd try to formulate
 > an appropriate paragraph myself).
 > 
 > cpdup is in the ports collection in the sysutils category
 > (I really wish it was in the base system).
 
 Since I don't use it, I'm not really willing to recommend it myself
 (ditto for pax and cpio). For a number of reasons, I won't recommend
 using it on the root fs.
 
 So how about adding a sentence along the lines of "You might prefer
 cpio(1), pax(1) or cpdup (in ports/sysutils/cpdup) to tar." at the
 appropiate point?
 
 	<mike
 

From: Oliver Fromme <olli@secnetix.de>
To: freebsd-gnats-submit@FreeBSD.org, mwm@mired.org
Cc:  
Subject: Re: docs/21443: I'm tired of telling people how to copy a disk.
Date: Thu, 21 Sep 2000 14:59:54 +0200

 Mike Meyer wrote:
  > Since I don't use it, I'm not really willing to recommend it myself
  > (ditto for pax and cpio). For a number of reasons, I won't recommend
  > using it on the root fs.
 
 I'd suggest that you have a look at the manual page.  The tool was
 written by Matt Dillon and Dima Ruban specifically for making an
 _exact_ copy of a UFS directory tree or file system, including all
 hardlinks, softlinks, devicenodes, sockets etc., preserving flags,
 permissions and utimes.
 
 I'm not aware of any reason not to use it for the root FS.
 
  > So how about adding a sentence along the lines of "You might prefer
  > cpio(1), pax(1) or cpdup (in ports/sysutils/cpdup) to tar." at the
  > appropiate point?
 
 That would be OK.
 
 Thanks
    Oliver
 
 -- 
 Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 Mnchen
 Any opinions expressed in this message may be personal to the author
 and may not necessarily reflect the opinions of secnetix in any way.
 
 "All that we see or seem is just a dream within a dream" (E. A. Poe)
 

From: Ben Smithurst <ben@FreeBSD.org>
To: mwm@mired.org
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: docs/21443: I'm tired of telling people how to copy a disk.
Date: Thu, 21 Sep 2000 13:25:56 +0100

 mwm@mired.org wrote:
 
 > Q: How do I move my system over to my huge new disk?
 
 *grumble*
 
 It would be really nice if you could send this as an SGML diff to the
 FAQ, with correct indentation and everything. ("correct" means what the
 FDP Primer says, not what most of the FAQ is.  Some of the questions in
 the FAQ are correct though, mostly the recent additions.)
 
 But if you don't have time to do that, I'm sure a doc/ committer will
 get around to it.  Mark, are you there? :-)
 
 -- 
 Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D
 

From: Mike Meyer <mwm@mired.org>
To: Ben Smithurst <ben@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: docs/21443: I'm tired of telling people how to copy a disk.
Date: Thu, 21 Sep 2000 18:22:00 -0500 (CDT)

 Ben Smithurst writes:
 > mwm@mired.org wrote:
 > > Q: How do I move my system over to my huge new disk?
 > *grumble*
 > 
 > It would be really nice if you could send this as an SGML diff to the
 > FAQ, with correct indentation and everything. ("correct" means what the
 > FDP Primer says, not what most of the FAQ is.  Some of the questions in
 > the FAQ are correct though, mostly the recent additions.)
 
 SGML is great stuff, and I use it all the time. However, when I asked
 on docs for information on submitting a new FAQ, I got told "just send
 a PR". I couldn't find anything obvious on how to do it in SGML, other
 than instructions for joining the doc project. That was distinctly
 overkill for adding a single FAQ entry; especially when compared to
 things like the Python FAQ Wizard.
 
 So - give me a pointers to a DTD I can install for psgml to use and
 the primer for formatting, as well as a place to grab the source for
 just the FAQ, and I'll mark up my text, add it and send a diff.
 
 	<mike
 
 
 

From: Mike Meyer <mwm@mired.org>
To: Oliver Fromme <olli@secnetix.de>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: docs/21443: I'm tired of telling people how to copy a disk.
Date: Thu, 21 Sep 2000 19:12:39 -0500 (CDT)

 Oliver Fromme writes:
 > Mike Meyer wrote:
 >  > Since I don't use it, I'm not really willing to recommend it myself
 >  > (ditto for pax and cpio). For a number of reasons, I won't recommend
 >  > using it on the root fs.
 > I'd suggest that you have a look at the manual page.  The tool was
 > written by Matt Dillon and Dima Ruban specifically for making an
 > _exact_ copy of a UFS directory tree or file system, including all
 > hardlinks, softlinks, devicenodes, sockets etc., preserving flags,
 > permissions and utimes.
 
 Oh, I believe it's good stuff. I've worked with both of them before,
 and know what they can do. However, much more than a pointer in a FAQ
 entry seems wrong something in the ports tree.
 
 > I'm not aware of any reason not to use it for the root FS.
 
 The odd stuff in /dev is why the root file system gets special
 treatment. While other things can handle them, they do change at
 times. That's why my personal preference is to use dump, which is
 tightly coupled to the fs structure. I feel it's less likely to be
 overlooked when these things change.
 
 However, the real problem is that cpdup is a port. That means that it
 isn't automatically updated and rebuilt in the process of doing a make
 world. Sometimes, the port doesn't even change - but it needs to be
 recompiled. I've been bit by this with cdrecord, but don't have any
 alternatives :-(.
 
 	<mike
 
State-Changed-From-To: open->closed 
State-Changed-By: marko 
State-Changed-When: Fri Sep 22 11:41:02 PDT 2000 
State-Changed-Why:  
Committed (with the reference to cpio that was missing from the diff). Thanks!! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21443 
>Unformatted:
