Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / lvm2 / dist / 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 [ \-\-dataalignment alignment ]
17 .RB [ \-\-dataalignmentoffset alignment_offset ]
18 .RB [ \-\-restorefile file ]
19 .RB [ \-\-setphysicalvolumesize size ]
20 .RB [ \-u | \-\-uuid uuid ]
21 .RB [ \-\-version ]
22 .RB [ \-Z | \-\-zero y|n ]
23 .IR PhysicalVolume " [" PhysicalVolume ...]
24 .SH DESCRIPTION
25 .B pvcreate
26 initializes
27 .I PhysicalVolume
28 for later use by the Logical Volume Manager (LVM).  Each
29 .I PhysicalVolume
30 can be a disk partition, whole disk, meta device, or loopback file.
31 For DOS disk partitions, the partition id should be set to 0x8e using
32 .BR fdisk "(8), " cfdisk "(8), "
33 or a equivalent.  For
34 .B whole disk devices only
35 the partition table must be erased, which will effectively destroy all
36 data on that disk.  This can be done by zeroing the first sector with:
37 .sp
38 .BI "dd if=/dev/zero of=" PhysicalVolume " bs=512 count=1"
39 .sp
40 Continue with
41 .BR vgcreate (8)
42 to create a new volume group on
43 .IR PhysicalVolume ,
44 or
45 .BR vgextend (8)
46 to add
47 .I PhysicalVolume
48 to an existing volume group.
49 .SH OPTIONS
50 See \fBlvm\fP(8) for common options.
51 .TP
52 .BR \-f ", " \-\-force
53 Force the creation without any confirmation.  You can not recreate
54 (reinitialize) a physical volume belonging to an existing volume group.
55 In an emergency you can override this behaviour with -ff.
56 .TP
57 .BR \-u ", " \-\-uuid " uuid"
58 Specify the uuid for the device.  
59 Without this option, \fBpvcreate\fP generates a random uuid.
60 All of your physical volumes must have unique uuids.
61 You need to use this option before restoring a backup of LVM metadata 
62 onto a replacement device - see \fBvgcfgrestore\fP(8).
63 .TP
64 .BR \-y ", " \-\-yes
65 Answer yes to all questions.
66 .TP
67 .BR \-Z ", " \-\-zero " y|n"
68 Whether or not the first 4 sectors (2048 bytes) of the device should be 
69 wiped.
70 If this option is not given, the 
71 default is to wipe these sectors unless either or both of the --restorefile 
72 or --uuid options were specified.
73 .SH NEW METADATA OPTIONS
74 LVM2 introduces a new format for storing metadata on disk.
75 This new format is more efficient and resilient than the format the 
76 original version of LVM used and offers the advanced user greater 
77 flexibility and control.
78 .sp
79 The new format may be selected on the command line with \fB-M2\fP or by 
80 setting \fBformat = "lvm2"\fP in the \fBglobal\fP section of \fBlvm.conf\fP.
81 Each physical volume in the same volume group must use the same format, but
82 different volume groups on a machine may use different formats 
83 simultaneously: the tools can handle both formats.
84 Additional formats can be added as shared libraries.
85 .sp
86 Additional tools for manipulating the locations and sizes of metadata areas 
87 will be written in due course.  Use the verbose/debug options on the tools
88 to see where the metadata areas are placed.
89 .TP
90 .BR \-\-metadatasize " size"
91 The approximate amount of space to be set aside for each metadata area.
92 (The size you specify may get rounded.)
93 .TP
94 .BR \-\-dataalignment " alignment"
95 Align the start of the data to a multiple of this number.
96 You should also specify an appropriate \fBPhysicalExtentSize\fP when creating
97 the Volume Group with \fBvgcreate\fP.
98 .sp
99 To see the location of the first Physical Extent of an existing Physical Volume
100 use \fBpvs -o +pe_start\fP .  It will be a multiple of the requested
101 \fBalignment\fP.  In addition it may be shifted by \fBalignment_offset\fP from
102 \fBdata_alignment_offset_detection\fP (if enabled in \fBlvm.conf\fP) or
103 \fB--dataalignmentoffset\fP.
104 .TP
105 .BR \-\-dataalignmentoffset " alignment_offset"
106 Shift the start of the data area by this additional \fBalignment_offset\fP.
107 .TP
108 .BR \-\-[pv]metadatacopies " copies"
109 The number of metadata areas to set aside on each PV.  Currently
110 this can be 0, 1 or 2.  
111 If set to 2, two copies of the volume group metadata 
112 are held on the PV, one at the front of the PV and one at the end.  
113 If set to 1 (the default), one copy is kept at the front of the PV 
114 (starting in the 5th sector).
115 If set to 0, no copies are kept on this PV - you might wish to use this
116 with VGs containing large numbers of PVs.  But if you do this and
117 then later use \fBvgsplit\fP you must ensure that each VG is still going 
118 to have a suitable number of copies of the metadata after the split!
119 .TP
120 .BR \-\-restorefile " file"
121 In conjunction with \fB--uuid\fP, this extracts the location and size
122 of the data on the PV from the file (produced by \fBvgcfgbackup\fP)
123 and ensures that the metadata that the program produces is consistent 
124 with the contents of the file i.e. the physical extents will be in 
125 the same place and not get overwritten by new metadata.  This provides
126 a mechanism to upgrade the metadata format or to add/remove metadata
127 areas. Use with care. See also \fBvgconvert\fP(8).
128 .TP
129 .BR \-\-labelsector " sector"
130 By default the PV is labelled with an LVM2 identifier in its second 
131 sector (sector 1).  This lets you use a different sector near the
132 start of the disk (between 0 and 3 inclusive - see LABEL_SCAN_SECTORS
133 in the source).  Use with care.
134 .TP
135 .BR \-\-setphysicalvolumesize " size"
136 Overrides the automatically-detected size of the PV.  Use with care.
137 .SH EXAMPLES
138 Initialize partition #4 on the third SCSI disk and the entire fifth
139 SCSI disk for later use by LVM:
140 .sp
141 .B pvcreate /dev/sdc4 /dev/sde
142 .sp
143 If the 2nd SCSI disk is a 4KB sector drive that compensates for windows
144 partitioning (sector 7 is the lowest aligned logical block, the 4KB
145 sectors start at LBA -1, and consequently sector 63 is aligned on a 4KB
146 boundary) manually account for this when initializing for use by LVM:
147 .sp
148 .B pvcreate --dataalignmentoffset 7s /dev/sdb
149 .sp
150 .SH SEE ALSO
151 .BR lvm.conf (5),
152 .BR lvm (8),
153 .BR vgcreate (8), 
154 .BR vgextend (8), 
155 .BR lvcreate (8), 
156 .BR cfdisk (8), 
157 .BR fdisk (8), 
158 .BR losetup (8), 
159 .BR mdadm (8), 
160 .BR vgcfgrestore (8), 
161 .BR vgconvert (8)