Skip site navigation (1)Skip section navigation (2)
Date:      21 Sep 2000 07:37:57 -0000
From:      mwm@mired.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   docs/21443: I'm tired of telling people how to copy a disk.
Message-ID:  <20000921073757.75056.qmail@guru.mired.org>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 21 00:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000921073757.75056.qmail>