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, the inodes option to set the maximum
56 number of inodes for the volume and noquota to completely dis‐
57 able quota support even for tracking of disk usage. Currently
58 these flags are only supported on "xfs" file system mounted
59 with the prjquota flag described in the xfs_quota(8) man page.
60
61 • The o option supports .
62
63 • Using volume options other then the UID/GID options with the
64 local driver requires root privileges.
65
66
67
68 When not using the local driver, the given options are passed directly
69 to the volume plugin. In this case, supported options are dictated by
70 the plugin in question, not Podman.
71
72
74 $ podman volume create myvol
75
76 $ podman volume create
77
78 $ podman volume create --label foo=bar myvol
79
80 # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=nodev,noexec myvol
81
82 # podman volume create --opt device=tmpfs --opt type=tmpfs --opt o=uid=1000,gid=1000 testvol
83
84
85
87 podman volume create uses XFS project quota controls for controlling
88 the size and the number of inodes of builtin volumes. The directory
89 used to store the volumes must be anXFS file system and be mounted with
90 the pquota option.
91
92
93 Example /etc/fstab entry:
94
95
96 /dev/podman/podman-var /var xfs defaults,x-systemd.device-timeout=0,pquota 1 2
97
98
99
100 Podman generates project ids for each builtin volume, but these project
101 ids need to be unique for the XFS file system. These project ids by de‐
102 fault are generated randomly, with a potential for overlap with other
103 quotas on the same file system.
104
105
106 The xfs_quota tool can be used to assign a project id to the storage
107 driver directory, e.g.:
108
109
110 echo 100000:/var/lib/containers/storage/overlay >> /etc/projects
111 echo 200000:/var/lib/containers/storage/volumes >> /etc/projects
112 echo storage:100000 >> /etc/projid
113 echo volumes:200000 >> /etc/projid
114 xfs_quota -x -c 'project -s storage volumes' /<xfs mount point>
115
116
117
118 In the example above we are configuring the overlay storage driver for
119 newly created containers as well as volumes to use project ids with a
120 start offset. All containers will be assigned larger project ids (e.g.
121 >= 100000). All volume assigned project ids larger project ids start‐
122 ing with 200000. This prevents xfs_quota management conflicts with
123 containers/storage.
124
125
127 podman(1), containers.conf(5), podman-volume(1), mount(8),
128 xfs_quota(8), xfs_quota(8), projects(5), projid(5)
129
130
132 January 2020, updated with information on volume plugins by Matthew
133 Heon mheon@redhat.com ⟨mailto:mheon@redhat.com⟩ November 2018, Origi‐
134 nally compiled by Urvashi Mohnani umohnani@redhat.com
135 ⟨mailto:umohnani@redhat.com⟩
136
137
138
139 podman-volume-create(1)()