Re: Moving files to a new partition. Please help.
> I need to know how to copy the files from the old to the new, without
> having and links destroyed, and without entering the neverending loop with
> regards to '/mnt/mnt/mnt/...'. All attempts that I have done have
> resulted in files that links pointed being copies, instead of just making a
> link, and having '/mnt' copied recursively.
Well, the standard way (to me, anyway) to copy a tree to another location
has been to use tar to archive to stdout and then have it unpack from stdin
in another directory, like so:
(cd /source/dir; tar -cf - . ) | (cd /dest/dir; tar -xpf -)
The "p" in the "-xpf" is supposed to "preserve permissions" as much as
possible on some versions of tar. I don't know what difference it makes,
exactly, but "preserve" seems like something I'd want switched on when
trying to transparently move a tree. If you want to watch the filenames
go ripping by, you can use "-xpvf" to make the unpacking "verbose".
This method is nice because it retains symbolic links, pipes, device files...
etc. It's great.
Now, *YOUR* problem (which I've also run into in the past) is that you don't
want all of the directories to be copied over. What's worked well for me
in getting around this is to do an "ls" to get the filename, use egrep to
filter out the ones you don't want, and then use xargs to put them onto
tar's command line. So, you'd want something like this:
(cd /; ls | egrep -v "^proc|mnt$" | xargs tar -cf - ) | (cd /mnt; tar -xpf -)
Now, if you've got some other partitions mounted, you'll either want to
unmount all partitions except root and the one in "mnt", or you can exclude
them in the "egrep" line, like:
egrep -v "^prog|mnt|var|home|usr$" .....
You get the idea....
Hope this helps. If this works for you, I think someone might want to
toss this into that Linux bag-o-tricks HOWTO that I read once.... Just
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com