Blocks · Storage and file sharing

share/smb

SMB file share (paused). A Samba SMB3 share on a replicated volume. Deploys, but its failover has an open bug.

Overview

Serves one SMB3 share with Samba's smbd from a replicated volume, behind a stable VIP. The block is a singleton that runs where its volume's primary is, and runs as root, because smbd switches to the connecting user. Its whole state directory, .smb-state, is on the volume, and every write is synced before it is acknowledged (strict sync and sync always).

Paused. The share deploys and serves, but its failover has an open bug: writes after a failover are not reliable yet. For a share that fails over, use share/nfs.

Shape
Singleton on a replicated volume
Reached at
VIP
Node package
pkgs.samba

Fetched on demand: the first time a block of this type is placed on a node, its agent fetches pkgs.samba, built from the node's own nixpkgs so the NixOS binary cache serves it. That first placement needs network access (or a binary cache on the LAN) and waits for the download; later placements on that node start at once.

Example

smb.yaml
apiVersion: expanse.io/v1
kind: Block
metadata:
  name: share
  namespace: default
spec:
  type: share/smb
  replicas: 1
  strategy:
    kind: SINGLETON
  resources:
    requests:
      cpu: 100m
      memory: 128Mi
  storage:
    - name: share-data
      size: 10Gi
      replication: 3
      mountPath: /mnt/share
  config:
    port: 44445        # never 445: the VIP holder binds that
    shareName: share
    guestOk: true
  network:
    ports:
      - name: smb
        port: 445
        target_port: 44445
        protocol: tcp
        expose: EXPOSE_VIP
    health_check:
      readiness:
        type: PROBE_TCP
        port: 44445
        period_seconds: 2
$ expanse ctl block apply -f smb.yaml --dry-run   # validate only
$ expanse ctl block apply -f smb.yaml

Configuration

Keys go under spec.config and are checked against the type's JSON Schema when the block is applied. A default is what the block uses when the key is unset.

KeyDefaultMeaning
port445smbd's listen port. Exposed on a VIP, it must differ from the exposed 445, so set it, such as 44445.
shareNameshareThe share's name, as in \\host\share.
path.Share content directory, relative to the volume.
readOnlyfalseDeny writes.
guestOktrueAllow unauthenticated access; guests act as nobody.
validUsersnoneSpace-separated users allowed to connect. They need a Samba password already set; the block does not create accounts.
browseabletrueList the share in network browsing.

Using it

$ mount -t cifs //<VIP>/share /mnt/share -o guest

SMB3 is the minimum protocol.

When a node fails

The block, its volume's primary and its VIP move together to a survivor, as for the other singleton shares, and smbd starts there with its identity from the volume. Writes after the move are affected by the open bug, which is why the type is paused.

Limits

  • Failover has an open bug; the type is paused.
  • No account management: validUsers needs accounts that already have Samba passwords.

Source

All block types · Fields every block shares