Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Aug 2014 23:17:45 +0700
From:      Victor Sudakov <vas@mpeks.tomsk.su>
To:        freebsd-questions@freebsd.org
Subject:   Re: cpio and hard links
Message-ID:  <20140809161745.GB65785@admin.sibptus.tomsk.ru>
In-Reply-To: <13472.1406495024@server1.tristatelogic.com>
References:  <13472.1406495024@server1.tristatelogic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ronald F. Guilmette wrote:
> 
> 
> 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?

Try 'cpio -H ustar'.


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
sip:sudakov@sibptus.tomsk.ru



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