Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Tar (computing)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Random access=== The tar format was designed without a centralized index or table of content for files and their properties for streaming to tape backup devices. Instead, the metadata for each file (such as name, size, time stamps) for each file is stored in a header before each file. The archive must be read sequentially to list or extract files. For large tar archives, this causes a performance penalty, making tar archives unsuitable for situations that often require random access to individual files. In turn, this design makes TAR archives resilient against damage from missing portions, in both the form of digital files and physical tape.{{cn|date=February 2025}} A truncated TAR file with missing parts on either ends still allows recovering the parts that are not missing, including the file paths and file names and metadata, by starting from the first TAR header that is not missing.<ref>Creating TAR with 100 KB missing at the beginning: <code>tail --bytes=+100000 "intact archive.tar" >>"missing beginning.tar"</code>. Next header can be found using a [[hex editor]]. Recover using <code>dd if="missing beginning.tar" of=recovered.tar ibs=''[bytes until next header which starts with file path and name]'' skip=1</code>. Quotation marks are not needed for file names without spaces.</ref> With a well-formed tar file stored on a seekable (i.e. allows efficient random reads) medium, the {{code|tar}} program can still relatively quickly (in linear time relative to file count) look for a file by skipping file reads according to the "size" field in the file headers. This is the basis for option {{code|-n}} in GNU tar. When a tar file is compressed whole, the compression format, being usually non-seekable, prevents this optimization from being done.<ref>{{cite web |last1=BillThor |title=What makes a tar archive seekable? |url=https://superuser.com/a/1235409 |website=Super User |access-date=15 December 2023 |language=en |date=July 28, 2017}}</ref> To maintain seekability, tar files must be also concatenated properly, by removing the trailing zero block at the end of each file.<ref>{{cite web |title=GNU tar 1.35: 4.2.4 Combining Archives with --concatenate |url=https://www.gnu.org/software/tar/manual/html_node/concatenate.html |website=www.gnu.org}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)