Tizen 2.1 base
[external/device-mapper.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 [ \-f [ f ]| \-\-force " [" \-\-force ]]
8 .RB [ \-y | \-\-yes ]
9 .RB [ \-h | \-\-help ]
10 .RB [ \-t | \-\-test ]
11 .RB [ \-v | \-\-verbose ]
12 .RB [ \-\-labelsector ]
13 .RB [ \-M | \-\-metadatatype type ]
14 .RB [ \-\-[pv]metadatacopies #copies ]
15 .RB [ \-\-metadatasize size ]
16 .RB [ \-\-metadataignore y|n ]
17 .RB [ \-\-dataalignment alignment ]
18 .RB [ \-\-dataalignmentoffset alignment_offset ]
19 .RB [ \-\-restorefile file ]
20 .RB [ \-\-norestorefile ]
21 .RB [ \-\-setphysicalvolumesize size ]
22 .RB [ \-u | \-\-uuid uuid ]
23 .RB [ \-\-version ]
24 .RB [ \-Z | \-\-zero y|n ]
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.
33 For DOS disk partitions, the partition id should be set to 0x8e using
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
52 See \fBlvm\fP(8) for common options.
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.
57 In an emergency you can override this behaviour with -ff.
58 .TP
59 .BR \-u ", " \-\-uuid " uuid"
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.
63 You need to use this option before restoring a backup of LVM metadata 
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.
67 .TP
68 .BR \-y ", " \-\-yes
69 Answer yes to all questions.
70 .TP
71 .BR \-Z ", " \-\-zero " y|n"
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 
75 default is to wipe these sectors unless either or both of the --restorefile 
76 or --uuid options were specified.
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
94 .BR \-\-metadatasize " size"
95 The approximate amount of space to be set aside for each metadata area.
96 (The size you specify may get rounded.)
97 .TP
98 .BR \-\-dataalignment " alignment"
99 Align the start of the data to a multiple of this number.
100 You should also specify an appropriate \fBPhysicalExtentSize\fP when creating
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
105 \fBalignment\fP.  In addition it may be shifted by \fBalignment_offset\fP from
106 \fBdata_alignment_offset_detection\fP (if enabled in \fBlvm.conf\fP) or
107 \fB--dataalignmentoffset\fP.
108 .TP
109 .BR \-\-dataalignmentoffset " alignment_offset"
110 Shift the start of the data area by this additional \fBalignment_offset\fP.
111 .TP
112 .BR \-\-[pv]metadatacopies " copies"
113 The number of metadata areas to set aside on each PV.  Currently
114 this can be 0, 1 or 2.  
115 If set to 2, two copies of the volume group metadata 
116 are held on the PV, one at the front of the PV and one at the end.  
117 If set to 1 (the default), one copy is kept at the front of the PV 
118 (starting in the 5th sector).
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
124 .BR \-\-metadataignore " y|n"
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
128 not not store metadata in the metadata areas present on this Physical
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
135 .BR \-\-restorefile " file"
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
144 .BR \-\-norestorefile
145 In conjunction with \fB--uuid\fP, this allows a uuid to be specified
146 without also requiring that a backup of the metadata be provided.
147 .TP
148 .BR \-\-labelsector " sector"
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
154 .BR \-\-setphysicalvolumesize " size"
155 Overrides the automatically-detected size of the PV.  Use with care.
156 .SH EXAMPLES
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
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
169 .SH SEE ALSO
170 .BR lvm.conf (5),
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)