DGX Spark container persistence: bind mounts and recreation checks

DGX Spark container persistence: bind mounts and recreation checks

DGX Spark container persistence: bind mounts and recreation checks

A model evaluation finishes and produces results. You then delete the container to update the environment, only to find that the output directory is empty. In incidents like this, the inference program usually did save its output—but wrote it to the container’s writable layer, or the replacement container mounted a different host path. Before running a production workload on DGX Spark, verify persistence with a small test file. Do not use an entire batch of evaluation results to discover whether your storage configuration works.

1. Separate the container lifecycle from the data lifecycle

CGbps DGX Spark comes with 4TB NVMe storage, runs NVIDIA DGX OS, and uses the ARM64 architecture. This guide does not install an inference framework or use the GPU. It only checks directory mounts, file ownership, and container recreation in the local Docker environment. After payment, retrieve your connection credentials from the console and log in over SSH.

The container image supplies the software and base environment. The container’s writable layer is suitable for temporary changes. A bind mount maps a specific host directory into the container. Only a correctly configured bind-mounted path allows the data stored there to survive container deletion.

A bind mount is not a backup. The files remain on the same machine, so it does not protect against accidental deletion, host storage failure, or the end of the rental period. Data is erased when the DGX Spark rental expires. Export important data beforehand and verify it at the destination.

This test uses a separate directory, /srv/dgx-persistence-check. Do not substitute an existing model directory. The test containers also have dedicated names; the removal commands below target only those test objects.

2. Prepare a local image and an unprivileged identity

Run the following commands in the same Bash session. First, switch to an authorized, non-root operations account. Do not run the test processes as root. The account must be able to execute Docker commands. Access to the Docker daemon itself grants substantial privileges and must not be given to untrusted accounts.

Choose a team-approved Linux ARM64 image that is already present locally. It must contain /bin/sh, id, stat, and sha256sum. This procedure does not pull an image or rely on its default entrypoint.

test "$(id -u)" -ne 0 || exit 1
docker version
read -r -p 'Local image reference: ' IMAGE_REF
IMAGE_ID=$(docker image inspect --format '{{.Id}}' "$IMAGE_REF") || exit 1
PLATFORM=$(docker image inspect --format '{{.Os}}/{{.Architecture}}' "$IMAGE_ID") || exit 1
test "$PLATFORM" = linux/arm64 || exit 1

HOST_DIR=/srv/dgx-persistence-check
RUN_UID=$(id -u)
RUN_GID=$(id -g)

sudo install -d -m 0750 -o "$RUN_UID" -g "$RUN_GID" "$HOST_DIR"

docker run --rm --network none \
  --user "$RUN_UID:$RUN_GID" \
  --entrypoint /bin/sh "$IMAGE_ID" \
  -eu -c 'id; command -v stat; command -v sha256sum'

Using the image ID pins both tests to the same image content, even if a tag changes between runs. If the preflight check fails, add the missing tools to the test image or correct the access permissions. Do not switch to an image from an unknown source as a quick workaround.

This example assumes a local Docker installation without user namespace remapping. With rootless Docker or userns-remap, container UIDs cannot be treated as identical to host UIDs. Check the mappings before setting directory ownership; the ownership expectations below cannot be applied unchanged.

3. Write a sentinel file and inspect the mount source

First, run a container that writes only a short, fixed string. Specifying numeric UID/GID values avoids confusion caused by different usernames inside the image. Setting umask prevents new files from being accessible to other accounts by default.

docker run --name dgx-persist-write --network none \
  --user "$RUN_UID:$RUN_GID" \
  --mount "type=bind,src=$HOST_DIR,dst=/work" \
  --entrypoint /bin/sh "$IMAGE_ID" \
  -eu -c '
    umask 027
    printf "%s\n" "dgx-persistence-check-v1" > /work/probe.txt
    stat -c "%u:%g %a %n" /work/probe.txt
    cd /work
    sha256sum probe.txt > probe.sha256
  '

docker inspect --format \
  '{{range .Mounts}}{{printf "%s %s -> %s rw=%t\n" .Type .Source .Destination .RW}}{{end}}' \
  dgx-persist-write

stat -c '%u:%g %a %n' "$HOST_DIR/probe.txt"
(cd "$HOST_DIR" && sha256sum -c probe.sha256)

A successful final command is not enough to pass the check. The mount record must meet all of these conditions: the type is bind, the source is the expected host directory, the destination is /work, and read-write access is enabled during the write phase. The host file must be owned by the current test account, with permissions of 640.

Using --mount makes a missing host source path fail explicitly. This makes a typo easier to spot than an empty directory created by accident. If the destination path already contains files in the image, the mount hides them; it does not automatically copy them into the host directory.

4. Delete and recreate the container, then verify read-only access

Stopping and restarting the same container does not prove that the files are independent of its writable layer. You must delete the original test container, then create another container that reads the same host directory.

docker rm dgx-persist-write

docker run --name dgx-persist-read --network none \
  --user "$RUN_UID:$RUN_GID" \
  --mount "type=bind,src=$HOST_DIR,dst=/work,readonly" \
  --entrypoint /bin/sh "$IMAGE_ID" \
  -eu -c '
    cd /work
    sha256sum -c probe.sha256
    if touch /work/should-not-exist 2>/dev/null; then
      exit 1
    fi
    test ! -e /work/should-not-exist
  '

docker inspect --format \
  '{{range .Mounts}}{{printf "%s %s -> %s rw=%t\n" .Type .Source .Destination .RW}}{{end}}' \
  dgx-persist-read

docker rm dgx-persist-read

The checksum check in the new container must pass, the write attempt must fail, and the mount record must show rw=false. Together, these checks establish that the file survives container recreation, its contents remain unchanged, and the read-only restriction is actually enforced.

If the file cannot be read, compare the absolute host paths used by the two mounts first. Do not immediately copy files to “fix” the test. If checksum verification fails, preserve the current state and check whether another process has modified the files. If the read-only write attempt succeeds, the validation has failed. Inspect the actual runtime arguments and do not proceed with the production workload.

5. Apply the findings to your inference workflow

For production workloads, separate paths into at least three categories: input weights, output results, and temporary caches. Mount weights read-only when they do not need to be modified, and allow writes to a separate results directory. Caches may be rebuilt, but confirm that the application does not write its only copy of the results into a cache.

The output path in the application configuration must explicitly point to the mount destination. A “saved successfully” message proves only that a write completed, not that the path is inside a bind mount. Whenever you change the startup script, spot-check the mount records and newly created files on the host.

Do not resolve permission errors by recursively opening access to every directory. First check the failing path, host ownership, the container’s numeric identity, and execute permissions on parent directories. If an image upgrade changes the runtime user, repeat the sentinel test. Do not make the weights and results directories world-writable just to get the workload to start.

Keep a final validation record containing the image ID, mount source and destination, UID/GID, test exit status, and verification results. Checksums can detect content changes, but they cannot establish that a file comes from a trusted source. Export the production results manifest off the machine along with the data.

Successful container recreation is only the first boundary to verify. After the production evaluation finishes, wait for the result files to be closed before generating an export manifest, then read back and verify the files at the destination. Only after the output paths, permissions, reads after recreation, and off-machine copies have all been checked can container updates be treated as separate from data retention.

Frequently asked questions

Does seeing an output file inside a container prove it is persistent?

No. The file may still be in the container's writable layer. Inspect the mount type, host source and container destination, delete the test container, then read the same host directory from a new container and verify the checksum.

Will a bind mount preserve data after the DGX Spark rental expires?

No. A bind mount writes to the same machine, not to an external backup. DGX Spark data is cleared at expiry, so export weights, results and environment records beforehand and validate them at the destination.

AMD EPYC 7543P Dedicated Server

From $455.2/month

Dedicated Servers Configured for Your Workload

Compare memory tiers, storage, and connectivity requirements, then review the details on the configuration page.