From: Brian Foster (blf at domain utvinternet.ie)
Date: Fri 19 Jul 2002 - 15:00:52 IST
| Date: Fri, 19 Jul 2002 14:28:42 +0100
| From: Niall O Broin <niall at domain linux.ie>
|
| I have about 60G of data which I need to copy from one disk
| to another. However, I'm not sure how I should best copy it.
| The problem is the bulk of the data is images and most of these
| image have two directory entries i.e. there is a hard link to
| each file. If I copy them using cp -a or my usual favourite of
| find .|cpio -pmd other_dir it's going to copy each file twice,
| which is not what I want. dump / restore would take care of this
| if the source filesystem wasn't reiserfs :-( Any suggestions ?
do your (and my) favourite, it'll be Ok:
1. cpio(1) preserves hard links, i.e., if F1 and F2 are
hard-linked and both are "copied", then the "copies"
are also hard-linked. this is true of all `cpio's
(and `tar' and any other decent/usable archival tool,
by definition (IMHO)).
2. `cpio -p' (at least `GNU cpio version 2.4.2') will only
read/write (copy) the actual data bytes once. I _think_
this is true for all `cpio's (not just that GNU version),
but am not certain.
if you use an intermediate archive, e.g.:
cpio -o ... >file; ...; cpio -i ... <file
then the actual data bytes are copied into the archive (file)
under each name (e.g., as both F1 and F2). but GNU `cpio' is
smart about this in pass-through mode (`-p'), copying the data
just once (or so I read the source).
cheers!
-blf-
p.s. assuming this is a one-time operation that you won't repeat
anytime soon (e.g., never; i.e., time isn't a major issue),
and are not using any intermediate media/file (so storage
isn't an issue), then even if `cpio' did read the data twice,
so what? --- as long as, of course, it re-creates the hard
links. which it will.
--
Innovative, very experienced, Unix and | Brian Foster Dublin, Ireland
Chorus (embedded RTOS) kernel internals | e-mail: blf at domain utvinternet.ie
expert looking for a new position ... | mobile: (+353 or 0)86 854 9268
For a résumé, contact me, or see my website http://www.blf.utvinternet.ie
Stop E$$o (ExxonMobile): «Whatever you do, don't buy Esso --- they
don't give a damn about global warming.» http://www.stopesso.com
Supported by Greenpeace, Friends of the Earth, and numerous others...
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:58 GMT