Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
    
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 '13 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. –  Nicole Hamilton Jan 20 '13 at 16:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.