LTRData.DiscUtils.DeduplicationRole 1.0.92

dotnet add package LTRData.DiscUtils.DeduplicationRole --version 1.0.92
                    
NuGet\Install-Package LTRData.DiscUtils.DeduplicationRole -Version 1.0.92
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LTRData.DiscUtils.DeduplicationRole" Version="1.0.92" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LTRData.DiscUtils.DeduplicationRole" Version="1.0.92" />
                    
Directory.Packages.props
<PackageReference Include="LTRData.DiscUtils.DeduplicationRole" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LTRData.DiscUtils.DeduplicationRole --version 1.0.92
                    
#r "nuget: LTRData.DiscUtils.DeduplicationRole, 1.0.92"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LTRData.DiscUtils.DeduplicationRole@1.0.92
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LTRData.DiscUtils.DeduplicationRole&version=1.0.92
                    
Install as a Cake Addin
#tool nuget:?package=LTRData.DiscUtils.DeduplicationRole&version=1.0.92
                    
Install as a Cake Tool

LTRData.DiscUtils.DeduplicationRole

Reads files optimized by the Windows Server Data Deduplication role. NTFS and ReFS provide transparent read access. Explicit reconstruction needs the file’s deduplication reparse data, its stored stream and access to its chunk store. Read-only.

Part of the LTRData DiscUtils fork. Package IDs use LTRData.DiscUtils; C# namespaces remain DiscUtils.

What Data Deduplication does to a file

When the role optimizes a file, Windows moves its data into a chunk store under System Volume Information\Dedup\ChunkStore\{GUID}.ddp and leaves a sparse stub with a reparse point (tag IO_REPARSE_TAG_DEDUP, 0x80000013). The stub can contain locally written or recalled data. Its sparse holes read as zeros on raw access. A logical read combines the local ranges with data from the chunk store.

The pinned Windows fixture dataset includes independently optimized Server 2025 NTFS and ReFS images. Materialize Git LFS objects with git lfs pull and set DISCUTILS_DATASET to the checkout's dataset directory.

Capabilities

Capability Support
Reparse data (property blocks FeRp/DdRp, the short form) Yes, checked against their CRC-32
Stream maps, data chunks, the redirection table of moved stream maps Yes
Chunk compression: none, LZNT1, XPRESS, XPRESS Huffman Yes, with the DiscUtils decoders
Locally stored and recalled data Yes: the blocks the recall bitmap marks, else the stub's SparseStream.Extents; bytes past the deduplicated size from the stub
Verification of chunk hashes (SHA-512) and record checksums (CRC-64) Yes, can be turned off
Recall bitmap (RbRp, partly recalled files; bitmap type 0) Yes: one bit per 2^RbRp[1] bytes (4 KiB on the lab image), checked against its CRC-32. Refused: bitmap pages on disk (depth 1, 2), the volume-default block size (shift 0), the legacy form, bitmap type 1
Optimizing files, writing to the chunk store, garbage collection No

Usage

NTFS and ReFS read optimized files by themselves: NtfsFileSystem and ReFsFileSystem use this library when a deduplicated file is opened for reading (NtfsOptions.ReadDeduplicatedFiles and ReFsFileSystemOptions.ReadDeduplicatedFiles, both on by default). With the option off they return the physical stub, including its locally stored or recalled ranges. Both implement IDedupAwareFileSystem, so DedupFileSystemReader returns what they open as it is when the option is on, and reads the chunk store itself when it is off.

For explicit reconstruction, DedupFileSystemReader uses IWindowsFileSystem.GetReparsePoint on a DiscFileSystem. The filesystem must expose the stored stream and allow the reader to enumerate and open the volume’s chunk-store files. Without a supported recall bitmap, reconstruction uses the stub’s sparse extents to identify local ranges. A filesystem without IWindowsFileSystem supplies its ordinary stream contents.

using DiscUtils.DeduplicationRole;

// fs: an NtfsFileSystem (or another DiscFileSystem that implements IWindowsFileSystem).
using var reader = new DedupFileSystemReader(fs);

if (reader.IsDeduplicated(@"Shares\big.iso"))
    Console.WriteLine("optimized by Data Deduplication");

// The content as Windows reads it; a file that is not optimized opens as stored.
using var data = reader.OpenRead(@"Shares\big.iso");

Ownership and read failures

Keep one reader per volume and serialize access to it and its streams. The reader borrows the filesystem or IDedupSource. The caller owns each returned stream. Close the consumer streams first, then the reader, filesystem and backing volume in that order. On a mount that already handles deduplication, DedupFileSystemReader.OpenRead passes the filesystem stream to the caller. Disposing that wrapper leaves the stream with the caller.

For a custom chunk store, implement IDedupSource and call DedupReader.Open(reparseData, stub) with the bytes after the 8-byte reparse header. This call takes ownership of the stub, including if initialization fails. Each reconstructed stream owns its stub and last decoded chunk. The reader owns the shared container handles and redirection tables. Disposing it invalidates reads through its reconstructed streams. Independently opened streams can be closed in any order.

An absent container in the directory listing, invalid stream map, bad checksum or malformed compressed chunk raises DedupFormatException. An unsupported compression method or layout raises NotSupportedException. Underlying I/O errors propagate, including premature end of a stub or container. Failed reads do not install a decoded chunk in the consumer's cache. The reader can retry a missing container or reopen a handle after a record read fails. Disabling checksum verification explicitly skips the associated integrity checks.

Tested

  • Synthetic containers, stream maps and the redirection table, and damaged reparse data and chunks (Tests/LibraryTests/DeduplicationRole).
  • The chunk decoders against Windows' own compressor (Tests/LibraryTests/Compression).
  • A Windows Server 2025 ReFS volume with deduplicated files (lab image w2025-dedup in the ReFS dataset): every optimized file read on the ReFS volume, and on an NTFS volume built from it (the chunk store, the sparse stubs and the reparse points copied), matches the content Windows reports, both through DedupFileSystemReader and through NtfsFileSystem.OpenFile.
  • On the Windows Server 2025 NTFS w2025-dedup image, all ten optimized unnamed streams and the named data stream match the lengths and SHA-256 hashes in the Windows manifest. The test exercises transparent NTFS access and explicit generic reconstruction. Set DISCUTILS_DATASET to the Test-Fixtures dataset directory to run both filesystem fixtures.

Provenance

The code is an independent implementation written for this project; it contains no source code from other projects. It was split out of the ReFS reader (DiscUtils.ReFs).

The format knowledge comes from these sources:

  • Microsoft's published specifications: the reparse tag IO_REPARSE_TAG_DEDUP and the reparse point buffer ([MS-FSCC]), and the LZNT1, XPRESS and XPRESS Huffman chunk compression ([MS-XCA], through the DiscUtils decoders).
  • Standard algorithms: CRC-32, CRC-64 (NVMe polynomial) and SHA-512.
  • Interoperability facts: Microsoft does not document the chunk store layout (containers, stream maps, the redirection table). Its record layouts were described from the publicly available readers ntfs-3g-dedup-plugin and DedupInspector, which are credited here as references.
  • Observation: every layout detail the reader relies on was checked against volumes deduplicated by Windows Server 2025. The reader's output was compared with the file content Windows returns.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on LTRData.DiscUtils.DeduplicationRole:

Package Downloads
LTRData.DiscUtils.Ntfs

Managed .NET implementation for reading, formatting and modifying NTFS filesystems, including NTFS-specific file metadata.

LTRData.DiscUtils

Broad DiscUtils meta-package for managed .NET disk images, filesystems, storage protocols and related storage formats.

LTRData.DiscUtils.ReFs

Managed .NET support for reading ReFS 3.x filesystems (experimental, read-only).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.92 0 12/5/2026