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