[comp.os.minix] Cpio vs. Tar

cs00chs@unccvax.uncc.edu (charles spell) (08/22/90)

I noticed that cpio produces much larger archive files than tar.

What would be some advantages of using cpio instead of tar?

uunet!mcnc!unccvax!cs00chs
-- 
.--------------------------.  ...  |On the border of your mind lies a place
|uunet!mcnc!unccvax!cs00chs|  (")  |where dreams and reality are one...I will 
`--------------------------'-w-U-w-|take you there, for I am the subject...
\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\%\|the subject of your imagination. -Aldo Nova

adrie@philica.ica.philips.nl (Adrie Koolen) (08/27/90)

In article <2627@unccvax.uncc.edu> cs00chs@unccvax.uncc.edu (charles spell) writes:
>I noticed that cpio produces much larger archive files than tar.
>
>What would be some advantages of using cpio instead of tar?

That's strange. Tar uses very inefficient and large headers. While archiving
half of the command sources, tar produced a file of 627KB, but the cpio
generated file was 584KB. No so much smaller, but at least not larger than
the tar file! The commands, which I archived, were rather large files, so
I tried to archive all the C sources in lib/other. Tar produced a file of
152KB, cpio a file of 112KB. The directory contained 58 files, most of which
were under 1KB. I used `ls *.c | cpio -ocvB >lib.cpio' to generate the cpio
file. When not using the `c' and the `B' options, the cpio file was only
107KB.

I don't understand how you got a cpio file, that was significantly larger
than the corresponding tar file. What sort of files did you archive?

Adrie Koolen (adrie@ica.philips.nl)
Philips Innovation Centre Aachen

andreas@nixhhs.UUCP (Andreas Wettengel) (08/28/90)

In article <653@philica.ica.philips.nl> adrie@beitel.ica.philips.nl (Adrie Koolen) writes:
>In article <2627@unccvax.uncc.edu> cs00chs@unccvax.uncc.edu (charles spell) writes:
>>I noticed that cpio produces much larger archive files than tar.
>>
>>What would be some advantages of using cpio instead of tar?
>
>That's strange. Tar uses very inefficient and large headers.

Both of you are correct (:-). Cpio is inefficient when encountering
links. Each file is put on the archive, regardless if it has already
been put there as another (linked) file. When files are extracted, links
are recognized. Tar recognizes links at the time the archive is produced.

> When not using the `c' and the `B' options, the cpio file was only
>107KB.
The 'B' option only affects the 'write' command; no padding is done except
on the last block (512 vs. 5120 bytes).


-- 
Andreas Wettengel		| Nixdorf Computer AG
Tel. +49 40/6371-2423		| Ueberseering 33
(...uunet!)unido!nixhhs!andreas	| 2000 Hamburg 60
    NERV: nixhhs!andreas.eunet	| West Germany