An Unraid plugin that keeps folder listings and file details in RAM, so browsing your shares doesn't spin up sleeping disks.
It replaces the Dynamix Folder Caching (cache_dirs) plugin, which on current Unraid versions often fails to keep disks asleep.
The original plugin runs find over your shares in a loop. That has three problems:
- It only caches folder names.
findnever stats files, so file sizes and dates are not cached. When SMB or the file browser opens a folder, it reads those details and the disk spins up anyway. - It can't tell when disks are idle. It relies on an
mdcmdfield that no longer reports reliably, so its adaptive logic runs blind. - It wakes disks itself. It scans every disk every few seconds whether or not it's asleep, and if the cache was evicted, the scan is what spins the disk up.
Cache Directories 2.0 is a small Rust daemon that:
- stats every entry, so both folder listings and file details stay cached;
- checks each disk's spin state before touching it;
- measures exactly what each refresh itself read from disk (per-thread I/O accounting), so it knows when a cache was lost and never blames other programs using the disk;
- if a refresh ever had to wake a sleeping disk, logs it and leaves that disk alone while asleep for an hour (doubling up to 24 hours). On ZFS, which reads from its own kernel threads, this can't be measured exactly, so it isn't reported;
- skips SSD/NVMe array disks and pools by default (they never spin down), and supports extra mount points such as Unassigned Devices or SnapRAID disks;
- protects the cached metadata from being reclaimed (cgroup v2
memory.min), so programs using lots of memory push out other caches first. Not available for ZFS, whose metadata lives in its own cache (ARC); - restores
vm.vfs_cache_pressurewhen stopped.
Disable or uninstall the original Folder Caching plugin first.
In Unraid, go to Plugins → Install Plugin and paste:
https://raw.githubusercontent.com/adolfotregosa/cache.dirs2/main/cache.dirs2.plg
Then open Settings → Utilities → Cache Directories 2.0, set Enable folder caching to Yes, and apply.
Requires Unraid 7.3 or later.
The settings page shows a live table for each disk: its state, how many entries are cached, when it was last refreshed, and how long that took. The Note column only shows something when a disk needs attention. If it ever says woken by refresh, a sleeping disk had lost its cache and the refresh had to wake it. If that repeats, exclude large folders you rarely browse, lower cache pressure, or add RAM.
B=/usr/local/emhttp/plugins/cache.dirs2/bin/cachedirs2
$B --targets --config /boot/config/plugins/cache.dirs2/cache.dirs2.cfg # what gets cached
$B --scan /mnt/disk1/Media # run twice: 2nd run should show 0 reads
Logs go to syslog with the tag cachedirs2.
VERSION=2026.10.29 src/build.sh
Needs cargo. The script writes the package to packages/ and regenerates cache.dirs2.plg from src/plugin/cache.dirs2.plg.in. Add a changelog entry to the template before building a new version.
cache.dirs2.plg plugin file Unraid installs (generated by build.sh)
packages/ built .txz packages
src/rust/ the cachedirs2 daemon
src/plugin/ settings page, service script, event hooks, .plg template
src/build.sh builds the binary, package and .plg
Inspired by cache_dirs by Joe L., Alex R. Berg, Bergware and Dan Landon. This is a new implementation; no code was copied.
Claude was used to create this plugin.
GPL-2.0