dcos storage volume create

ENTERPRISE

Create a volume.

dcos storage volume create

Create a volume.

Synopsis

Arguments:

<name>     The name of the volume being created. The name must be unique
           throughout the DC/OS cluster. It is a string of up to 128
           characters. The name must consist of characters from
           `[A-Za-z0-9\-]`, and must start with a letter.
<capacity> The size of the volume. The value ends in M, G or T to indicate
           MiB, GiB and TiB respectively.
<profile>  The name of the volume profile to use for this volume.

<path>     A URL or local path to the volume definition JSON. If this is
           omitted the volume JSON is read from STDIN. Must not be
           specified if any command-line options are provided.

A DC/OS Storage volume is a Linux volume that may be consumed by a DC/OS service. Every volume is described by a volume profile which defines the volume’s properties. Every volume is created by a volume provider.

A volume is created by specifying the name of the volume, its size and the volume profile which describes it.

You can create a volume by specifying the name, capacity and profile fields, as well as the optional node and provider fields. You can specify these fields using command-line arguments or by providing a JSON document. If JSON configuration is provided, it is read from <path> or from STDIN if no <path> is specified. If JSON is provided on STDIN and command-line arguments are also, the JSON is ignored.

If JSON is provided, it must consist of the following fields: name, capacity-mb and profile. These fields correspond to the --name, --capacity and --profile command-line arguments accepted by this command. The capacity-mb field, unlike the --capacity command-line argument, must be an integer value corresponding to the capacity in MiB of the volume. The node and provider fields, which correspond to the optional --node and --provider command-line arguments, may also be specified.

Read more about volume providers by running “dcos storage provider --help”. Read more about volume profiles by running “dcos storage profile --help”.

For example, imagine you have a volume profile called fast which selects volume providers that are backed by SSDs. Specifying the fast volume profile when you create a volume will ensure that your volume will be allocated from SSD-backed storage.

dcos storage volume create [--name <name> --capacity <capacity> --profile <profile> | <path>] [flags]

Examples

  1. Create two similar volume providers, each on a different node. Then create a volume profile called fast that selects volume providers that are backed by SSD storage. Finally, create a SSD-backed volume without selecting a specific provider and another where a particular provider is specified:
# Create a 'ssds-1' volume provider on c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S1,
# where xvdb and xvdc are both SSDs. Label this provider as '{"latency": "low"}'
# to indicate to ourselves that this is low-latency high-performance storage.
cat <<EOF | dcos storage provider create
{
    "name": "ssds-1",
    "spec": {
        "plugin": {
            "name": "lvm",
            "config-version": 1
        },
        "node": "c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S1",
        "plugin-configuration": {
            "devices": ["xvdb", "xvdc"]
        },
        "labels": {"latency": "low"}
    }
}
EOF
# Create a 'ssds-2' volume provider on c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S2,
# where we know xvde is a SSD.
cat <<EOF | dcos storage provider create
{
    "name": "ssds-2",
    "spec": {
        "plugin": {
            "name": "lvm",
            "config-version": 1
        },
        "node": "c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S2",
        "plugin-configuration": {
            "devices": ["xvde"]
        },
        "labels": {"latency": "low"}
    }
}
EOF
# Create a volume profile called 'fast' which selects volume
# providers that provide SSD-backed storage capacity.
cat <<EOF | dcos storage profile create
{
    "name": "fast",
    "spec": {
        "provider-selector": {
            "plugin": "lvm",
            "matches": {
                "labels": {"latency": "low"}
            }
        },
        "mount": {}
    }
}
EOF
# Create a SSD-backed volume. This volume may be created on
# c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S1 or on
# c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S2.
dcos storage volume create --name my-volume-1 --capacity 10G --profile fast

# Create a SSD-backed volume. This volume may be created by any 'lvm' volume
# provider running on node 'c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S1' and is
# backed by SSD storage.
dcos storage volume create --name my-volume-1 --capacity 10G --profile fast \
  --node=c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S1

# Create a volume backed by the 'ssds-2' volume provider
# on c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S2.
dcos storage volume create --name my-volume-1 --capacity 10G --profile fast \
  --provider=ssds-2 --node=c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S2

# We can also create a volume by providing JSON
cat <<EOF | dcos storage volume create
{
    "name": "my-volume-2",
    "capacity-mb": 10240,
    "profile": "fast",
    "node": "c67efa5d-34fa-4bc5-8b21-2a5e0bd52385-S2"
}
EOF

Options

Name Description
--capacity string The size of the volume (required).
--name string The name to use for this volume (required).
--node string Create volume on a specific node.
--profile string The name of the volume profile to use for this volume (required).
--provider string Create volume using a specific provider.

Options inherited from parent commands

Name Description
-h,--help Help for this command.
--timeout duration Override the default operation timeout. (default 55s)
-v,--verbose Verbose mode.