1PVCREATE(8)                 System Manager's Manual                PVCREATE(8)
2
3
4

NAME

6       pvcreate - initialize a disk or partition for use by LVM
7

SYNOPSIS

9       pvcreate  [-d|--debug]  [-h|--help]  [-t|--test] [-v|--verbose] [--ver‐
10       sion] [-f[f]|--force [--force]] [-y|--yes] [--labelsector]  [-M|--meta‐
11       datatype  type]  [--[pv]metadatacopies  #copies]  [--metadatasize size]
12       [--metadataignore  {y|n}]  [--dataalignment  alignment]   [--dataalign‐
13       mentoffset  alignment_offset]  [--restorefile  file]  [--norestorefile]
14       [--setphysicalvolumesize size] [-u|--uuid uuid] [-Z|--zero {y|n}] Phys‐
15       icalVolume [PhysicalVolume...]
16

DESCRIPTION

18       pvcreate initializes PhysicalVolume for later use by the Logical Volume
19       Manager (LVM).  Each PhysicalVolume can  be  a  disk  partition,  whole
20       disk, meta device, or loopback file.  For DOS disk partitions, the par‐
21       tition id should be set to 0x8e using fdisk(8), cfdisk(8), or a equiva‐
22       lent.   For whole disk devices only the partition table must be erased,
23       which will effectively destroy all data on that disk.  This can be done
24       by zeroing the first sector with:
25
26       dd if=/dev/zero of=PhysicalVolume bs=512 count=1
27
28       Continue  with vgcreate(8) to create a new volume group on PhysicalVol‐
29       ume, or vgextend(8) to add PhysicalVolume to an existing volume group.
30

OPTIONS

32       See lvm(8) for common options.
33
34       -f, --force
35              Force the creation without any confirmation.  You can not recre‐
36              ate  (reinitialize)  a  physical volume belonging to an existing
37              volume group.  In an emergency you can override  this  behaviour
38              with -ff.
39
40       -u, --uuid uuid
41              Specify  the uuid for the device.  Without this option, pvcreate
42              generates a random uuid.  All of your physical volumes must have
43              unique  uuids.   You  need to use this option before restoring a
44              backup of LVM metadata onto a replacement device - see  vgcfgre‐
45              store(8).   As  such,  use of --restorefile is compulsory unless
46              the --norestorefile is used.
47
48       -y, --yes
49              Answer yes to all questions.
50
51       -Z, --zero y|n
52              Whether or not the first 4 sectors (2048 bytes)  of  the  device
53              should be wiped.  If this option is not given, the default is to
54              wipe these sectors unless either or both of the --restorefile or
55              --uuid options were specified.
56

NEW METADATA OPTIONS

58       LVM2  introduces  a  new format for storing metadata on disk.  This new
59       format is more efficient and resilient than  the  format  the  original
60       version  of  LVM  used and offers the advanced user greater flexibility
61       and control.
62
63       The new format may be selected on the command line with -M2 or by  set‐
64       ting  format = "lvm2" in the global section of lvm.conf.  Each physical
65       volume in the same volume group must use the same format, but different
66       volume  groups  on  a machine may use different formats simultaneously:
67       the tools can handle both formats.  Additional formats can be added  as
68       shared libraries.
69
70       Additional  tools  for manipulating the locations and sizes of metadata
71       areas will be written in due course.  Use the verbose/debug options  on
72       the tools to see where the metadata areas are placed.
73
74       --metadatasize size
75              The  approximate  amount of space to be set aside for each meta‐
76              data area.  (The size you specify may get rounded.)
77
78       --dataalignment alignment
79              Align the start of the data to a multiple of this  number.   You
80              should  also specify an appropriate PhysicalExtentSize when cre‐
81              ating the Volume Group with vgcreate.
82
83              To see the location of the first Physical Extent of an  existing
84              Physical Volume use pvs -o +pe_start .  It will be a multiple of
85              the requested alignment.  In  addition  it  may  be  shifted  by
86              alignment_offset    from   data_alignment_offset_detection   (if
87              enabled in lvm.conf) or --dataalignmentoffset.
88
89       --dataalignmentoffset alignment_offset
90              Shift the start of the  data  area  by  this  additional  align‐
91              ment_offset.
92
93       --[pv]metadatacopies copies
94              The number of metadata areas to set aside on each PV.  Currently
95              this can be 0, 1 or 2.  If set to 2, two copies  of  the  volume
96              group  metadata  are  held on the PV, one at the front of the PV
97              and one at the end.  If set to 1 (the default), one copy is kept
98              at  the front of the PV (starting in the 5th sector).  If set to
99              0, no copies are kept on this PV - you might wish  to  use  this
100              with  VGs  containing  large numbers of PVs.  But if you do this
101              and then later use vgsplit you must ensure that each VG is still
102              going  to have a suitable number of copies of the metadata after
103              the split!
104
105       --metadataignore y|n
106              Ignore or un-ignore metadata areas on this physical volume.  The
107              default  is "n".  This setting can be changed with pvchange.  If
108              metadata areas on a physical volume are ignored,  LVM  will  not
109              not  store metadata in the metadata areas present on this Physi‐
110              cal Volume.  Metadata areas cannot be created or extended  after
111              Logical Volumes have been allocated on the device. If you do not
112              want to store metadata on this device, it is still  wise  always
113              to  allocate  a  metadata area in case you need it in the future
114              and to use this option to instruct LVM2 to ignore it.
115
116       --restorefile file
117              In conjunction with --uuid, this extracts the location and  size
118              of  the  data  on the PV from the file (produced by vgcfgbackup)
119              and ensures that the metadata that the program produces is  con‐
120              sistent  with the contents of the file i.e. the physical extents
121              will be in the same place and not get overwritten by  new  meta‐
122              data.   This provides a mechanism to upgrade the metadata format
123              or to add/remove metadata areas. Use with care. See also  vgcon‐
124              vert(8).
125
126       --norestorefile
127              In  conjunction  with --uuid, this allows a uuid to be specified
128              without also requiring that a backup of  the  metadata  be  pro‐
129              vided.
130
131       --labelsector sector
132              By  default  the  PV  is labelled with an LVM2 identifier in its
133              second sector (sector 1).  This lets you use a different  sector
134              near  the  start  of  the  disk (between 0 and 3 inclusive - see
135              LABEL_SCAN_SECTORS in the source).  Use with care.
136
137       --setphysicalvolumesize size
138              Overrides the automatically-detected size of the PV.   Use  with
139              care.
140

EXAMPLES

142       Initialize  partition  #4  on  the third SCSI disk and the entire fifth
143       SCSI disk for later use by LVM:
144
145       pvcreate /dev/sdc4 /dev/sde
146
147       If the 2nd SCSI disk is a 4KB sector drive that compensates for windows
148       partitioning  (sector  7  is  the lowest aligned logical block, the 4KB
149       sectors start at LBA -1, and consequently sector 63 is aligned on a 4KB
150       boundary) manually account for this when initializing for use by LVM:
151
152       pvcreate --dataalignmentoffset 7s /dev/sdb
153
154

SEE ALSO

156       lvm.conf(5),  lvm(8), vgcreate(8), vgextend(8), lvcreate(8), cfdisk(8),
157       fdisk(8), losetup(8), mdadm(8), vgcfgrestore(8), vgconvert(8)
158
159
160
161Sistina Software UK    LVM TOOLS 2.02.84(2) (2011-02-09)           PVCREATE(8)
Impressum