Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Research: junction behavior

This page records the platform behavior that shapes the product. It is shared research, not a user guide. It explains why the manager attempts operations and reports native results instead of guessing from a volume label.

Last reviewed: 2026-12-04.

Scope

The questions this research answers:

  1. What is a junction at the filesystem level?
  2. Which volumes can host a junction link, and which can host a target?
  3. How do broken junctions behave when inspected and removed?
  4. Which PowerShell and .NET calls are safe for creation, inspection, and detachment?
  5. Why does the product avoid a filesystem-type gate?

What a junction is

A junction is a directory reparse point. The directory entry carries a reparse tag and a small data buffer. When the I/O manager resolves the path, it reads the buffer and redirects to the stored target path.

flowchart LR
    A["Path: C:\\link"] --> B["Directory entry<br/>FILE_ATTRIBUTE_REPARSE_POINT"]
    B --> C["Reparse tag<br/>IO_REPARSE_TAG_MOUNT_POINT"]
    C --> D["Reparse data<br/>substitute name + print name"]
    D --> E["Target: D:\\data"]

Junctions and volume mount points share the IO_REPARSE_TAG_MOUNT_POINT tag (0xA0000003). A junction stores a directory path; a mount point maps a volume. A symbolic link uses IO_REPARSE_TAG_SYMLINK (0xA000000C) and can target files or directories, including remote UNC paths.

AspectJunctionDirectory symbolic linkVolume mount point
Reparse tagIO_REPARSE_TAG_MOUNT_POINTIO_REPARSE_TAG_SYMLINKIO_REPARSE_TAG_MOUNT_POINT
Target kindLocal directory pathLocal or remote pathVolume
Remote targetNoYes (UNC)No
Creation privilegeNo symbolic-link privilege requiredSymbolic-link privilege or Developer ModeTypically administrative
Common creatormklink /J, New-Item -ItemType Junctionmklink /D, New-Item -ItemType SymbolicLinkmountvol, disk management

The product manages junctions only. A path whose LinkType is not Junction is reported as Not-A-Junction and is never modified.

Filesystem support

Volume roleRequirementEvidence
Host of the junction linkMust support reparse pointsNTFS and ReFS support reparse points; FAT32 and exFAT do not
Host of the target directoryAny local filesystem the path can reachThe reparse buffer stores a path string; resolution happens through the I/O manager

The important separation is link volume versus target volume. A target on a filesystem without reparse-point support is still a valid target. Only the link’s own volume must support the reparse point.

flowchart LR
    A["NTFS system volume<br/>junction link"] -->|reparse redirect| B["FAT32 data volume<br/>target directory"]
    C["FAT32 volume<br/>cannot host link"] -.->|native rejection| D["Operation fails"]

Observed behavior

The following were observed on Windows 11 with PowerShell 7 while building this project.

ScenarioCallObserved result
Link on an NTFS system volume targeting a directory on a FAT32 data volumeNew-Item -ItemType JunctionSucceeds; the link resolves to the target
Link path placed directly on the FAT32 data volumeNew-Item -ItemType JunctionFails; Windows returns a native error such as “Incorrect function” or an NTFS-required message
Target directory missingGet-Item on the linkReturns the link entry with LinkType = 'Junction'
Target directory missingNew-Item -ItemType JunctionFails because the target must exist
Target directory missingcmd /c mklink /JCreates a junction whose target is absent
Existing junction[System.IO.Directory]::Delete(path, $false)Detaches the link; target and contents remain
Junction with a missing target[System.IO.Directory]::Delete(path, $false)Detaches the link successfully

Exact error text varies by API, volume, and path. The product does not match on error strings; it surfaces the message unchanged.

API behavior

Inspection

Get-Item exposes reparse metadata through LinkType and Target:

$item = Get-Item -LiteralPath $Path -Force
$item.LinkType   # 'Junction'
$item.Target     # target path, or empty for some broken cases
$item.Attributes # includes ReparsePoint

A broken junction still returns an item, so stale links remain visible, inspectable, and removable. This is why the manager can report Stale-Orphaned and still act on the link.

Creation

New-Item -ItemType Junction is convenient but validates that the target exists. For broken-link fixtures and edge cases, mklink /J can create a junction to a missing target.

mklink /J requires cmd.exe, so the product’s normal creation path uses New-Item. The test kit falls back to mklink only where a broken link is required.

Detachment

[System.IO.Directory]::Delete($Path, $false)

The second argument is recursive: false. This deletes the reparse point itself. Passing $true is dangerous for links because it can traverse into the target and delete its contents. The product never uses a recursive delete on a junction path.

If the .NET call fails, the core retries with cmd /c rmdir "<path>", which also detaches the link rather than following it.

Target emptiness

Test-WjmTargetHasFiles walks the target recursively and stops at the first file. This is a content check, not a filesystem-type check. An empty directory is Stale-Empty regardless of the volume it lives on.

Why the product does not gate on filesystem type

A volume label is a poor predictor of whether a specific operation will succeed:

  • the link and target can live on different volumes;
  • a volume may support reparse points but reject a specific path due to ACLs, path length, or a filter driver;
  • the exact native error is more useful than a guessed “not supported” message;
  • new Windows builds and storage drivers change behavior over time.

The design therefore validates what it can know locally (path shape, protection, existence, containment) and then attempts the operation. The native result is the source of truth.

flowchart TD
    A[Request] --> B[Validate path shape, protection, existence]
    B -- invalid --> X[Reject with reason]
    B -- valid --> C[Attempt native operation]
    C --> D{Native result}
    D -- success --> E[Report success]
    D -- failure --> F[Surface native error]

Design consequences

DecisionReason
Status comes from target existence and content, not volume typeThe link and target may live on different filesystems
Create, retarget, and repair attempt the native callOnly Windows knows whether the path is accepted
Removal uses non-recursive deleteA recursive delete could follow the link into the target
Inspection uses the reparse entry, not the targetBroken links must remain visible and removable
Restore checks target existence and protection, not volume typeTargets may live anywhere local
Test fixtures attempt and assert on native resultsAvoids false skips and mirrors production behavior

Canonical references

Open questions

  • How do specific filter drivers and cloud-sync providers affect junction resolution for directories they manage?
  • Do any supported Windows configurations allow a junction link on a non-NTFS volume through a third-party filesystem driver?
  • How should the tool report a link whose reparse data is readable but whose target path is malformed?

These are tracked as research questions, not current behavior. The product continues to surface native results until a reliable, documented rule exists.