Files
nomad/website/content/docs/commands/volume/create.mdx
Tim Gross fb93c41ba7 docs: expand info on built-in mkdir dynamic host volume plugin (#25524)
Describe the built-in `mkdir` plugin in the plugin concepts docs in a little
more detail. Crosslink to there from the `plugin_id` field docs, and clarify
that the `mkdir` plugin doesn't support the capacity request fields.

Update the example plugins to avoid using volume author controlled variables in
favor of Nomad-controlled ones, to reduce the risk of path traversal, and
explain to plugin authors they'll likely want to avoid this in their own
plugins.
2025-03-26 11:21:43 -04:00

98 lines
3.5 KiB
Plaintext

---
layout: docs
page_title: 'nomad volume create command reference'
description: |
The `nomad volume create` command creates storage volumes that are either
Container Storage Interface (CSI) volumes or dynamic host volumes.
---
# `nomad volume create` command reference
The `volume create` command creates storage volumes as either [Container Storage
Interface (CSI)][csi] volumes or dynamic host volumes.
The `volume create` command can create dynamic host volumes if host volume
plugins are installed on the node, or CSI volumes if the CSI plugins implement
the [Controller][csi_plugins_internals] interface. The `volume create` command
automatically [registers][] the volume as well.
## Usage
```plaintext
nomad volume create [options] [file]
```
The `volume create` command requires a single argument, specifying the path to a
file containing a valid [volume specification][volume_specification]. Nomad
reads the file and submits the volume to the server for placement. If the
supplied path is "-", the volume file is read from STDIN. Otherwise the file is
read from the file at the supplied path.
When ACLs are enabled, this command requires a token with the appropriate
capability in the volume's namespace: the `csi-write-volume` capability for CSI
volumes or `host-volume-create` for dynamic host volumes.
## General options
@include 'general_options.mdx'
## Volume create options
- `-detach`: Return immediately instead of entering monitor mode for dynamic
host volumes. After creating a volume, Nomad prints the volume ID to the
screen, which you can use to examine the volume using the `volume status`
command. If `-detach` is omitted or false, the command monitors the state of
the volume until it has been fingerprinted by the client and is ready to be
scheduled. Not valid for CSI volumes.
- `-verbose`: Display full information when monitoring volume state. Used for
dynamic host volumes only. Not valid for CSI volumes.
- `-policy-override`: Sets the flag to force override any soft mandatory
Sentinel policies. Used for dynamic host volumes only. Not valid for CSI
volumes.
## Volume specification
Refer to the [CSI Volume Specification][csi_vol_spec] and the [Dynamic Host
Volume Specification][host_vol_spec] for further information.
<!--
Redirection rules are applied server-side, so we can't redirect these sections
that used to be located in this page since they use URL fragments. Creating
these hidden anchors will at least point users to the new page, although not to
the exact section.
-->
<span id="volume-specification-parameters" />
<span id="id" />
<span id="namespace-1" />
<span id="name" />
<span id="type" />
<span id="plugin_id" />
<span id="snapshot_id" />
<span id="clone_id" />
<span id="capacity_min" />
<span id="capacity_max" />
<span id="capability" />
<span id="access_mode" />
<span id="attachment_mode" />
<span id="mount_options" />
<span id="fs_type" />
<span id="mount_flags" />
<span id="topology_request" />
<span id="secrets" />
<span id="parameters" />
<span id="topology_request-parameters" />
<span id="segments" />
<span id="unused-fields" />
[csi]: https://github.com/container-storage-interface/spec
[csi_plugins_internals]: /nomad/docs/concepts/plugins/storage/csi
[registers]: /nomad/docs/commands/volume/register
[registered]: /nomad/docs/commands/volume/register
[volume_specification]: /nomad/docs/other-specifications/volume
[csi_vol_spec]: /nomad/docs/other-specifications/volume/csi
[host_vol_spec]: /nomad/docs/other-specifications/volume/host