Skip to content
← Back to writing

August 25, 2025

I killed Windows support and saved 11 days

Dropping Windows from a NAS operating system meant deleting code that worked. It returned a fake C: drive when no real storage was found, on a product that only ever ran on Linux.

The lie in the codebase

git show --stat for the two real commits from the archived homelabarr-cli repo: e9f207343 (<button type="button" class="ticket-ref" data-ticket="HL-251">HL-251</button>, storage detection, 47 insertions/246 deletions) and 699828348 (<button type="button" class="ticket-ref" data-ticket="HL-252">HL-252</button>, system metrics).

The storage audit I ran on August 25 flagged it on lines 1863 to 1869 of simple-server.go:

// Return mock data if no real storage found
if len(storage) == 0 {
    storage = []StorageInfo{
        {Type: "mock", Mount: "C:", Label: "System", TotalGB: 500, UsedGB: 200, FreeGB: 300, Percentage: 40, Category: "SSD/Cache"},
        {Type: "mock", Mount: "D:", Label: "Data", TotalGB: 2000, UsedGB: 1500, FreeGB: 500, Percentage: 75, Category: "Storage Array"},
    }
}

When the storage API found no real drives, it returned this. A fake C: drive. On a NAS operating system. The audit's note was blunt: "If no real storage is detected, the system shows FAKE storage data." And the only place real detection reliably failed was Windows, because MergerFS is Linux-only and the full pooling stack only comes together on Linux.

I had been developing on Windows because that is what my main workstation runs. A Ryzen 9 desktop with 64GB of RAM. But the product is a NAS operating system, and NAS operating systems run on Linux or BSD. Unraid is Linux. TrueNAS is BSD and Linux. OpenMediaVault is Debian. The storage subsystems that make NAS software work, MergerFS and the parity layer on top, are Linux-native. The mock C: drive was the codebase admitting that the platform I built on was not the platform the product would ship on.

The audit

I ran a storage implementation audit before spending money to validate on a second UGREEN box. The headline was that the Windows path was the most complete part of a system that did not run on Windows. The audit's own table put "Windows Storage Detection" at 90% and "Linux Storage Detection" at 40%, basic df parsing only. I was maintaining two storage backends, and the better one belonged to a platform I was never going to deploy to.

The Windows detection was a fully built PowerShell pipeline. Get-PhysicalDisk to enumerate disks, Get-Partition to build a drive-letter-to-disk-number map, then a per-drive walk to resolve SSD versus NVMe versus HDD from the cached MediaType and BusType. Real, working, and load-bearing for a use case that did not exist.

// BEFORE: simple-server.go storage detection (Windows path)
if strings.Contains(strings.ToLower(os.Getenv("OS")), "windows") {
    psCmd := exec.Command("powershell", "-Command", `
        $allPhysicalDisks = @{}
        $allPartitions = Get-Partition -ErrorAction SilentlyContinue
        Get-PhysicalDisk -ErrorAction SilentlyContinue | ForEach-Object {
          $allPhysicalDisks[[int]$_.DeviceId] = $_
        }
        # Build partition to disk mapping
        $partitionToDisk = @{}
        foreach ($partition in $allPartitions) {
          if ($partition.DriveLetter) {
            $partitionToDisk[[string]$partition.DriveLetter] = $partition.DiskNumber
          }
        }
        # ... resolve MediaType/BusType per logical disk ...
    `)
    // parse pipe-delimited PowerShell output, 7 fields per drive
}

That [[string]$partition.DriveLetter] cast is there because Windows hands you the drive letter as a char and the lookup table wants a string. It is the kind of platform-specific seam that only exists because two operating systems describe disks differently, and that you carry forever once it is in.

The decision

I killed it. Three Jira tickets: for the migration plan, for the storage detection, for the system metrics. Linux-only architecture. Remove the Windows code, the PowerShell paths, the platform detection branches, and the mock storage that only ever appeared when those paths failed.

This was uncomfortable for a PM. The instinct is to maximize the addressable market, and Windows has the desktop majority, so dropping it reads like dropping most of your potential users. But that math is wrong for this product, because none of those Windows desktops are NAS deployments. The migration plan put the competitive set plainly: Unraid Linux-only, TrueNAS BSD and Linux, OMV Linux-only. There is no Windows NAS OS to lose share to.

The replacement was simpler than what it replaced. The whole PowerShell disk pipeline became a which snapraid check followed by df parsing:

// AFTER: Linux-only storage detection
snapraidCmd := exec.Command("which", "snapraid")
if snapraidCmd.Run() == nil {
    poolCmd := exec.Command("df", "-h", "/mnt/storage")
    if output, err := poolCmd.Output(); err == nil {
        // parse the MergerFS pool line, mark it Type: "snapraid"
    }
}

// regular Linux mounts under /mnt/*
cmd := exec.Command("df", "-h")
// ... append each /mnt mount, categorize by name (parity/cache/disk) ...

The mock fallback went with it. If detection finds nothing now, you get nothing, not a fake C: drive.

That commit was e9f207343: one file changed, 47 insertions, 246 deletions. The system metrics followed in 699828348, which ripped the PowerShell network and CPU queries out of system-metrics.go and replaced them with /proc/net/dev and /proc/loadavg reads. The Docker integration lost its Windows branch too:

// BEFORE: docker-integration.go
if runtime.GOOS == "windows" {
    if _, err := exec.LookPath("docker.exe"); err == nil {
        dm.dockerCmd = "docker.exe"
    } else if _, err := exec.LookPath("docker"); err == nil {
        dm.dockerCmd = "docker"
    }
} else {
    dm.dockerCmd = "docker"
}

// AFTER
// Linux-only: Use docker command
dm.dockerCmd = "docker"

And the //./pipe/docker_engine named-pipe socket path went the same way. Every one of these was a branch that resolved differently on Windows for no reason that mattered anymore.

The eleven days

The migration plan's business-impact section is where the title comes from. Before: about two weeks of debugging Windows issues to get a clean build. After: a few days to a clean Linux build. Net savings, eleven days of development on a runway that does not have many spare elevens in it. The whole removal across storage, metrics, and Docker happened in a single session.

What I deleted was not broken. It compiled, it ran, it correctly enumerated the disks in my Windows desktop. That is what made it hard to cut. A backlog item you say no to never existed. This code existed, I wrote it, and it worked. It was just solving the wrong problem, which is a much quieter kind of wrong than a bug.

The Windows code also made a claim it had no right to make. Anyone reading the repo would assume Windows was a supported platform, which means every future change would have to keep it working, which means the tax compounds with every contributor who touches storage. Removing it deleted more than lines; it deleted a promise the codebase was making on my behalf.

I still develop on the Windows machine. I just build for Linux and test in a container or on a VM. The development platform was never required to match the deployment platform. I spent a few weeks proving that to myself the expensive way before the audit said it back to me in a table.

homelabarr.com