0

Is there a file table, or inode structure (like in filesystems) of a zip or tar file?

1 Answer 1

3

No. Both tar and zip formats are designed so you can add files onto the end. Individual files or directories are added as contiguous header + data segments. There is no filesystem that allocates blocks to files in a non-contiguous fashion.

Tar files have no directory mechanism. Each tar header tells the file name, mode bits, userid and groupid, timestamp and filesize of the data segment that follows. End of the tar archive is marked by a null header. The way to know what's in a tar file is to read it, though if it's on disk, you can jump from one header to the next by seeking over the data segments.

Zip files follow the same conceptual format of repeated header + data segments but add a directory onto the end.

Zip format

2
  • So to clarify, the header's info on the filesize dictates where the file ends and the next begins? And the central directory just dictates the offset on where the file begins?
    – agz
    Jan 20, 2013 at 5:14
  • 1
    @agovizer The directory at the end is largely redundant of the information in the individual headers. The reason for it is to avoid having to scan the entire archive to find out what's in it, as has to be done with a tar file. Jan 20, 2013 at 16:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .