Folder mirroring

Usually, applications and their data are pointed at a RAM FS volume. Folder mirroring offers the opposite: a RAM FS volume is pointed at an existing folder, and that folder starts running in memory at its own path. Nothing has to be reconfigured, as the source location of the folder stays the same, only now it lives in RAM, with its changes written back to the disk.

Mirroring suits the data that is read and rewritten heavily while needing to reside on disk as ordinary files: source trees and build directories, working sets of images or video, test databases.

How to set up folder mirroring

In the Add Volume dialog, click the Use a source folder instead link in the Volume Information section and pick the folder. The dialog shows the folder size and file count, and warns if it will not fit, and you should allow room for growth as well.

Tick Save changes to the source folder at shutdown if you want the changes to be persistent, and Create automatically at startup if you want to mirror the folder from boot, without launching the RAM FS application.

Requirements

One RAM FS volume mirrors one folder, in place of an image file or the automatically-created folders list. The mirrored folder must be on a local NTFS disk that is not removable. Certain locations cannot be mirrored: system folders such as Windows, Program Files and ProgramData, the root of a user profile (any folder inside it is fine), cloud-synced folders downloaded on demand, and folders already mirrored by another volume.

How it works

When mirroring a C:\Example folder into a RAM FS volume on R:\, the mirrored folder contents are located in the root of the RAM FS volume, so the original folder path C:\Example and the RAM FS volume path R:\ point to the same data. A file written via one path is instantly available via the other.

During file-opening operations, using the original folder path causes a redirect every time a file is opened, whereas using the RAM FS drive letter avoids such redirects. This difference is not noticeable in light use, but a job that opens thousands of files, such as a build, is better pointed at the drive letter. Reading and writing operations are equally fast via either way.

Event What happens
At mount The contents of the C:\Example folder are loaded into the RAM FS volume R:\. The folder itself is renamed to a hidden copy alongside it, C:\Example becoming C:\Example.ramfs, and the original path is turned into a junction to the volume.
While mounted Everything that opens C:\Example reaches the files in RAM, as does R:\ itself. The hidden folder copy is held so that it could not be moved or deleted, and the RAM FS volume keeps the authority over its contents.
On save What has changed since the last time is written back into the hidden copy on disk.
At dismount The junction is removed and the hidden copy is renamed back to C:\Example, turning it into your ordinary folder again that also contains the changes.
After a power loss The swap is recognised and resolved at the next mount of the volume, so a crash or power loss event never leaves the folder stranded.

The loading into RAM happens before the RAM FS volume appears, thus protecting applications from partially-filled data. If the contents do not fit into RAM, the mount leaves the folder intact on disk.

Saving the changes back on disk

Writing the changes back to the mirrored folder uses the same triggers as saving to an image file: on demand, every N minutes, at dismount, and at shutdown. Untouched files are not rewritten, and renaming a folder with thousands of files causes only one rename operation on disk. Deletions propagate too, so the disk always ends up matching the volume. The main window shows when a volume was last written back.

For saving, the Save changes to the source folder at shutdown option must be enabled in the Adding a volume dialog. Without it, the changes stay in memory only and will be discarded on shutdown, reboot, or dismount.

Mirroring without saving

The folder is loaded into RAM and becomes very fast to work with. On dismount, reboot, or shutdown everything is discarded, and the original folder reappears untouched. This can be useful as a safe way to run a build or a test suite against real data that remains unmodified after the job is done.

While a volume is mirroring a folder

The mirrored folder can be accessed through its original path or via the RAM FS volume drive letter. The hidden copy of the folder is the disk-side mirror, not a second place to edit: the volume is the authority, and anything changed on disk will be undone at the next volume saving. To work with the files on disk, dismount the volume first.

If a file cannot be copied

A file that could not be loaded at mount is listed in the RAMFS-SYNC-ERRORS.txt file in the root of the volume. A file that cannot be written back on disk is retried at the next save. In both cases the last successful version of the file on disk is preserved.

If a dismount is refused

If the final saving operation cannot complete because another program holds a file on disk open, the dismount is refused and the volume stays mounted with everything intact. Close that program and dismount again.