Cannot move notes across mount points

Steps to reproduce

Create a new empty folder.

mkdir ~/TheVault

Mount a temporary RAM disk inside a subfolder:

mkdir ~/TheVault/mounted

sudo mount -o size=1M -t tmpfs none ~/TheVault/mounted

Now, open the ~/TheVault as a vault in Obsidian.

In Obsidian create TheVault/mounted/note.md and try to move it to TheVault/note.md.

Did you follow the troubleshooting guide? [Y/N]

Yes.

Expected result

The note is moved to the target folder.

Actual result

The file is not moved and no error is displayed to the user.

Environment

openSUSE Linux, KDE Plasma
Obsidian 1.5.8

Additional information

This problem happens on MacOS and Linux. This reduces the possibility of using the program in combination with network drives, mobile drives, encrypted drives.

Here is a clarification and solution to the problem: Obsidian just have to move files instead of renaming them.

Without that Obsidian does not implement the simplest file operation properly. For a program whose function is to organize notes, it is a drawback.

The link you pointed to refers to low level C system calls, but we are way up the abstraction stack. I am not sure what notejs uses.

There is also the problem of if/how directory watching event work when some subdirectories could be in a different device.

This is beyond what we currently support, so I don’t consider this a bug. You can open a Feature Request. Thanks

  • For me, event watching in Obsidian works quite well, even with such mount points. Changes to files are somehow quickly picked up in the GUI.
  • Moving a file between mount points is extremely simple (1) read the file content into a string (2) save the string to a new file (3) delete the old file. It does not require any low-level calls.
  • Obsidian doesn’t need to detect mount points. If we tried to move the file, but it didn’t move, this is probably the situation for a workaround, so we retry moving by read-write-delete.

I am not sure whether it a new feature. After all, this is not low-level support for sophisticated file systems. Just a fix for a semi-working move operation.

It’s very likely that Obsidian ends up using a low level move operation provided by the operating system, and these in general do not like to move files across mount points.

Although a move could theoretically be moved like you suggest, that would remove some file statistics, and potentially not be atomic changes and thusly allow for race condition issues. There are other reasons, but all in all its better for Obsidian to use the move operation they’re using.

Alas, that leaves you with the workaround of doing this operation manually through copy- paste like you suggest, or using the file system app to move files.

Without actually knowing this internal tidbit of Obsidian, I believe it considers any given vault to be within one file system and behaves accordingly. So having extra mount points within the vault can cause issues/features like this, which aren’t bugs per se, but would need a different base approach related to file handling.

It would be great if Obsidian, as you say, implemented low level move operation. Because move doesn’t have any problems with mount points.

The problem is that Obsidian uses the rename operation, not the move operation.

Move allows you to move files from disk to disk, while Rename only allows you to change the name within one file system.

The Rename operation is imposed by the JavaScript platform. In some cases, JavaScript is a great compromise. But it is not native to the desktop. And if the developer has chosen such a platform, he will sometimes have to do additional work, grinding off sharp corners, adding his own work-arounds.

I think you’ve got it the wrong way around here. In my experience/knowledge you can’t move across mount points. You’ll need to copy-and-delete.

We both did not specify what exactly we mean by Move.

I was talking about the CLI utility mv, which is definitely part of the OS. It is also part of the POSIX standard, which macOS and Linux follow. mv moves files between mount points without problems (I just double-checked this on a couple of files).

There is also a standard library function rename, and it has the same problems as Obsidian when it comes to actually moving files.