1podman-volume-create(1)     General Commands Manual    podman-volume-create(1)
2
3
4

NAME

6       podman-volume-create - Create a new volume
7
8

SYNOPSIS

10       podman volume create [options] [name]
11
12

DESCRIPTION

14       Creates  an  empty volume and prepares it to be used by containers. The
15       volume can be created with a specific name, if a name is  not  given  a
16       random  name  is generated. You can add metadata to the volume by using
17       the --label flag and driver options can be set using the --opt flag.
18
19

OPTIONS

21   --driver=driver
22       Specify the volume driver name (default local).  There are two  drivers
23       supported  by  Podman itself: local and image.  The local driver uses a
24       directory on disk as the backend by  default,  but  can  also  use  the
25       mount(8) command to mount a filesystem as the volume if --opt is speci‐
26       fied.  The image driver uses an image as the backing store of  for  the
27       volume.  An overlay filesystem will be created, which allows changes to
28       the volume to be committed as a new layer on top of the image.  Using a
29       value  other  than  **local or image, Podman will attempt to create the
30       volume using a volume plugin with the given name.  Such plugins must be
31       defined in the volume_plugins section of the containers.conf(5) config‐
32       uration file.
33
34
35   --help
36       Print usage statement
37
38
39   --label, -l=label
40       Set metadata for a volume (e.g., --label mykey=value).
41
42
43   --opt, -o=option
44       Set driver specific options.  For the default driver, local,  this  al‐
45       lows  a volume to be configured to mount a filesystem on the host.  For
46       the local driver the following options are supported: type, device,  o,
47       and  [no]copy.   The  type option sets the type of the filesystem to be
48       mounted, and is equivalent to the -t flag to mount(8).  The device  op‐
49       tion sets the device to be mounted, and is equivalent to the device ar‐
50       gument to mount(8).  The copy option enables  copying  files  from  the
51       container  image  path  where the mount is created to the newly created
52       volume on the first run.  copy is the default.
53
54
55       The o option sets options for the mount, and is equivalent  to  the  -o
56       flag to mount(8) with these exceptions:
57
58
59              • The  o  option supports uid and gid options to set the UID and
60                GID of the created volume that are not normally  supported  by
61                mount(8).
62
63              • The  o option supports the size option to set the maximum size
64                of the created volume, the inodes option to  set  the  maximum
65                number of inodes for the volume and noquota to completely dis‐
66                able quota support even for tracking of disk usage.  Currently
67                these  flags  are  only supported on "xfs" file system mounted
68                with the prjquota flag described in the xfs_quota(8) man page.
69
70              • The o option supports using  volume  options  other  than  the
71                UID/GID options with the local driver and requires root privi‐
72                leges.
73
74              • The o options supports the timeout option which  allows  users
75                to set a driver specific timeout in seconds before volume cre‐
76                ation fails. For example, --opts=o=timeout=10  sets  a  driver
77                timeout of 10 seconds.
78
79
80
81       For  the image driver, the only supported option is image, which speci‐
82       fies the image the volume is based on.  This option is  mandatory  when
83       using the image driver.
84
85
86       When  not  using  the  local  and  image drivers, the given options are
87       passed directly to the volume plugin. In this case,  supported  options
88       are dictated by the plugin in question, not Podman.
89
90

EXAMPLES

92              $ podman volume create myvol
93
94              $ podman volume create
95
96              $ podman volume create --label foo=bar myvol
97
98              # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=nodev,noexec myvol
99
100              # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=uid=1000,gid=1000 testvol
101
102              # podman volume create --driver image --opt image=fedora:latest fedoraVol
103
104
105

QUOTAS

107       podman  volume  create  uses XFS project quota controls for controlling
108       the size and the number of inodes of  builtin  volumes.  The  directory
109       used to store the volumes must be anXFS file system and be mounted with
110       the pquota option.
111
112
113       Example /etc/fstab entry:
114
115
116              /dev/podman/podman-var /var xfs defaults,x-systemd.device-timeout=0,pquota 1 2
117
118
119
120       Podman generates project ids for each builtin volume, but these project
121       ids need to be unique for the XFS file system. These project ids by de‐
122       fault are generated randomly, with a potential for overlap  with  other
123       quotas on the same file system.
124
125
126       The  xfs_quota  tool  can be used to assign a project id to the storage
127       driver directory, e.g.:
128
129
130              echo 100000:/var/lib/containers/storage/overlay >> /etc/projects
131              echo 200000:/var/lib/containers/storage/volumes >> /etc/projects
132              echo storage:100000 >> /etc/projid
133              echo volumes:200000 >> /etc/projid
134              xfs_quota -x -c 'project -s storage volumes' /<xfs mount point>
135
136
137
138       In the example above we are configuring the overlay storage driver  for
139       newly  created  containers as well as volumes to use project ids with a
140       start offset.  All containers will be assigned larger project ids (e.g.
141       >=  100000).  All volume assigned project ids larger project ids start‐
142       ing with 200000.  This prevents  xfs_quota  management  conflicts  with
143       containers/storage.
144
145

SEE ALSO

147       podman(1),      containers.conf(5),     podman-volume(1),     mount(8),
148       xfs_quota(8), xfs_quota(8), projects(5), projid(5)
149
150

HISTORY

152       January 2020, updated with information on  volume  plugins  by  Matthew
153       Heon  mheon@redhat.com  ⟨mailto:mheon@redhat.com⟩ November 2018, Origi‐
154       nally    compiled    by     Urvashi     Mohnani     umohnani@redhat.com
155       ⟨mailto:umohnani@redhat.com⟩
156
157
158
159                                                       podman-volume-create(1)
Impressum