1podman-volume-create(1)() podman-volume-create(1)()
2
3
4
6 podman-volume-create - Create a new volume
7
8
10 podman volume create [options]
11
12
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
21 --driver=driver
22 Specify the volume driver name (default local). Setting this to a value
23 other than local Podman attempts to create the volume using a volume
24 plugin with the given name. Such plugins must be defined in the vol‐
25 ume_plugins section of the containers.conf(5) configuration file.
26
27
28 --help
29 Print usage statement
30
31
32 --label=label, -l
33 Set metadata for a volume (e.g., --label mykey=value).
34
35
36 --opt=option, -o
37 Set driver specific options. For the default driver, local, this al‐
38 lows a volume to be configured to mount a filesystem on the host. For
39 the local driver the following options are supported: type, device, and
40 o. The type option sets the type of the filesystem to be mounted, and
41 is equivalent to the -t flag to mount(8). The device option sets the
42 device to be mounted, and is equivalent to the device argument to
43 mount(8).
44
45
46 The o option sets options for the mount, and is equivalent to the -o
47 flag to mount(8) with these exceptions:
48
49
50 • The o option supports uid and gid options to set the UID and
51 GID of the created volume that are not normally supported by
52 mount(8).
53
54 • The o option supports the size option to set the maximum size
55 of the created volume and the inodes option to set the maximum
56 number of inodes for the volume. Currently these flags are
57 only supported on "xfs" file system mounted with the prjquota
58 flag described in the xfs_quota(8) man page.
59
60 • Using volume options other then the UID/GID options with the
61 local driver requires root privileges.
62
63
64
65 When not using the local driver, the given options are passed directly
66 to the volume plugin. In this case, supported options are dictated by
67 the plugin in question, not Podman.
68
69
71 $ podman volume create myvol
72
73 $ podman volume create
74
75 $ podman volume create --label foo=bar myvol
76
77 # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=nodev,noexec myvol
78
79 # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=uid=1000,gid=1000 testvol
80
81
82
84 podman volume create uses XFS project quota controls for controlling
85 the size and the number of inodes of builtin volumes. The directory
86 used to store the volumes must be anXFS file system and be mounted with
87 the pquota option.
88
89
90 Example /etc/fstab entry:
91
92
93 /dev/podman/podman-var /var xfs defaults,x-systemd.device-timeout=0,pquota 1 2
94
95
96
97 Podman generates project ids for each builtin volume, but these project
98 ids need to be unique for the XFS file system. These project ids by de‐
99 fault are generated randomly, with a potential for overlap with other
100 quotas on the same file system.
101
102
103 The xfs_quota tool can be used to assign a project id to the storage
104 driver directory, e.g.:
105
106
107 echo 100000:/var/lib/containers/storage/overlay >> /etc/projects
108 echo 200000:/var/lib/containers/storage/volumes >> /etc/projects
109 echo storage:100000 >> /etc/projid
110 echo volumes:200000 >> /etc/projid
111 xfs_quota -x -c 'project -s storage volumes' /<xfs mount point>
112
113
114
115 In the example above we are configuring the overlay storage driver for
116 newly created containers as well as volumes to use project ids with a
117 start offset. All containers will be assigned larger project ids (e.g.
118 >= 100000). All volume assigned project ids larger project ids start‐
119 ing with 200000. This prevents xfs_quota management conflicts with
120 containers/storage.
121
122
124 podman-volume(1), mount(8), containers.conf(5), xfs_quota(8),
125 xfs_quota(8), projects(5), projid(5)
126
127
129 January 2020, updated with information on volume plugins by Matthew
130 Heon mheon@redhat.com ⟨mailto:mheon@redhat.com⟩ November 2018, Origi‐
131 nally compiled by Urvashi Mohnani umohnani@redhat.com
132 ⟨mailto:umohnani@redhat.com⟩
133
134
135
136 podman-volume-create(1)()