Correct some example commands and warn about possible problems with

tar(1) when moving filesystems around.  Suggest dump(1) above all.

PR:		docs/31028
Submitted by:	Mike Meyer <mwm@mired.org>
This commit is contained in:
Murray Stokely 2001-10-08 03:34:59 +00:00
parent 991b483518
commit aea6647274
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=10881

View file

@ -19,7 +19,7 @@
<corpauthor>The FreeBSD Documentation Project</corpauthor>
<pubdate>$FreeBSD: doc/en_US.ISO8859-1/books/faq/book.sgml,v 1.270 2001/10/03 20:23:15 ue Exp $</pubdate>
<pubdate>$FreeBSD: doc/en_US.ISO8859-1/books/faq/book.sgml,v 1.271 2001/10/03 20:29:11 ue Exp $</pubdate>
<copyright>
<year>1995</year>
@ -6953,14 +6953,14 @@ define(`confDELIVERY_MODE',`deferred')dnl</programlisting>
formatting-media tutorial</ulink> for details on this
process.</para>
<para>Now you have got the new disk set up, and are ready
<para>Now you have the new disk set up, and are ready
to move the data. Unfortunately, you cannot just blindly
copy the data. Things like device files (in
<filename>/dev</filename>) and symbolic links tend to
<filename>/dev</filename>), flags, and links tend to
screw that up. You need to use tools that understand
these things, which means &man.dump.8; and &man.tar.1;.
Although it is suggested that you move the data in single user
mode, it is not required.</para>
these things, which means &man.dump.8;.
Although it is suggested that you move the data in single user
mode, it is not required.</para>
<para>You should never use anything but &man.dump.8; and
&man.restore.8; to move the root file system. The
@ -6995,31 +6995,42 @@ define(`confDELIVERY_MODE',`deferred')dnl</programlisting>
it is:</para>
<screen>&prompt.root; <userinput>newfs /dev/ad1s1a</userinput>
&prompt.root; <userinput>mount /dev/ad1s1a</userinput>
&prompt.root; <userinput>mount /dev/ad1s1a /mnt</userinput>
&prompt.root; <userinput>cd /mnt</userinput>
&prompt.root; <userinput>dump 0uaf - / | restore xf -</userinput></screen>
&prompt.root; <userinput>dump 0af - / | restore xf -</userinput></screen>
<para>Rearranging your partitions with dump takes a bit more
work. To merge a partition like <filename>/var</filename>
into it's parent, create the new partition large enough
for both, move the parent partition as described above,
then move the child partition into the empty directory
that the first move created:</para>
<screen>&prompt.root; <userinput>newfs /dev/ad1s1a</userinput>
&prompt.root; <userinput>mount /dev/ad1s1a /mnt</userinput>
&prompt.root; <userinput>cd /mnt</userinput>
&prompt.root; <userinput>dump 0af - / | restore xf -</userinput>
&prompt.root; <userinput>cd var</userinput>
&prompt.root; <userinput>dump 0af - /var | restore xf -</userinput></screen>
<para>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 &man.dump.8;
works with file systems, it cannot do this. So you use
&man.tar.1;. The general command to move
<filename>/old</filename> to <filename>/new</filename>
for &man.tar.1; is:</para>
<para>To split a directory from it's parent, say putting
<filename>/var</filename> on it's own partition when it wasn't
before, create both partitions, then mount the child partition
on the approriate directory in the temporary mount point, then
move the old single partition:</para>
<screen>&prompt.root; <userinput>(cd /old; tar cf - .) | (cd /new; tar xpf -)</userinput></screen>
<screen>&prompt.root; <userinput>newfs /dev/ad1s1a</userinput>
&prompt.root; <userinput>newfs /dev/ad1s1d</userinput>
&prompt.root; <userinput>mount /dev/ad1s1a /mnt</userinput>
&prompt.root; <userinput>mkdir /mnt/var</userinput>
&prompt.root; <userinput>mount /dev/ad1s1d /mnt/var</userinput>
&prompt.root; <userinput>cd /mnt</userinput>
&prompt.root; <userinput>dump 0af - / | restore xf -</userinput></screen>
<para>If <filename>/old</filename> has file systems
mounted on that, and you
do not want to move that data or unmount them, you just
add the 'l' flag to the first &man.tar.1;:</para>
<screen>&prompt.root; <userinput>(cd /old; tar clf - .) | (cd /new; tar xpf -).</userinput></screen>
<para>You might prefer &man.cpio.1;, &man.pax.1;, or cpdup
(in ports/sysutils/cpdup) to &man.tar.1;.</para>
<para>You might prefer &man.cpio.1;, &man.pax.1;,
&man.tar.1; to &man.dump.8; for user data. At the time of
this writing, these are known to lose file flag information,
so use them with caution.</para>
</answer>
</qandaentry>