2008-10-08 16:50:13 +04:00
.TH PVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
2002-01-04 23:35:19 +03:00
.SH NAME
2014-06-11 13:06:30 +04:00
pvcreate \(em initialize a disk or partition for use by LVM
2002-01-04 23:35:19 +03:00
.SH SYNOPSIS
.B pvcreate
2014-05-21 16:53:56 +04:00
.RB [ \- \- commandprofile
.IR ProfileName ]
2011-02-05 00:19:03 +03:00
.RB [ \- d | \- \- debug ]
.RB [ \- h | \- \- help ]
.RB [ \- t | \- \- test ]
.RB [ \- v | \- \- verbose ]
.RB [ \- \- version ]
2012-04-11 16:42:10 +04:00
.RB [ \- f [ f ]| \- \- force
.RB [ \- \- force ]]
2002-01-04 23:35:19 +03:00
.RB [ \- y | \- \- yes ]
2002-11-18 17:04:08 +03:00
.RB [ \- \- labelsector ]
2013-05-28 14:37:22 +04:00
.RB [ \- \- bootloaderareasize
2013-02-26 17:10:11 +04:00
.IR size ]
2012-04-11 16:42:10 +04:00
.RB [ \- M | \- \- metadatatype
.IR type ]
.RB [ \- \- [ pv ] metadatacopies
.IR NumberOfCopies ]
.RB [ \- \- metadatasize
.IR size ]
.RB [ \- \- metadataignore
.RI { y | n }]
.RB [ \- \- dataalignment
.IR alignment ]
.RB [ \- \- dataalignmentoffset
.IR alignment_offset ]
.RB [ \- \- restorefile
.IR file ]
2010-08-12 08:08:59 +04:00
.RB [ \- \- norestorefile ]
2012-04-11 16:42:10 +04:00
.RB [ \- \- setphysicalvolumesize
.IR size ]
.RB [ \- u | \- \- uuid
.IR uuid ]
.RB [ \- Z | \- \- zero
.RI { y | n }]
.I PhysicalVolume
.RI [ PhysicalVolume ...]
2002-01-04 23:35:19 +03:00
.SH DESCRIPTION
2012-04-11 16:42:10 +04:00
pvcreate initializes
2002-01-04 23:35:19 +03:00
.I PhysicalVolume
for later use by the Logical Volume Manager (LVM). Each
.I PhysicalVolume
can be a disk partition, whole disk, meta device, or loopback file.
2002-11-18 17:04:08 +03:00
For DOS disk partitions, the partition id should be set to 0x8e using
2012-04-11 16:42:10 +04:00
.BR fdisk (8),
.BR cfdisk (8),
2002-01-04 23:35:19 +03:00
or a equivalent. For
.B whole disk devices only
the partition table must be erased, which will effectively destroy all
data on that disk. This can be done by zeroing the first sector with:
.sp
.BI "dd if=/dev/zero of=" PhysicalVolume " bs=512 count=1"
.sp
Continue with
.BR vgcreate (8)
to create a new volume group on
.IR PhysicalVolume ,
or
.BR vgextend (8)
to add
.I PhysicalVolume
to an existing volume group.
.SH OPTIONS
2002-01-16 21:10:08 +03:00
See \fB lvm\fP (8) for common options.
2002-01-04 23:35:19 +03:00
.TP
.BR \- f ", " \- \- force
Force the creation without any confirmation. You can not recreate
(reinitialize) a physical volume belonging to an existing volume group.
2011-01-28 19:03:38 +03:00
In an emergency you can override this behaviour with \fB -ff\fP .
2002-01-16 21:10:08 +03:00
.TP
2011-01-28 19:03:38 +03:00
.BR \- u ", " \- \- uuid " " \fI uuid
2012-04-11 16:42:10 +04:00
Specify the uuid for the device.
Without this option, \fB pvcreate\fP (8) generates a random uuid.
2002-01-16 21:10:08 +03:00
All of your physical volumes must have unique uuids.
2012-04-11 16:42:10 +04:00
You need to use this option before restoring a backup of LVM metadata
2010-08-12 08:08:59 +04:00
onto a replacement device - see \fB vgcfgrestore\fP (8). As such, use of
2012-04-11 16:42:10 +04:00
\fB \- \- restorefile\fP is compulsory unless the \fB \- \- norestorefile\fP is
2010-08-12 08:08:59 +04:00
used.
2002-01-04 23:35:19 +03:00
.TP
.BR \- y ", " \- \- yes
Answer yes to all questions.
2005-01-05 20:25:25 +03:00
.TP
2012-04-11 16:42:10 +04:00
.BR \- Z ", " \- \- zero " {" \fI y | \fI n }
Whether or not the first 4 sectors (2048 bytes) of the device should be
2005-01-05 20:25:25 +03:00
wiped.
2012-04-11 16:42:10 +04:00
If this option is not given, the
default is to wipe these sectors unless either or both of the
\fB \- \- restorefile\fP or \fB \- \- uuid\fP options were specified.
2002-11-18 17:04:08 +03:00
.SH NEW METADATA OPTIONS
LVM2 introduces a new format for storing metadata on disk.
2012-04-11 16:42:10 +04:00
This new format is more efficient and resilient than the format the
original version of LVM used and offers the advanced user greater
2002-11-18 17:04:08 +03:00
flexibility and control.
2012-04-11 16:42:10 +04:00
.P
The new format may be selected on the command line with \fB \- M2\fP or by
setting \fB format = "lvm2"\fP in the \fB global\fP section of \fB lvm.conf\fP (5).
2002-11-18 17:04:08 +03:00
Each physical volume in the same volume group must use the same format, but
2012-04-11 16:42:10 +04:00
different volume groups on a machine may use different formats
2002-11-18 17:04:08 +03:00
simultaneously: the tools can handle both formats.
Additional formats can be added as shared libraries.
2012-04-11 16:42:10 +04:00
.P
Additional tools for manipulating the locations and sizes of metadata areas
2002-11-18 17:04:08 +03:00
will be written in due course. Use the verbose/debug options on the tools
to see where the metadata areas are placed.
.TP
2012-04-11 16:42:10 +04:00
.B \- \- metadatasize \fI size
2002-11-18 17:04:08 +03:00
The approximate amount of space to be set aside for each metadata area.
(The size you specify may get rounded.)
.TP
2012-04-11 16:42:10 +04:00
.B \- \- dataalignment \fI alignment
2009-07-30 21:45:28 +04:00
Align the start of the data to a multiple of this number.
2011-01-28 19:03:38 +03:00
You should also specify an appropriate \fI PhysicalExtentSize\fP when creating
2009-02-22 22:00:26 +03:00
the Volume Group with \fB vgcreate\fP .
.sp
To see the location of the first Physical Extent of an existing Physical Volume
2014-06-11 13:06:30 +04:00
use \fB pvs \- o +pe_start\fP . It will be a multiple of the requested
2011-01-28 19:03:38 +03:00
alignment. In addition it may be shifted by \fI alignment_offset\fP from
2012-04-11 16:42:10 +04:00
\fI data_alignment_offset_detection\fP (if enabled in \fB lvm.conf\fP (5)) or
\fB \- \- dataalignmentoffset\fP .
2009-07-30 21:45:28 +04:00
.TP
2012-04-11 16:42:10 +04:00
.B \- \- dataalignmentoffset \fI alignment_offset
2011-01-28 19:03:38 +03:00
Shift the start of the data area by this additional \fI alignment_offset\fP .
2009-02-22 22:00:26 +03:00
.TP
2012-04-11 16:42:10 +04:00
.BR \- \- [ pv ] metadatacopies " " \fI NumberOfCopies
2002-11-18 17:04:08 +03:00
The number of metadata areas to set aside on each PV. Currently
2012-04-11 16:42:10 +04:00
this can be 0, 1 or 2.
If set to 2, two copies of the volume group metadata
are held on the PV, one at the front of the PV and one at the end.
If set to 1 (the default), one copy is kept at the front of the PV
2005-03-04 00:52:58 +03:00
(starting in the 5th sector).
2002-11-18 17:04:08 +03:00
If set to 0, no copies are kept on this PV - you might wish to use this
with VGs containing large numbers of PVs. But if you do this and
2012-04-11 16:42:10 +04:00
then later use \fB vgsplit\fP (8) you must ensure that each VG is still going
2002-11-18 17:04:08 +03:00
to have a suitable number of copies of the metadata after the split!
.TP
2012-04-11 16:42:10 +04:00
.BR \- \- metadataignore " {" \fI y | \fI n }
2010-07-13 19:04:23 +04:00
Ignore or un-ignore metadata areas on this physical volume.
The default is "n". This setting can be changed with \fB pvchange\fP .
If metadata areas on a physical volume are ignored, LVM will
2011-09-07 13:48:49 +04:00
not store metadata in the metadata areas present on this Physical
2010-07-02 21:05:22 +04:00
Volume. Metadata areas cannot be created or extended after Logical
Volumes have been allocated on the device. If you do not want to store
metadata on this device, it is still wise always to allocate a metadata
area in case you need it in the future and to use this option to instruct
LVM2 to ignore it.
.TP
2012-04-11 16:42:10 +04:00
.B \- \- restorefile \fI file
2014-06-11 13:06:30 +04:00
In conjunction with \fB \- \- uuid\fP , this extracts the location and size
2002-11-18 17:04:08 +03:00
of the data on the PV from the file (produced by \fB vgcfgbackup\fP )
2012-04-11 16:42:10 +04:00
and ensures that the metadata that the program produces is consistent
with the contents of the file i.e. the physical extents will be in
2002-11-18 17:04:08 +03:00
the same place and not get overwritten by new metadata. This provides
a mechanism to upgrade the metadata format or to add/remove metadata
areas. Use with care. See also \fB vgconvert\fP (8).
.TP
2011-01-28 19:03:38 +03:00
.B \- \- norestorefile
2012-04-11 16:42:10 +04:00
In conjunction with \fB \- \- uuid\fP , this allows a \fI uuid\fP to be specified
2010-08-12 08:08:59 +04:00
without also requiring that a backup of the metadata be provided.
.TP
2012-04-11 16:42:10 +04:00
.B \- \- labelsector \fI sector
By default the PV is labelled with an LVM2 identifier in its second
2002-11-18 17:04:08 +03:00
sector (sector 1). This lets you use a different sector near the
start of the disk (between 0 and 3 inclusive - see LABEL_SCAN_SECTORS
in the source). Use with care.
.TP
2013-05-28 14:37:22 +04:00
.B \- \- bootloaderareasize \fI size
Create a separate bootloader area of specified size besides PV's data
area. The bootloader area is an area of reserved space on the PV from
which LVM2 will not allocate any extents and it's kept untouched. This is
primarily aimed for use with bootloaders to embed their own data or metadata.
2014-06-11 13:06:30 +04:00
The start of the bootloader area is always aligned, see also \fB \- \- dataalignment\fP
and \fB \- \- dataalignmentoffset\fP . The bootloader area size may eventually
2013-02-26 17:10:11 +04:00
end up increased due to the alignment, but it's never less than the
2013-05-28 14:37:22 +04:00
size that is requested. To see the bootloader area start and size of
2014-06-11 13:06:30 +04:00
an existing Physical Volume use \fB pvs \- o +pv_ba_start,pv_ba_size\fP .
2013-02-26 17:10:11 +04:00
.TP
2012-04-11 16:42:10 +04:00
.B \- \- setphysicalvolumesize \fI size
2002-11-18 17:04:08 +03:00
Overrides the automatically-detected size of the PV. Use with care.
2012-04-11 16:42:10 +04:00
.SH Examples
2002-01-04 23:35:19 +03:00
Initialize partition #4 on the third SCSI disk and the entire fifth
SCSI disk for later use by LVM:
.sp
.B pvcreate /dev/sdc4 /dev/sde
2012-04-11 16:42:10 +04:00
If the 2nd SCSI disk is a 4KiB sector drive that compensates for windows
partitioning (sector 7 is the lowest aligned logical block, the 4KiB
sectors start at LBA -1, and consequently sector 63 is aligned on a 4KiB
2009-07-30 21:45:28 +04:00
boundary) manually account for this when initializing for use by LVM:
.sp
2012-04-11 16:42:10 +04:00
.B pvcreate \- \- dataalignmentoffset 7 s /dev/sdb
2002-01-04 23:35:19 +03:00
.SH SEE ALSO
2009-07-30 21:45:28 +04:00
.BR lvm.conf (5),
2008-10-08 16:50:13 +04:00
.BR lvm (8),
2012-04-11 16:42:10 +04:00
.BR vgcreate (8),
.BR vgextend (8),
.BR lvcreate (8),
.BR cfdisk (8),
.BR fdisk (8),
.BR losetup (8),
.BR mdadm (8),
.BR vgcfgrestore (8),
2008-10-08 16:50:13 +04:00
.BR vgconvert (8)