Does 7-Zip Store NTFS Alternate Data Streams?
7-Zip does not store NTFS Alternate Data Streams (ADS) by default,
but it does fully support preserving them if explicitly instructed to do
so. Standard archiving operations will strip ADS metadata, such as
security zone identifiers, to maintain cross-platform compatibility and
reduce archive size. However, users can preserve these streams within
.7z archives by utilizing a specific configuration switch
during both compression and extraction.
Default Behavior
When you create a .7z archive using standard
settings—either through the graphical user interface (GUI) or the
command line—7-Zip discards all Alternate Data Streams. It compresses
only the primary, unnamed data stream of each file.
This behavior is intentional for several reasons:
- Portability: Non-NTFS file systems (such as FAT32, exFAT, ext4, and APFS) do not natively support NTFS streams in the same format.
- Security and Privacy: Windows automatically
attaches a hidden stream called
Zone.Identifierto downloaded files to mark them as originating from the internet. Stripping ADS prevents unintended tracking metadata or hidden payloads from lingering inside archives. - Archive Size: Omitting extraneous metadata keeps archive sizes minimal.
How to Store NTFS Streams in 7-Zip
To save Alternate Data Streams inside a .7z archive, you
must use the -sns (Store NTFS Streams) switch. This
functionality was introduced in version 15.06 and is standard in modern
versions of 7-Zip.
Using the Command Line
To compress files while preserving all alternate streams, add
-sns to your archive command:
7z a archive.7z file.txt -snsTo extract files and restore the alternate streams onto an NTFS drive:
7z x archive.7z -snsIf you do not specify -sns during extraction, 7-Zip will
only unpack the main data streams, even if the archive contains the
alternate streams.
Using the Graphical Interface (GUI)
If you prefer the 7-Zip GUI:
- Right-click the file or folder and select 7-Zip > Add to archive....
- Locate the Parameters field at the bottom of the compression settings window.
- Enter
sns=onor-sns. - Click OK to create the archive.
Limitations and Considerations
- Format Support: The
-snsfeature is primarily designed for the native.7zcontainer format. Other formats, such as standard.zip, do not offer reliable ADS preservation through 7-Zip. - Target File System: When restoring streams, the destination partition must be formatted as NTFS. Extracting ADS-enabled archives to FAT32 or non-NTFS external drives will cause the alternate streams to be dropped upon extraction.