Re: cdrom: "df" != real size ?

Klaus Lichtenwalder (klaus@gaston.m.isar.de)
Wed, 29 May 1996 09:03:04 +0100 (WET DST)


On Wed, 29 May 1996, Herbert Rosmanith wrote:

> venus:~# df
> Filesystem 1024-blocks Used Available Capacity Mounted on
> /dev/hda2 985329 493077 441348 53% /
> /dev/scd0 94 94 0 100% /cdrom
>
> this does mean that there are 94x1024x1024 bytes = 94MB on CD?
> or is this wrong ? I guess so, because when I tar the whole thing,
> I'll see:
>
> venus:~# tar -cf cdrom.tar /cdrom/
> venus:~# ls -l cdrom.tar
> -rw-r--r-- 1 root root 297768960 May 29 07:40 cdrom.tar
>
> but this would mean that 1 block on cdrom is 3093.510638 bytes each.
> hmm ... where is the error?
>

When you do a tar, that's everything but a close approximation to the
real space used, especially if you have many (small) files in that tree.
Tar creates a 512byte header for each file and pads the last block to
512 byte blocks. A closer approximation would be using cpio, that one
only uses a small header and pads the file to the next even boundary.
Check with /usr/include/tar.h.

Klaus

________________________________________________________________________
Klaus Lichtenwalder, Dipl. Inform., PGP Key: email to key@Four11.com
Lichtenwalder@ACM.org, http://www.wp.com/Klaus, fax: +49-89-98292755
Check out Oregon vs. Schwartz: http://www.lightlink.com/spacenka/fors