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