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 [-d|--debug] [-f[f]|--force [--force]] [-y|--yes] [-h|--help]
10 [-t|--test] [-v|--verbose] [--labelsector] [-M|--metadatatypetype]
11 [--metadatacopies#copies] [--metadatasizesize] [--restorefilefile]
12 [--setphysicalvolumesizesize] [--version] [-Z|--zeroy/n] PhysicalVolume
13 [PhysicalVolume...]
14
16 pvcreate initializes PhysicalVolume for later use by the Logical Volume
17 Manager (LVM). Each PhysicalVolume can be a disk partition, whole
18 disk, meta device, or loopback file. For DOS disk partitions, the par‐
19 tition id should be set to 0x8e using fdisk(8), cfdisk(8), or a equiva‐
20 lent. For whole disk devices only the partition table must be erased,
21 which will effectively destroy all data on that disk. This can be done
22 by zeroing the first sector with:
23
24 dd if=/dev/zero of=PhysicalVolume bs=512 count=1
25
26 Continue with vgcreate(8) to create a new volume group on PhysicalVol‐
27 ume, or vgextend(8) to add PhysicalVolume to an existing volume group.
28
30 See lvm(8) for common options.
31
32 -f, --force
33 Force the creation without any confirmation. You can not recre‐
34 ate (reinitialize) a physical volume belonging to an existing
35 volume group. In an emergency you can override this behaviour
36 with -ff.
37
38 -u, --uuid uuid
39 Specify the uuid for the device. Without this option, pvcreate
40 generates a random uuid. All of your physical volumes must have
41 unique uuids. You need to use this option before restoring a
42 backup of LVM metadata onto a replacement device - see vgcfgre‐
43 store(8).
44
45 -y, --yes
46 Answer yes to all questions.
47
48 -Z, --zero y/n
49 Whether or not the first 4 sectors (2048 bytes) of the device
50 should be wiped. If this option is not given, the default is to
51 wipe these sectors unless either or both of the --restorefile or
52 --uuid options were specified.
53
55 LVM2 introduces a new format for storing metadata on disk. This new
56 format is more efficient and resilient than the format the original
57 version of LVM used and offers the advanced user greater flexibility
58 and control.
59
60 The new format may be selected on the command line with -M2 or by set‐
61 ting format = "lvm2" in the global section of lvm.conf. Each physical
62 volume in the same volume group must use the same format, but different
63 volume groups on a machine may use different formats simultaneously:
64 the tools can handle both formats. Additional formats can be added as
65 shared libraries.
66
67 Additional tools for manipulating the locations and sizes of metadata
68 areas will be written in due course. Use the verbose/debug options on
69 the tools to see where the metadata areas are placed.
70
71 --metadatasize size
72 The approximate amount of space to be set aside for each meta‐
73 data area. (The size you specify may get rounded.)
74
75 --metadatacopies copies
76 The number of metadata areas to set aside on each PV. Currently
77 this can be 0, 1 or 2. If set to 2, two copies of the volume
78 group metadata are held on the PV, one at the front of the PV
79 and one at the end. If set to 1 (the default), one copy is kept
80 at the front of the PV (starting in the 5th sector). If set to
81 0, no copies are kept on this PV - you might wish to use this
82 with VGs containing large numbers of PVs. But if you do this
83 and then later use vgsplit you must ensure that each VG is still
84 going to have a suitable number of copies of the metadata after
85 the split!
86
87 --restorefile file
88 In conjunction with --uuid, this extracts the location and size
89 of the data on the PV from the file (produced by vgcfgbackup)
90 and ensures that the metadata that the program produces is con‐
91 sistent with the contents of the file i.e. the physical extents
92 will be in the same place and not get overwritten by new meta‐
93 data. This provides a mechanism to upgrade the metadata format
94 or to add/remove metadata areas. Use with care. See also vgcon‐
95 vert(8).
96
97 --labelsector sector
98 By default the PV is labelled with an LVM2 identifier in its
99 second sector (sector 1). This lets you use a different sector
100 near the start of the disk (between 0 and 3 inclusive - see
101 LABEL_SCAN_SECTORS in the source). Use with care.
102
103 --setphysicalvolumesize size
104 Overrides the automatically-detected size of the PV. Use with
105 care.
106
108 Initialize partition #4 on the third SCSI disk and the entire fifth
109 SCSI disk for later use by LVM:
110
111 pvcreate /dev/sdc4 /dev/sde
112
113
115 lvm(8), vgcreate(8), vgextend(8), lvcreate(8), cfdisk(8), fdisk(8),
116 losetup(8), mdadd(8), vgcfgrestore(8), vgconvert(8)
117
118
119
120Sistina Software UK LVM TOOLS PVCREATE(8)