.nh .TH podman-volume-create 1 .SH NAME .PP podman-volume-create - Create a new volume .SH SYNOPSIS .PP \fBpodman volume create\fP [\fIoptions\fP] [\fIname\fP] .SH DESCRIPTION .PP Creates an empty volume and prepares it to be used by containers. The volume can be created with a specific name, if a name is not given a random name is generated. You can add metadata to the volume by using the \fB--label\fP flag and driver options can be set using the \fB--opt\fP flag. .SH OPTIONS .SS \fB--driver\fP=\fIdriver\fP .PP Specify the volume driver name (default \fBlocal\fP). There are two drivers supported by Podman itself: \fBlocal\fP and \fBimage\fP\&. The \fBlocal\fP driver uses a directory on disk as the backend by default, but can also use the \fBmount(8)\fP command to mount a filesystem as the volume if \fB--opt\fP is specified. The \fBimage\fP driver uses an image as the backing store of for the volume. An overlay filesystem will be created, which allows changes to the volume to be committed as a new layer on top of the image. Using a value other than **local or \fBimage\fP, Podman will attempt to create the volume using a volume plugin with the given name. Such plugins must be defined in the \fBvolume_plugins\fP section of the \fBcontainers.conf(5)\fP configuration file. .SS \fB--help\fP .PP Print usage statement .SS \fB--label\fP, \fB-l\fP=\fIlabel\fP .PP Set metadata for a volume (e.g., --label mykey=value). .SS \fB--opt\fP, \fB-o\fP=\fIoption\fP .PP Set driver specific options. For the default driver, \fBlocal\fP, this allows a volume to be configured to mount a filesystem on the host. For the \fB\fClocal\fR driver the following options are supported: \fB\fCtype\fR, \fB\fCdevice\fR, \fB\fCo\fR, and \fB\fC[no]copy\fR\&. The \fB\fCtype\fR option sets the type of the filesystem to be mounted, and is equivalent to the \fB\fC-t\fR flag to \fBmount(8)\fP\&. The \fB\fCdevice\fR option sets the device to be mounted, and is equivalent to the \fB\fCdevice\fR argument to \fBmount(8)\fP\&. The \fB\fCcopy\fR option enables copying files from the container image path where the mount is created to the newly created volume on the first run. \fB\fCcopy\fR is the default. .PP The \fB\fCo\fR option sets options for the mount, and is equivalent to the \fB\fC-o\fR flag to \fBmount(8)\fP with these exceptions: .RS .IP \(bu 2 The \fB\fCo\fR option supports \fB\fCuid\fR and \fB\fCgid\fR options to set the UID and GID of the created volume that are not normally supported by \fBmount(8)\fP\&. .IP \(bu 2 The \fB\fCo\fR option supports the \fB\fCsize\fR option to set the maximum size of the created volume, the \fB\fCinodes\fR option to set the maximum number of inodes for the volume and \fB\fCnoquota\fR to completely disable quota support even for tracking of disk usage. Currently these flags are only supported on "xfs" file system mounted with the \fB\fCprjquota\fR flag described in the \fBxfs_quota(8)\fP man page. .IP \(bu 2 The \fB\fCo\fR option supports using volume options other than the UID/GID options with the \fBlocal\fP driver and requires root privileges. .IP \(bu 2 The \fB\fCo\fR options supports the \fB\fCtimeout\fR option which allows users to set a driver specific timeout in seconds before volume creation fails. For example, \fB--opts=o=timeout=10\fP sets a driver timeout of 10 seconds. .RE .PP For the \fBimage\fP driver, the only supported option is \fB\fCimage\fR, which specifies the image the volume is based on. This option is mandatory when using the \fBimage\fP driver. .PP When not using the \fBlocal\fP and \fBimage\fP drivers, the given options are passed directly to the volume plugin. In this case, supported options are dictated by the plugin in question, not Podman. .SH EXAMPLES .PP .RS .nf $ podman volume create myvol $ podman volume create $ podman volume create --label foo=bar myvol # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=nodev,noexec myvol # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=uid=1000,gid=1000 testvol # podman volume create --driver image --opt image=fedora:latest fedoraVol .fi .RE .SH QUOTAS .PP podman volume create uses \fB\fCXFS project quota controls\fR for controlling the size and the number of inodes of builtin volumes. The directory used to store the volumes must be an\fB\fCXFS\fR file system and be mounted with the \fB\fCpquota\fR option. .PP Example /etc/fstab entry: .PP .RS .nf /dev/podman/podman-var /var xfs defaults,x-systemd.device-timeout=0,pquota 1 2 .fi .RE .PP 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 system. .PP The xfs_quota tool can be used to assign a project id to the storage driver directory, e.g.: .PP .RS .nf echo 100000:/var/lib/containers/storage/overlay >> /etc/projects echo 200000:/var/lib/containers/storage/volumes >> /etc/projects echo storage:100000 >> /etc/projid echo volumes:200000 >> /etc/projid xfs_quota -x -c 'project -s storage volumes' / .fi .RE .PP In the example above we are configuring the overlay storage driver for newly created containers as well as volumes to use project ids with a \fBstart offset\fP\&. All containers will be assigned larger project ids (e.g. >= 100000). All volume assigned project ids larger project ids starting with 200000. This prevents xfs_quota management conflicts with containers/storage. .SH SEE ALSO .PP \fBpodman(1)\fP, \fBcontainers.conf(5)\fP, \fBpodman-volume(1)\fP, \fBmount(8)\fP, \fBxfs_quota(8)\fP, \fBxfs_quota(8)\fP, \fBprojects(5)\fP, \fBprojid(5)\fP .SH HISTORY .PP January 2020, updated with information on volume plugins by Matthew Heon mheon@redhat.com \[la]mailto:mheon@redhat.com\[ra] November 2018, Originally compiled by Urvashi Mohnani umohnani@redhat.com \[la]mailto:umohnani@redhat.com\[ra]