Opening the same vault in multiple instances with bind mounts (linux)

Been thinking about symlinks, file syncing, and bind mounts. Was looking for a bit of a hack to solve opening multiple instances of the same vault (or workaround to Option for pop-out windows to have panes as main window like file explorer and outline)

Just got this solution working and think it will work for me. My main consideration was making sure all data are shared except the .obsidian settings folders are independent copies.

cd path_to_vaults

# make a copy of your vault settings that will be read/writable for the 2nd vault
cp -r my_vault/.obsidian settings_copy

# step 1: bind mount the original vault onto a new folder
mkdir my_vault2
sudo mount --bind my_vault my_vault2

# step 2: we don't want to share the .obsidian folder
# so make the mount private, then do another bind mount for settings 
sudo mount --make-private my_vault2
sudo mount --bind settings_copy my_vault2/.obsidian

# test - confirm that writing into my_vault2/.obsidian does not modify my_vault/.obsidian

This results in near instantaneous changes in one obsidian instance reflected in the other.

Settings could either be synced periodically, or the first vault could be the “main” and just rsync --delete it over.

Another runner-up solution I found, was using unison with this 1 liner to keep 2 folders synced, using it’s built in file-watcher.

unison -auto -batch -repeat watch -times my_vault my_vault2

Note it will conflict on .obsidian/workspace and not sync that file.

Unison could also be used to sync the settings_copy folder above.