1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 01:55:10 +03:00
lvm2/man/pvcreate.8_des

79 lines
3.6 KiB
Plaintext
Raw Normal View History

Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-14 00:00:11 +03:00
pvcreate initializes a Physical Volume (PV) on a device so the device is
recognized as belonging to LVM. This allows the PV to be used in a Volume
Group (VG). An LVM disk label is written to the device, and LVM metadata
areas are initialized. A PV can be placed on a whole device or partition.
2017-02-11 01:20:19 +03:00
Use \fBvgcreate\fP(8) to create a new VG on the PV, or \fBvgextend\fP(8)
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-14 00:00:11 +03:00
to add the PV to an existing VG. Use \fBpvremove\fP(8) to remove the LVM
disk label from the device.
2017-02-11 01:20:19 +03:00
The force option will create a PV without confirmation. Repeating the
force option (\fB-ff\fP) will forcibly create a PV, overriding checks that
normally prevent it, e.g. if the PV is already in a VG.
Place the first PE at 1 MiB for all defaults . When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
2018-11-14 00:00:11 +03:00
.B Metadata location, size, and alignment
The LVM disk label begins 512 bytes from the start of the device, and is
512 bytes in size.
The LVM metadata area begins at an offset (from the start of the device)
equal to the page size of the machine creating the PV (often 4 KiB.) The
metadata area contains a 512 byte header and a multi-KiB circular buffer
that holds text copies of the VG metadata.
With default settings, the first physical extent (PE), which contains LV
data, is 1 MiB from the start of the device. This location is controlled
by \fBdefault_data_alignment\fP in lvm.conf, which is set to 1 (MiB) by
default. The pe_start will be a multiple of this many MiB. This location
can be checked with:
.br
.B pvs -o pe_start
.I PV
The size of the LVM metadata area is the space between the the start of
the metadata area and the first PE. When metadata begins at 4 KiB and the
first PE is at 1024 KiB, the metadata area size is 1020 KiB. This can be
checked with:
.br
.B pvs -o mda_size
.I PV
The mda_size cannot be increased after pvcreate, so if larger metadata is
needed, it must be set during pvcreate. Two copies of the VG metadata
must always fit within the metadata area, so the maximum VG metadata size
is around half the mda_size. This can be checked with:
.br
.B vgs -o mda_free
.I VG
A larger metadata area can be set with --metadatasize. The resulting
mda_size may be larger than specified due to default_data_alignment
placing pe_start on a MiB boundary, and the fact that the metadata area
extends to the first PE. With metadata starting at 4 KiB and
default_data_alignment 1 (MiB), setting --metadatasize 2048k results in
pe_start of 3 MiB and mda_size of 3068 KiB. Alternatively, --metadatasize
2044k results in pe_start at 2 MiB and mda_size of 2044 KiB.
The alignment of pe_start described above may be automatically overriden
based on md device properties or device i/o properties reported in sysfs.
These automatic adjustments can be enabled/disabled using lvm.conf
settings md_chunk_alignment and data_alignment_offset_detection.
To use a different pe_start alignment, use the --dataalignment option.
The --metadatasize option would also typically be used in this case
because the metadata area size also determines the location of pe_start.
When using these two options together, pe_start is calculated as:
metadata area start (page size), plus the specified --metadatasize,
rounded up to the next multiple of --dataalignment.
With metadata starting at 4 KiB, --metadatasize 2048k, and --dataalignment 128k,
pe_start is 2176 KiB and mda_size is 2172 KiB.
The pe_start of 2176 KiB is the nearest even multiple of 128 KiB that
provides at least 2048 KiB of metadata space.
Always check the resulting alignment and metadata size when using
these options.
To shift an aligned pe_start value, use the --dataaligmentoffset option.
The pe_start alignment is calculated as described above, and then the
value specified with --dataaligmentoffset is added to produce the final
pe_start value.