| Date: Fri, 19 Jul 2002 14:28:42 +0100
| From: Niall O Broin <niall at 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 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...
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!