Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jan 2002 03:45:36 -0600
From:      "Mike Meyer" <mwm-dated-1011260737.c5282e@mired.org>
To:        Paul Murphy <pnmurphy@cogeco.ca>, Brian T.Schellenberger <bts@babbleon.org>
Cc:        questions@freebsd.org
Subject:   Re: Filesystem Full (was (No Subject))
Message-ID:  <15424.1472.594718.233277@guru.mired.org>
In-Reply-To: <106655512@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Paul Murphy <pnmurphy@cogeco.ca> wrote:
> /dev/da1s1f    663553     2764   607705     0%    /usr/home
> /dev/da1s1e    192543   183627    -6487   104%    /usr/ports
> 
>  I want to switch these two filesystems, here is my plan:
> 
> 1) back them up to /usr/tmp
> 2) rm -r /usr/home && rm -r /usr/ports
> 3) edit the fstab appropriately
> 4) umount /usr/home && umount /usr/ports
> 5) mount /usr/home && mount /usr/ports
> 6) cp -r /usr/tmp/home/* /usr/home && cp -r /usr/tmp/ports/* /usr/ports

This one is a bad idea, so I hope you haven't tried it yet.

> Does this seem right? Any gotcha's? I don't want to loose any data as
> these are fairly important filesystems (although I could cvsup ports).

Yup.  cp copies hard link as separate files. If you have any, you'll
wind up taking up more space after the copy is over than you did
before. Among other possible problems.

I recommend:

1) dump them to /usr/tmp. Dump handles everything correctly.
2) Step 4 from above
3) newfs /dev/da1s1f and /dev/da1s1e, as that should be faster than rm.
4) edit the fstab.
5) step 5 from above
6) restore the dumped file systems.

Brian T.Schellenberger <bts@babbleon.org> types:
> > 6) cp -r /usr/tmp/home/* /usr/home && cp -r /usr/tmp/ports/* /usr/ports
> Again, mv is easier & preserves all the file attributes; if you don't use mv 
> for some reason (extra paranoia?), use pax -rw or cp -pr or a tar-pipe to 
> preserve all the file attributes.

If you're mv'ing things to a different file system, it invoke cp to do
the mv. See the man page for details.

This means it inherits the problem with hard links. mv does things
right if you're on the same file system.

pax and tar should work properly, but - well, dump was designed for
dealing with this kind of thing. If you're tight for space, you can
even send the dumped data to stdout and gzip or bzip2 it before
putting it on disk.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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




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