Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jul 2014 14:03:44 -0700
From:      "Ronald F. Guilmette" <rfg@tristatelogic.com>
To:        freebsd-questions@freebsd.org
Subject:   cpio and hard links
Message-ID:  <13472.1406495024@server1.tristatelogic.com>

next in thread | raw e-mail | index | archive | help


Given a directory "tmp" which contains two files, "foo" and "bar",
both of which are merely hard links to one another, the following
command will, apparently, produce an archive of the directory in
question which contains only a single instance of the actual file
contents:

	tar cvf tmp.tar tmp

The resulting tmp.tar file can later be unpacked, using tar, resulting
in a directory structure which exactly mirrors the original "tmp"
directory, including preservation of the hard link(s).

I note however that, given the same original directory structure, the
following command generates an archive file containing two complete
instances of the file data:

	find tmp -depth -print | cpio -ovm > tmp.cpio

For the the cpio program that is part of FreeBSD, is there any option
which would have the effect of causing cpio to only archive a single
instance of the data associated with each unique inode... as tar apparently
does, by default?

(If any such option exists, my hasty perusal of the relevant man page
did not reveal it.  My apologies if I simply missed it.  In that case
I shall certainly, happily, and humbly attempt to RTFM once again and
more carefully.)



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