4

I was wondering if MacOS Mojave (the most recent version I can be on due to some very expensive 32 bit applications) has a way to set up a "virtual" dir, or even virtual drive, that combines two or more external drives and surfaces them as if they're one directory/drive.

E.g. something that lets me say "create a virtual dir/drive called audio data" (that isn't JBOD/RAID0) and then specify two (or more) external SSDs such that the content of that dir/drive is the combined content of the solid state drives. If one has dirs Pro Logic data and Cubase data and the other has dirs Kontakt and Samples, then I'd like a single virtual dir/drive that shows:

--- data
 |--- Cubase Data
 |--- Kontakt
 |--- Pro Logic Data
 |--- Samples

When both SSD are connected, or if one of them's not connected, show

--- data
 |--- Cubase Data
 |--- Pro Logic Data

or

--- data
 |--- Kontakt
 |--- Samples

depending on which drive's still accessible. Or a flatout empty dir/drive if nothing's connected.

With the explicit intent that if the SSDs that house dirs that some applications rely on aren't connected, then yes: those applications will throw errors. That's fine, and expected. I just want something that lets me surface a ton of data spread over multiple drives as a single dir/drive when they're all connected, with each SSD being "just a drive" that can also be connected to any random other computer that knows how to read/write the SSD's filesystem.

8
  • 1
    Can you just symlink/alias the unique top level directories? Sep 26, 2021 at 22:57
  • Not really, given that each drive doesn't have just two dirs. I'm looking for a "I don't need to care about how many dirs are in each drive, I need all of them listed in this virtual dir/drive". Sep 26, 2021 at 23:05
  • 1
    The only way I can think of to achieve this is to create the directories on the drives you want and create corresponding alias on the other drive. If you frequently create new dirs, possibly automate the process with Automator or a shell script. Sep 27, 2021 at 0:23
  • That's not really an answer to the question though (even as a comment =). Of course I can script something, the whole point is not to script something. Sep 27, 2021 at 1:47
  • 2
    Using symlinks or aliases is the Unix/macOS way to go here, as is scripting :-) How should the solution handle duplicate names (directories with the same name existing on several drives)? How can the solution identify the drives relevant for the virtual directory?
    – nohillside
    Sep 27, 2021 at 5:52

1 Answer 1

0

To create a combined directory, run

find /path/to/volume1 /path/to/volume2 -type d -mindepth 1 -maxdepth 1 \
    -exec ln -s '{}' '/path/to/virtualfolder/' \;

This will not take care of any duplicates, it will also not create the virtual folder (do this before running find).

2
  • 1
    If I'm reading this correctly, though, this needs to be rerun anytime a new top level dir is added/removed on any of the drives? (i.e. it's a one-time dir find that then creates a batch of symlinks). What would be the "best" way to make this run (and remove dirs that no longer exist. Rare, but will happen) when SSDs connect/disconnect? Sep 27, 2021 at 15:50
  • Gotcha. Would this sync removals too? or would this require an rm -rf followed by an mkdir for the virtual folder before rerunning? Sep 27, 2021 at 16:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .