github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/docs/source/markdown/podman-volume-create.1.md (about)

     1  % podman-volume-create(1)
     2  
     3  ## NAME
     4  podman\-volume\-create - Create a new volume
     5  
     6  ## SYNOPSIS
     7  **podman volume create** [*options*] [*name*]
     8  
     9  ## DESCRIPTION
    10  
    11  Creates an empty volume and prepares it to be used by containers. The volume
    12  can be created with a specific name, if a name is not given a random name is
    13  generated. You can add metadata to the volume by using the **--label** flag and
    14  driver options can be set using the **--opt** flag.
    15  
    16  ## OPTIONS
    17  
    18  #### **--driver**=*driver*
    19  
    20  Specify the volume driver name (default **local**). Setting this to a value other than **local** Podman attempts to create the volume using a volume plugin with the given name. Such plugins must be defined in the **volume_plugins** section of the **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)** configuration file.
    21  
    22  #### **--help**
    23  
    24  Print usage statement
    25  
    26  #### **--label**=*label*, **-l**
    27  
    28  Set metadata for a volume (e.g., --label mykey=value).
    29  
    30  #### **--opt**=*option*, **-o**
    31  
    32  Set driver specific options.
    33  For the default driver, **local**, this allows a volume to be configured to mount a filesystem on the host.
    34  For the `local` driver the following options are supported: `type`, `device`, and `o`.
    35  The `type` option sets the type of the filesystem to be mounted, and is equivalent to the `-t` flag to **mount(8)**.
    36  The `device` option sets the device to be mounted, and is equivalent to the `device` argument to **mount(8)**.
    37  
    38  The `o` option sets options for the mount, and is equivalent to the `-o` flag to **mount(8)** with these exceptions:
    39  
    40    - The `o` option supports `uid` and `gid` options to set the UID and GID of the created volume that are not normally supported by **mount(8)**.
    41    - The `o` option supports the `size` option to set the maximum size of the created volume, the `inodes` option to set the maximum number of inodes for the volume and `noquota` to completely disable quota support even for tracking of disk usage. Currently these flags are only supported on "xfs" file system mounted with the `prjquota` flag described in the **xfs_quota(8)** man page.
    42    - The `o` option supports .
    43    - Using volume options other then the UID/GID options with the **local** driver requires root privileges.
    44  
    45  When not using the **local** driver, the given options are passed directly to the volume plugin. In this case, supported options are dictated by the plugin in question, not Podman.
    46  
    47  ## EXAMPLES
    48  
    49  ```
    50  $ podman volume create myvol
    51  
    52  $ podman volume create
    53  
    54  $ podman volume create --label foo=bar myvol
    55  
    56  # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=nodev,noexec myvol
    57  
    58  # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=uid=1000,gid=1000 testvol
    59  ```
    60  
    61  ## QUOTAS
    62  
    63  podman volume create uses `XFS project quota controls` for controlling the size and the number of inodes of builtin volumes. The directory used to store the volumes must be an`XFS` file system and be mounted with the `pquota` option.
    64  
    65  Example /etc/fstab entry:
    66  ```
    67  /dev/podman/podman-var /var xfs defaults,x-systemd.device-timeout=0,pquota 1 2
    68  ```
    69  
    70  Podman generates project ids for each builtin volume, but these project ids need to be unique for the XFS file system. These project ids by default are generated randomly, with a potential for overlap with other quotas on the same file
    71  system.
    72  
    73  The xfs_quota tool can be used to assign a project id to the storage driver directory, e.g.:
    74  
    75  ```
    76  echo 100000:/var/lib/containers/storage/overlay >> /etc/projects
    77  echo 200000:/var/lib/containers/storage/volumes >> /etc/projects
    78  echo storage:100000 >> /etc/projid
    79  echo volumes:200000 >> /etc/projid
    80  xfs_quota -x -c 'project -s storage volumes' /<xfs mount point>
    81  ```
    82  
    83  In the example above we are configuring the overlay storage driver for newly
    84  created containers as well as volumes to use project ids with a **start offset**.
    85  All containers will be assigned larger project ids (e.g. >= 100000).
    86  All volume assigned project ids larger project ids starting with 200000.
    87  This prevents xfs_quota management conflicts with containers/storage.
    88  
    89  ## SEE ALSO
    90  **[podman(1)](podman.1.md)**, **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)**, **[podman-volume(1)](podman-volume.1.md)**, **mount(8)**, **xfs_quota(8)**, **xfs_quota(8)**, **projects(5)**, **projid(5)**
    91  
    92  ## HISTORY
    93  January 2020, updated with information on volume plugins by Matthew Heon <mheon@redhat.com>
    94  November 2018, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>