Search code examples
ravendbravendb-studio

How do I change the location for a (single) filesystem in Ravendb?


My task: to move the directory containing the databases and filesystems for a Ravendb-installation from one drive to another (because of disk-space issues) without moving or altering the Ravendb-installation itself.

I managed to move the databases by:

  1. shutting down the Ravendb service
  2. Moving the data-folder containing the subfolders Databasesand FileSystems
  3. Opening Raven.Server.exe.config and changing the value for the settings Raven/DataDirand Raven/FileSystem/DataDir
  4. Starting the Ravendb service again
  5. Tricky part: going to some (not all) databases using Raven Studio and choosing Settings > Database Settings and changing the value here (again) for Raven/DataDir. So apparently, somehow, for some of my databases, this value was overridden in some metadata for the db itself rather than using the tilde to look relatively to the global setting (although the actual db or db definition or something was being loaded correctly, since I could even see this setting/value)

enter image description here

So far so good. But here the problem:

Apparently, too, for some filesystems (again not all), Ravendb seemed to think, their "data-data" was still in the old location (again, the actual filesystem metadata seemed to be loaded from the new location). But alas, filesystem do not have something similar to Database Settings in Raven Studio where I could change this data-dir, probably overridden here too.

The way I know the filesystems' data is assumed to still be in the old location, is that I can see new folders being created in the old location with the name of the respective filesystems.

I tried going to the system db (Main Window > Manage Your Server > To System Database), but the file-systems do not appear here.

So my question is: how can I change or set the Raven/FileSystem/DataDir setting for a single filesystem?


Solution

  • Eureka, I found this out:

    The error was indeed, that for some reason, my filesystems do not appear in the system db when viewed in Raven Studio. I realized this, because the status-bar in the system db said 40 documents, but fewer were visible in the list. This must definitely be a bug in Raven Studio.

    The solution: In system db, put my mouse cursor in the quick-goto-/search-field in the top ("Go to document") and typed Raven/FileSystems/ and from here on, the autocomplete would show me the available filesystems. Choosing the correct filesystem, I was now able to edit the (indeed overridden) path to the filesystem, which was set to an absolute path.

    enter image description here

    Note, that in general you should definitely use a path relative to the Raven/DataDir and Raven/FileSystem/DataDir settings, like e.g. ~\filesystems\my-db to more easily be able to move all dbs and fs'es around collectively.