]> sourceware.org Git - lvm2.git/blob - man/pvcreate.8.in
spacing
[lvm2.git] / man / pvcreate.8.in
1 .TH PVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
2 .SH NAME
3 pvcreate \- initialize a disk or partition for use by LVM
4 .SH SYNOPSIS
5 .B pvcreate
6 .RB [ \-d | \-\-debug ]
7 .RB [ \-h | \-\-help ]
8 .RB [ \-t | \-\-test ]
9 .RB [ \-v | \-\-verbose ]
10 .RB [ \-\-version ]
11 .RB [ \-f [ f ]| \-\-force
12 .RB [ \-\-force ]]
13 .RB [ \-y | \-\-yes ]
14 .RB [ \-\-labelsector ]
15 .RB [ \-M | \-\-metadatatype
16 .IR type ]
17 .RB [ \-\- [ pv ] metadatacopies
18 .IR NumberOfCopies ]
19 .RB [ \-\-metadatasize
20 .IR size ]
21 .RB [ \-\-metadataignore
22 .RI { y | n }]
23 .RB [ \-\-dataalignment
24 .IR alignment ]
25 .RB [ \-\-dataalignmentoffset
26 .IR alignment_offset ]
27 .RB [ \-\-restorefile
28 .IR file ]
29 .RB [ \-\-norestorefile ]
30 .RB [ \-\-setphysicalvolumesize
31 .IR size ]
32 .RB [ \-u | \-\-uuid
33 .IR uuid ]
34 .RB [ \-Z | \-\-zero
35 .RI { y | n }]
36 .I PhysicalVolume
37 .RI [ PhysicalVolume ...]
38 .SH DESCRIPTION
39 pvcreate initializes
40 .I PhysicalVolume
41 for later use by the Logical Volume Manager (LVM). Each
42 .I PhysicalVolume
43 can be a disk partition, whole disk, meta device, or loopback file.
44 For DOS disk partitions, the partition id should be set to 0x8e using
45 .BR fdisk (8),
46 .BR cfdisk (8),
47 or a equivalent. For
48 .B whole disk devices only
49 the partition table must be erased, which will effectively destroy all
50 data on that disk. This can be done by zeroing the first sector with:
51 .sp
52 .BI "dd if=/dev/zero of=" PhysicalVolume " bs=512 count=1"
53 .sp
54 Continue with
55 .BR vgcreate (8)
56 to create a new volume group on
57 .IR PhysicalVolume ,
58 or
59 .BR vgextend (8)
60 to add
61 .I PhysicalVolume
62 to an existing volume group.
63 .SH OPTIONS
64 See \fBlvm\fP(8) for common options.
65 .TP
66 .BR \-f ", " \-\-force
67 Force the creation without any confirmation. You can not recreate
68 (reinitialize) a physical volume belonging to an existing volume group.
69 In an emergency you can override this behaviour with \fB-ff\fP.
70 .TP
71 .BR \-u ", " \-\-uuid " " \fIuuid
72 Specify the uuid for the device.
73 Without this option, \fBpvcreate\fP(8) generates a random uuid.
74 All of your physical volumes must have unique uuids.
75 You need to use this option before restoring a backup of LVM metadata
76 onto a replacement device - see \fBvgcfgrestore\fP(8). As such, use of
77 \fB\-\-restorefile\fP is compulsory unless the \fB\-\-norestorefile\fP is
78 used.
79 .TP
80 .BR \-y ", " \-\-yes
81 Answer yes to all questions.
82 .TP
83 .BR \-Z ", " \-\-zero " {" \fIy | \fIn }
84 Whether or not the first 4 sectors (2048 bytes) of the device should be
85 wiped.
86 If this option is not given, the
87 default is to wipe these sectors unless either or both of the
88 \fB\-\-restorefile\fP or \fB\-\-uuid\fP options were specified.
89 .SH NEW METADATA OPTIONS
90 LVM2 introduces a new format for storing metadata on disk.
91 This new format is more efficient and resilient than the format the
92 original version of LVM used and offers the advanced user greater
93 flexibility and control.
94 .P
95 The new format may be selected on the command line with \fB\-M2\fP or by
96 setting \fBformat = "lvm2"\fP in the \fBglobal\fP section of \fBlvm.conf\fP(5).
97 Each physical volume in the same volume group must use the same format, but
98 different volume groups on a machine may use different formats
99 simultaneously: the tools can handle both formats.
100 Additional formats can be added as shared libraries.
101 .P
102 Additional tools for manipulating the locations and sizes of metadata areas
103 will be written in due course. Use the verbose/debug options on the tools
104 to see where the metadata areas are placed.
105 .TP
106 .B \-\-metadatasize \fIsize
107 The approximate amount of space to be set aside for each metadata area.
108 (The size you specify may get rounded.)
109 .TP
110 .B \-\-dataalignment \fIalignment
111 Align the start of the data to a multiple of this number.
112 You should also specify an appropriate \fIPhysicalExtentSize\fP when creating
113 the Volume Group with \fBvgcreate\fP.
114 .sp
115 To see the location of the first Physical Extent of an existing Physical Volume
116 use \fBpvs -o +pe_start\fP . It will be a multiple of the requested
117 alignment. In addition it may be shifted by \fIalignment_offset\fP from
118 \fIdata_alignment_offset_detection\fP (if enabled in \fBlvm.conf\fP(5)) or
119 \fB\-\-dataalignmentoffset\fP.
120 .TP
121 .B \-\-dataalignmentoffset \fIalignment_offset
122 Shift the start of the data area by this additional \fIalignment_offset\fP.
123 .TP
124 .BR \-\- [ pv ] metadatacopies " " \fINumberOfCopies
125 The number of metadata areas to set aside on each PV. Currently
126 this can be 0, 1 or 2.
127 If set to 2, two copies of the volume group metadata
128 are held on the PV, one at the front of the PV and one at the end.
129 If set to 1 (the default), one copy is kept at the front of the PV
130 (starting in the 5th sector).
131 If set to 0, no copies are kept on this PV - you might wish to use this
132 with VGs containing large numbers of PVs. But if you do this and
133 then later use \fBvgsplit\fP(8) you must ensure that each VG is still going
134 to have a suitable number of copies of the metadata after the split!
135 .TP
136 .BR \-\-metadataignore " {" \fIy | \fIn }
137 Ignore or un-ignore metadata areas on this physical volume.
138 The default is "n". This setting can be changed with \fBpvchange\fP.
139 If metadata areas on a physical volume are ignored, LVM will
140 not store metadata in the metadata areas present on this Physical
141 Volume. Metadata areas cannot be created or extended after Logical
142 Volumes have been allocated on the device. If you do not want to store
143 metadata on this device, it is still wise always to allocate a metadata
144 area in case you need it in the future and to use this option to instruct
145 LVM2 to ignore it.
146 .TP
147 .B \-\-restorefile \fIfile
148 In conjunction with \fB--uuid\fP, this extracts the location and size
149 of the data on the PV from the file (produced by \fBvgcfgbackup\fP)
150 and ensures that the metadata that the program produces is consistent
151 with the contents of the file i.e. the physical extents will be in
152 the same place and not get overwritten by new metadata. This provides
153 a mechanism to upgrade the metadata format or to add/remove metadata
154 areas. Use with care. See also \fBvgconvert\fP(8).
155 .TP
156 .B \-\-norestorefile
157 In conjunction with \fB\-\-uuid\fP, this allows a \fIuuid\fP to be specified
158 without also requiring that a backup of the metadata be provided.
159 .TP
160 .B \-\-labelsector \fIsector
161 By default the PV is labelled with an LVM2 identifier in its second
162 sector (sector 1). This lets you use a different sector near the
163 start of the disk (between 0 and 3 inclusive - see LABEL_SCAN_SECTORS
164 in the source). Use with care.
165 .TP
166 .B \-\-setphysicalvolumesize \fIsize
167 Overrides the automatically-detected size of the PV. Use with care.
168 .SH Examples
169 Initialize partition #4 on the third SCSI disk and the entire fifth
170 SCSI disk for later use by LVM:
171 .sp
172 .B pvcreate /dev/sdc4 /dev/sde
173
174 If the 2nd SCSI disk is a 4KiB sector drive that compensates for windows
175 partitioning (sector 7 is the lowest aligned logical block, the 4KiB
176 sectors start at LBA -1, and consequently sector 63 is aligned on a 4KiB
177 boundary) manually account for this when initializing for use by LVM:
178 .sp
179 .B pvcreate \-\-dataalignmentoffset 7s /dev/sdb
180
181 .SH SEE ALSO
182 .BR lvm.conf (5),
183 .BR lvm (8),
184 .BR vgcreate (8),
185 .BR vgextend (8),
186 .BR lvcreate (8),
187 .BR cfdisk (8),
188 .BR fdisk (8),
189 .BR losetup (8),
190 .BR mdadm (8),
191 .BR vgcfgrestore (8),
192 .BR vgconvert (8)
This page took 2.190267 seconds and 5 git commands to generate.