Skip to content

Virtualbox Shared Directories

David Anderson edited this page Dec 7, 2023 · 7 revisions

Client directory structure

Review: the client directory structure looks like

projects/
    einsteinathome.org/
        file_physical_name
        ...
slots/
    0/
        file_logical_name
        ...
    ...

Each job runs in its own slot directory. The files in the slot directory are (by default) "link files" that point to files in the project directory (sort of like symbolic links).

This has the advantage that if there's a big input file, we don't need to copy it into the slot directory. And if there are multiple concurrent jobs that use the file, they share a single copy of it.

VBox apps (current)

If a VBox app has either input or output files, they're passed into and out of the VM via a directory named "shared" that (on the host) is in the slot directory, and (in the VM) is mounted typically at root/shared.

Input files are copied (by the Vboxwrapper) from the project directory into the shared directory before the job starts. When the job is done, Vboxwrapper moves the output files from the shared directory to the project directory.

VBox apps (proposed)

The above design is inefficient in terms of both time (copying) and space (duplicate files). I propose the following alternative:

  • There's no 'shared' directory.
  • Vboxwrapper shares the slot directory with the VM (/root/slot)
  • Vboxwrapper shares the project directory with the VM (/root/project)
  • We supply a script boinc_resolve (in the VM) that converts a link file (in /root/slot) to the path of the corresponding physical file (in /root/project).

For example, if the VM runs a program prog that takes an input file and produces an output file, with logical names in and out, it would do

#! /bin/sh
cd /root/slot
inpath=`boinc_resolve in`
outpath=`boinc_resolve out`
prog $(inpath) $(outpath)
Clone this wiki locally