Skip to content

Add SMB volume driver via direct guest CIFS mount - #1414

Closed
tonycoco wants to merge 1 commit into
apple:mainfrom
tonycoco:feature/smb-volume-driver
Closed

Add SMB volume driver via direct guest CIFS mount#1414
tonycoco wants to merge 1 commit into
apple:mainfrom
tonycoco:feature/smb-volume-driver

Conversation

@tonycoco

@tonycoco tonycoco commented Apr 12, 2026

Copy link
Copy Markdown

Add NFS and SMB volume drivers via direct guest mounts

Adds --driver nfs and --driver smb to container volume create. Both drivers mount network shares directly inside the Linux guest rather than going through virtiofs, eliminating the host-side mount hop.

When a volume is created with --driver smb or --driver nfs, no block image is created. The share path and options are stored as volume metadata. At container start, Utility.swift resolves the volume into a Filesystem.smb or Filesystem.nfs mount, which SandboxService.swift translates into a .any guest mount with type cifs or nfs respectively.

Usage:

SMB

container volume create --driver smb \
  --opt share=//192.168.1.1/Media \
  --opt username=user \
  --opt password=secret \
  --opt vers=3.0 \
  myshare

NFS

container volume create --driver nfs \
  --opt share=nas.local:/exports/data \
  --opt addr=nas.local \
  --opt vers=3 \
  --opt proto=tcp \
  myexport
container run -v myshare:/media alpine ls /media

Boolean mount flags (e.g. nolock, mfsymlinks) can be passed as --opt nolock= with an empty value and are serialized as bare flags in the mount data string.

Kernel requirement

This depends on a pending change to apple/containerization. The default guest kernel ships with CONFIG_CIFS=y disabled. A PR to that repo is needed to enable it in kernel/config-arm64 — without it, SMB mounts fail at runtime with errno 19 (ENODEV). NFS (CONFIG_NFS_FS) is already enabled in the current kernel config but is not compiled into the shipped kernel binary, so a rebuild is required for both drivers to work end-to-end.

The required containerization change is a single line in kernel/config-arm64:

# Before
# CONFIG_CIFS is not set
# After
CONFIG_CIFS=y
# CONFIG_CIFS_STATS2 is not set
CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y
CONFIG_CIFS_UPCALL=y
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
# CONFIG_CIFS_DEBUG is not set
CONFIG_CIFS_DFS_UPCALL=y
# CONFIG_CIFS_SMB_DIRECT is not set

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

#1413

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@tonycoco
tonycoco force-pushed the feature/smb-volume-driver branch 2 times, most recently from afb3797 to 68ff885 Compare April 12, 2026 16:22
@tonycoco
tonycoco marked this pull request as ready for review April 12, 2026 16:29
Add --driver smb to container volume create. SMB volumes store the
share path and credentials as metadata with no block image. At
container start, they are resolved into a cifs mount directly inside
the Linux guest rather than going through virtiofs.

Supported driver opts: share, username, password, domain.
@tonycoco
tonycoco force-pushed the feature/smb-volume-driver branch from a2d6677 to b7498f3 Compare April 14, 2026 16:34
@tonycoco tonycoco closed this Apr 18, 2026
dcantah pushed a commit to apple/containerization that referenced this pull request May 3, 2026
## Summary

Enables CIFS (SMB) filesystem support in the arm64 kernel config,
required for the SMB volume driver added in apple/container#1414.

Without this change, SMB mounts fail at runtime with `errno 19
(ENODEV)`.

## Changes

- `kernel/config-arm64`: enable `CONFIG_CIFS=y` and related options
(`CIFS_ALLOW_INSECURE_LEGACY`, `CIFS_UPCALL`, `CIFS_XATTR`,
`CIFS_POSIX`, `CIFS_DFS_UPCALL`)
simone-panico pushed a commit to simone-panico/containerization that referenced this pull request May 19, 2026
## Summary

Enables CIFS (SMB) filesystem support in the arm64 kernel config,
required for the SMB volume driver added in apple/container#1414.

Without this change, SMB mounts fail at runtime with `errno 19
(ENODEV)`.

## Changes

- `kernel/config-arm64`: enable `CONFIG_CIFS=y` and related options
(`CIFS_ALLOW_INSECURE_LEGACY`, `CIFS_UPCALL`, `CIFS_XATTR`,
`CIFS_POSIX`, `CIFS_DFS_UPCALL`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants