1PVCREATE(8) System Manager's Manual PVCREATE(8)
2
3
4
6 pvcreate - Initialize physical volume(s) for use by LVM
7
9 pvcreate position_args
10 [ option_args ]
11
13 pvcreate initializes a PV so that it is recognized as belonging to LVM,
14 and allows the PV to be used in a VG. A PV can be a disk partition,
15 whole disk, meta device, or loopback file.
16
17 For DOS disk partitions, the partition id should be set to 0x8e using
18 fdisk(8), cfdisk(8), or a equivalent. For GUID Partition Table (GPT),
19 the id is E6D6D379-F507-44C2-A23C-238F2A3DF928. For whole disk devices
20 only the partition table must be erased, which will effectively destroy
21 all data on that disk. This can be done by zeroing the first sector
22 with:
23
24 dd if=/dev/zero of=PhysicalVolume bs=512 count=1
25
26 Use vgcreate(8) to create a new VG on the PV, or vgextend(8) to add the
27 PV to existing VG.
28
29 The force option will create a PV without confirmation. Repeating the
30 force option (-ff) will forcibly create a PV, overriding checks that
31 normally prevent it, e.g. if the PV is already in a VG.
32
34 pvcreate PV ...
35 [ -f|--force ]
36 [ -M|--metadatatype lvm2 ]
37 [ -u|--uuid String ]
38 [ -Z|--zero y|n ]
39 [ --dataalignment Size[k|UNIT] ]
40 [ --dataalignmentoffset Size[k|UNIT] ]
41 [ --bootloaderareasize Size[m|UNIT] ]
42 [ --labelsector Number ]
43 [ --[pv]metadatacopies 0|1|2 ]
44 [ --metadatasize Size[m|UNIT] ]
45 [ --metadataignore y|n ]
46 [ --norestorefile ]
47 [ --setphysicalvolumesize Size[m|UNIT] ]
48 [ --reportformat basic|json ]
49 [ --restorefile String ]
50 [ COMMON_OPTIONS ]
51
52 Common options for lvm:
53 [ -d|--debug ]
54 [ -h|--help ]
55 [ -q|--quiet ]
56 [ -t|--test ]
57 [ -v|--verbose ]
58 [ -y|--yes ]
59 [ --commandprofile String ]
60 [ --config String ]
61 [ --driverloaded y|n ]
62 [ --lockopt String ]
63 [ --longhelp ]
64 [ --nolocking ]
65 [ --profile String ]
66 [ --version ]
67
69 --bootloaderareasize Size[m|UNIT]
70 Create a separate bootloader area of specified size besides PV's
71 data area. The bootloader area is an area of reserved space on
72 the PV from which LVM will not allocate any extents and it's
73 kept untouched. This is primarily aimed for use with bootloaders
74 to embed their own data or metadata. The start of the boot‐
75 loader area is always aligned, see also --dataalignment and
76 --dataalignmentoffset. The bootloader area size may eventually
77 end up increased due to the alignment, but it's never less than
78 the size that is requested. To see the bootloader area start and
79 size of an existing PV use pvs -o +pv_ba_start,pv_ba_size.
80
81 --commandprofile String
82 The command profile to use for command configuration. See
83 lvm.conf(5) for more information about profiles.
84
85 --config String
86 Config settings for the command. These override lvm.conf set‐
87 tings. The String arg uses the same format as lvm.conf, or may
88 use section/field syntax. See lvm.conf(5) for more information
89 about config.
90
91 --dataalignment Size[k|UNIT]
92 Align the start of the data to a multiple of this number. Also
93 specify an appropriate Physical Extent size when creating a VG.
94 To see the location of the first Physical Extent of an existing
95 PV, use pvs -o +pe_start. In addition, it may be shifted by an
96 alignment offset. See lvm.conf/data_alignment_offset_detection
97 and --dataalignmentoffset.
98
99 --dataalignmentoffset Size[k|UNIT]
100 Shift the start of the data area by this additional offset.
101
102 -d|--debug ...
103 Set debug level. Repeat from 1 to 6 times to increase the detail
104 of messages sent to the log file and/or syslog (if configured).
105
106 --driverloaded y|n
107 If set to no, the command will not attempt to use device-mapper.
108 For testing and debugging.
109
110 -f|--force ...
111 Override various checks, confirmations and protections. Use
112 with extreme caution.
113
114 -h|--help
115 Display help text.
116
117 --labelsector Number
118 By default the PV is labelled with an LVM2 identifier in its
119 second sector (sector 1). This lets you use a different sector
120 near the start of the disk (between 0 and 3 inclusive - see
121 LABEL_SCAN_SECTORS in the source). Use with care.
122
123 --lockopt String
124 Used to pass options for special cases to lvmlockd. See lvm‐
125 lockd(8) for more information.
126
127 --longhelp
128 Display long help text.
129
130 --metadataignore y|n
131 Specifies the metadataignore property of a PV. If yes, metadata
132 areas on the PV are ignored, and lvm will not store metadata in
133 the metadata areas of the PV. If no, lvm will store metadata on
134 the PV.
135
136 --metadatasize Size[m|UNIT]
137 The approximate amount of space used for each VG metadata area.
138 The size may be rounded.
139
140 -M|--metadatatype lvm2
141 Specifies the type of on-disk metadata to use. lvm2 (or just 2)
142 is the current, standard format. lvm1 (or just 1) is no longer
143 used.
144
145 --nolocking
146 Disable locking.
147
148 --norestorefile
149 In conjunction with --uuid, this allows a uuid to be specified
150 without also requiring that a backup of the metadata be pro‐
151 vided.
152
153 --profile String
154 An alias for --commandprofile or --metadataprofile, depending on
155 the command.
156
157 --[pv]metadatacopies 0|1|2
158 The number of metadata areas to set aside on a PV for storing VG
159 metadata. When 2, one copy of the VG metadata is stored at the
160 front of the PV and a second copy is stored at the end. When 1,
161 one copy of the VG metadata is stored at the front of the PV
162 (starting in the 5th sector). When 0, no copies of the VG meta‐
163 data are stored on the given PV. This may be useful in VGs con‐
164 taining many PVs (this places limitations on the ability to use
165 vgsplit later.)
166
167 -q|--quiet ...
168 Suppress output and log messages. Overrides --debug and --ver‐
169 bose. Repeat once to also suppress any prompts with answer
170 'no'.
171
172 --reportformat basic|json
173 Overrides current output format for reports which is defined
174 globally by the report/output_format setting in lvm.conf. basic
175 is the original format with columns and rows. If there is more
176 than one report per command, each report is prefixed with the
177 report name for identification. json produces report output in
178 JSON format. See lvmreport(7) for more information.
179
180 --restorefile String
181 In conjunction with --uuid, this reads the file (produced by
182 vgcfgbackup), extracts the location and size of the data on the
183 PV, and ensures that the metadata produced by the program is
184 consistent with the contents of the file, i.e. the physical
185 extents will be in the same place and not be overwritten by new
186 metadata. This provides a mechanism to upgrade the metadata for‐
187 mat or to add/remove metadata areas. Use with care.
188
189 --setphysicalvolumesize Size[m|UNIT]
190 Overrides the automatically detected size of the PV. Use with
191 care, or prior to reducing the physical size of the device.
192
193 -t|--test
194 Run in test mode. Commands will not update metadata. This is
195 implemented by disabling all metadata writing but nevertheless
196 returning success to the calling function. This may lead to
197 unusual error messages in multi-stage operations if a tool
198 relies on reading back metadata it believes has changed but
199 hasn't.
200
201 -u|--uuid String
202 Specify a UUID for the device. Without this option, a random
203 UUID is generated. This option is needed before restoring a
204 backup of LVM metadata onto a replacement device; see vgcfgre‐
205 store(8). As such, use of --restorefile is compulsory unless the
206 --norestorefile is used. All PVs must have unique UUIDs, and
207 LVM will prevent certain operations if multiple devices are seen
208 with the same UUID. See vgimportclone(8) for more information.
209
210 -v|--verbose ...
211 Set verbose level. Repeat from 1 to 4 times to increase the
212 detail of messages sent to stdout and stderr.
213
214 --version
215 Display version information.
216
217 -y|--yes
218 Do not prompt for confirmation interactively but always assume
219 the answer yes. Use with extreme caution. (For automatic no,
220 see -qq.)
221
222 -Z|--zero y|n
223 Controls if the first 4 sectors (2048 bytes) of the device are
224 wiped. The default is to wipe these sectors unless either or
225 both of --restorefile or --uuid are specified.
226
228 PV
229 Physical Volume name, a device path under /dev. For commands
230 managing physical extents, a PV positional arg generally accepts
231 a suffix indicating a range (or multiple ranges) of physical
232 extents (PEs). When the first PE is omitted, it defaults to the
233 start of the device, and when the last PE is omitted it defaults
234 to end. Start and end range (inclusive): PV[:PE-PE]... Start
235 and length range (counting from 0): PV[:PE+PE]...
236
237 String
238 See the option description for information about the string con‐
239 tent.
240
241 Size[UNIT]
242 Size is an input number that accepts an optional unit. Input
243 units are always treated as base two values, regardless of capi‐
244 talization, e.g. 'k' and 'K' both refer to 1024. The default
245 input unit is specified by letter, followed by |UNIT. UNIT rep‐
246 resents other possible input units: bBsSkKmMgGtTpPeE. b|B is
247 bytes, s|S is sectors of 512 bytes, k|K is kilobytes, m|M is
248 megabytes, g|G is gigabytes, t|T is terabytes, p|P is petabytes,
249 e|E is exabytes. (This should not be confused with the output
250 control --units, where capital letters mean multiple of 1000.)
251
253 See lvm(8) for information about environment variables used by lvm.
254 For example, LVM_VG_NAME can generally be substituted for a required VG
255 parameter.
256
258 Initialize a partition and a full device.
259 pvcreate /dev/sdc4 /dev/sde
260
261 If a device is a 4KiB sector drive that compensates for windows parti‐
262 tioning (sector 7 is the lowest aligned logical block, the 4KiB sectors
263 start at LBA -1, and consequently sector 63 is aligned on a 4KiB bound‐
264 ary) manually account for this when initializing for use by LVM.
265 pvcreate --dataalignmentoffset 7s /dev/sdb
266
268 lvm(8) lvm.conf(5) lvmconfig(8)
269
270 pvchange(8) pvck(8) pvcreate(8) pvdisplay(8) pvmove(8) pvremove(8)
271 pvresize(8) pvs(8) pvscan(8)
272
273 vgcfgbackup(8) vgcfgrestore(8) vgchange(8) vgck(8) vgcreate(8) vgcon‐
274 vert(8) vgdisplay(8) vgexport(8) vgextend(8) vgimport(8) vgimport‐
275 clone(8) vgmerge(8) vgmknodes(8) vgreduce(8) vgremove(8) vgrename(8)
276 vgs(8) vgscan(8) vgsplit(8)
277
278 lvcreate(8) lvchange(8) lvconvert(8) lvdisplay(8) lvextend(8) lvre‐
279 duce(8) lvremove(8) lvrename(8) lvresize(8) lvs(8) lvscan(8)
280
281 lvm-fullreport(8) lvm-lvpoll(8) lvm2-activation-generator(8) blkdeacti‐
282 vate(8) lvmdump(8)
283
284 dmeventd(8) lvmpolld(8) lvmlockd(8) lvmlockctl(8) cmirrord(8) lvmd‐
285 busd(8)
286
287 lvmsystemid(7) lvmreport(7) lvmraid(7) lvmthin(7) lvmcache(7)
288
289
290
291Red Hat, Inc. LVM TOOLS 2.03.02(2)-RHEL8 (2019-01-04) PVCREATE(8)