1PVCREATE(8) System Manager's Manual PVCREATE(8)
2
3
4
6 pvcreate — initialize a disk or partition for use by LVM
7
9 pvcreate [--commandprofile ProfileName] [-d|--debug] [-h|--help]
10 [-t|--test] [-v|--verbose] [--version] [-f[f]|--force [--force]]
11 [-y|--yes] [--labelsector] [--bootloaderareasize size] [-M|--meta‐
12 datatype type] [--[pv]metadatacopies NumberOfCopies] [--metadatasize
13 size] [--metadataignore {y|n}] [--dataalignment alignment]
14 [--dataalignmentoffset alignment_offset] [--restorefile file] [--nore‐
15 storefile] [--setphysicalvolumesize size] [-u|--uuid uuid] [-Z|--zero
16 {y|n}] PhysicalVolume [PhysicalVolume...]
17
19 pvcreate initializes PhysicalVolume for later use by the Logical Volume
20 Manager (LVM). Each PhysicalVolume can be a disk partition, whole
21 disk, meta device, or loopback file. For DOS disk partitions, the par‐
22 tition id should be set to 0x8e using fdisk(8), cfdisk(8), or a equiva‐
23 lent. For GUID Partition Table (GPT), the id is
24 E6D6D379-F507-44C2-A23C-238F2A3DF928. For whole disk devices only the
25 partition table must be erased, which will effectively destroy all data
26 on that disk. This can be done by zeroing the first sector with:
27
28 dd if=/dev/zero of=PhysicalVolume bs=512 count=1
29
30 Continue with vgcreate(8) to create a new volume group on PhysicalVol‐
31 ume, or vgextend(8) to add PhysicalVolume to an existing volume group.
32
34 See lvm(8) for common options.
35
36 -f, --force
37 Force the creation without any confirmation. You can not recre‐
38 ate (reinitialize) a physical volume belonging to an existing
39 volume group. In an emergency you can override this behaviour
40 with -ff.
41
42 -u, --uuid uuid
43 Specify the uuid for the device. Without this option, pvcre‐
44 ate(8) generates a random uuid. All of your physical volumes
45 must have unique uuids. You need to use this option before
46 restoring a backup of LVM metadata onto a replacement device -
47 see vgcfgrestore(8). As such, use of --restorefile is compul‐
48 sory unless the --norestorefile is used.
49
50 -y, --yes
51 Answer yes to all questions.
52
53 -Z, --zero {y|n}
54 Whether or not the first 4 sectors (2048 bytes) of the device
55 should be wiped. If this option is not given, the default is to
56 wipe these sectors unless either or both of the --restorefile or
57 --uuid options were specified.
58
60 LVM2 introduces a new format for storing metadata on disk. This new
61 format is more efficient and resilient than the format the original
62 version of LVM used and offers the advanced user greater flexibility
63 and control.
64
65 The new format may be selected on the command line with -M2 or by set‐
66 ting format = "lvm2" in the global section of lvm.conf(5). Each physi‐
67 cal volume in the same volume group must use the same format, but dif‐
68 ferent volume groups on a machine may use different formats simultane‐
69 ously: the tools can handle both formats. Additional formats can be
70 added as shared libraries.
71
72 Additional tools for manipulating the locations and sizes of metadata
73 areas will be written in due course. Use the verbose/debug options on
74 the tools to see where the metadata areas are placed.
75
76 --metadatasize size
77 The approximate amount of space to be set aside for each meta‐
78 data area. (The size you specify may get rounded.)
79
80 --dataalignment alignment
81 Align the start of the data to a multiple of this number. You
82 should also specify an appropriate PhysicalExtentSize when cre‐
83 ating the Volume Group with vgcreate.
84
85 To see the location of the first Physical Extent of an existing
86 Physical Volume use pvs -o +pe_start . It will be a multiple of
87 the requested alignment. In addition it may be shifted by
88 alignment_offset from data_alignment_offset_detection (if
89 enabled in lvm.conf(5)) or --dataalignmentoffset.
90
91 --dataalignmentoffset alignment_offset
92 Shift the start of the data area by this additional align‐
93 ment_offset.
94
95 --[pv]metadatacopies NumberOfCopies
96 The number of metadata areas to set aside on each PV. Currently
97 this can be 0, 1 or 2. If set to 2, two copies of the volume
98 group metadata are held on the PV, one at the front of the PV
99 and one at the end. If set to 1 (the default), one copy is kept
100 at the front of the PV (starting in the 5th sector). If set to
101 0, no copies are kept on this PV - you might wish to use this
102 with VGs containing large numbers of PVs. But if you do this
103 and then later use vgsplit(8) you must ensure that each VG is
104 still going to have a suitable number of copies of the metadata
105 after the split!
106
107 --metadataignore {y|n}
108 Ignore or un-ignore metadata areas on this physical volume. The
109 default is "n". This setting can be changed with pvchange. If
110 metadata areas on a physical volume are ignored, LVM will not
111 store metadata in the metadata areas present on this Physical
112 Volume. Metadata areas cannot be created or extended after Log‐
113 ical Volumes have been allocated on the device. If you do not
114 want to store metadata on this device, it is still wise always
115 to allocate a metadata area in case you need it in the future
116 and to use this option to instruct LVM2 to ignore it.
117
118 --restorefile file
119 In conjunction with --uuid, this extracts the location and size
120 of the data on the PV from the file (produced by vgcfgbackup)
121 and ensures that the metadata that the program produces is con‐
122 sistent with the contents of the file i.e. the physical extents
123 will be in the same place and not get overwritten by new meta‐
124 data. This provides a mechanism to upgrade the metadata format
125 or to add/remove metadata areas. Use with care. See also vgcon‐
126 vert(8).
127
128 --norestorefile
129 In conjunction with --uuid, this allows a uuid to be specified
130 without also requiring that a backup of the metadata be pro‐
131 vided.
132
133 --labelsector sector
134 By default the PV is labelled with an LVM2 identifier in its
135 second sector (sector 1). This lets you use a different sector
136 near the start of the disk (between 0 and 3 inclusive - see
137 LABEL_SCAN_SECTORS in the source). Use with care.
138
139 --bootloaderareasize size
140 Create a separate bootloader area of specified size besides PV's
141 data area. The bootloader area is an area of reserved space on
142 the PV from which LVM2 will not allocate any extents and it's
143 kept untouched. This is primarily aimed for use with bootloaders
144 to embed their own data or metadata. The start of the boot‐
145 loader area is always aligned, see also --dataalignment and
146 --dataalignmentoffset. The bootloader area size may eventually
147 end up increased due to the alignment, but it's never less than
148 the size that is requested. To see the bootloader area start and
149 size of an existing Physical Volume use pvs -o
150 +pv_ba_start,pv_ba_size.
151
152 --setphysicalvolumesize size
153 Overrides the automatically-detected size of the PV. Use with
154 care.
155
157 Initialize partition #4 on the third SCSI disk and the entire fifth
158 SCSI disk for later use by LVM:
159
160 pvcreate /dev/sdc4 /dev/sde
161
162 If the 2nd SCSI disk is a 4KiB sector drive that compensates for win‐
163 dows partitioning (sector 7 is the lowest aligned logical block, the
164 4KiB sectors start at LBA -1, and consequently sector 63 is aligned on
165 a 4KiB boundary) manually account for this when initializing for use by
166 LVM:
167
168 pvcreate --dataalignmentoffset 7s /dev/sdb
169
170
172 lvm.conf(5), lvm(8), vgcreate(8), vgextend(8), lvcreate(8), cfdisk(8),
173 fdisk(8), losetup(8), mdadm(8), vgcfgrestore(8), vgconvert(8)
174
175
176
177Sistina Software UKLVM TOOLS 2.02.143(2)-RHEL6 (2016-12-13) PVCREATE(8)