Lvcreate: Difference between revisions
(→--size) |
|||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[Linux_Logical_Volume_Management_Operations#Logical_Volume_Management_Operations|Logical Volume Operations]] | |||
* [[Linux#Commands|Linux]] | * [[Linux#Commands|Linux]] | ||
=Options= | =Options= | ||
<pre> | |||
lvcreate --size 20G --name santorini VolGroup00 | |||
</pre> | |||
==-n|--name== | |||
Sets the name for the new logical volume. If not specified, a default name will be generated. | |||
==--type== | ==--type== | ||
Line 17: | Line 26: | ||
For more details, see: {{Internal|Linux_Logical_Volume_Management_Concepts#Logical_Volume_.28LV.29|Logical Volume Types}} | For more details, see: {{Internal|Linux_Logical_Volume_Management_Concepts#Logical_Volume_.28LV.29|Logical Volume Types}} | ||
==--size== | ==L|--size== | ||
<span id='--size'></span> | |||
<pre> | <pre> | ||
--size LogicalVolumeSize[b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E] | -L|--size LogicalVolumeSize[b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E] | ||
</pre> | </pre> | ||
Gives the size to allocate for the new logical volume. A size suffix of B for bytes, S for sectors as 512 bytes, K for kilobytes, M for megabytes, G for gigabytes, T for terabytes, P for petabytes or E for exabytes is optional. Default unit is megabytes. | Gives the size to allocate for the new logical volume. A size suffix of B for bytes, S for sectors as 512 bytes, K for kilobytes, M for megabytes, G for gigabytes, T for terabytes, P for petabytes or E for exabytes is optional. Default unit is megabytes. | ||
==-l|--extents== | |||
<pre> | |||
-l|--extent LogicalExtentsNumber[%{VG|PVS|FREE|ORIGIN}] | |||
</pre> | |||
Specifies the size of the new LV in logical extents. The number of physical extents allocated may be different, and depends on the LV type. Certain LV types require more physical extents for data redundancy or metadata. An alternate syntax allows the size to be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs. The suffix %VG denotes the total size of the VG, the suffix %FREE the remaining free space in the VG, and the suffix %PVS the free space in the specified Physical Volumes. For a snapshot, the size can be expressed as a percentage of the total size of the Origin Logical Volume with the suffix %ORIGIN (100%ORIGIN provides space for the whole origin). When expressed as a percentage, the size defines an upper limit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determined until the command has completed. | |||
==--chunksize== | ==--chunksize== | ||
Line 30: | Line 48: | ||
--chunksize ChunkSize[b|B|s|S|k|K|m|M|g|G] | --chunksize ChunkSize[b|B|s|S|k|K|m|M|g|G] | ||
</pre> | </pre> | ||
Gives the size of chunk for snapshot, cache pool and thin pool logical volumes. Default unit is in kilobytes. For snapshots the value must be power of 2 between 4KiB and 512KiB and the default value is 4KiB. For cache pools the value must a multiple of 32KiB between 32KiB and 1GiB. The default is 64KiB. When the size is specified with volume caching, it may not be smaller than cache pool creation chunk size was. For thin pools the value must be a multiple of 64KiB between 64KiB and 1GiB. Default value starts with 64KiB and grows up to fit the pool metadata size within 128MiB, if the pool metadata size is not specified. See lvm.conf(5) setting allocation/thin_pool_chunk_size_policy to select different calculation policy. | Gives the size of chunk for snapshot, cache pool and thin pool logical volumes. Default unit is in kilobytes. For snapshots the value must be power of 2 between 4KiB and 512KiB and the default value is 4KiB. For cache pools the value must a multiple of 32KiB between 32KiB and 1GiB. The default is 64KiB. When the size is specified with volume caching, it may not be smaller than cache pool creation chunk size was. For thin pools the value must be a multiple of 64KiB between 64KiB and 1GiB. Default value starts with 64KiB and grows up to fit the pool metadata size within 128MiB, if the pool metadata size is not specified. See lvm.conf(5) setting allocation/thin_pool_chunk_size_policy to select different calculation policy. | ||
Line 45: | Line 62: | ||
<pre> | <pre> | ||
lvcreate -y --type thin-pool --zero n -- | lvcreate -y --type thin-pool --zero n -c 512K --poolmetadatasize 1041s -L 500M -n docker-pool docker_vg | ||
</pre> | |||
This results in the following links in /dev/mapper: | |||
<pre> | |||
lrwxrwxrwx. 1 root root 7 May 23 10:51 docker_vg-docker--pool -> ../dm-3 | |||
lrwxrwxrwx. 1 root root 7 May 23 10:51 docker_vg-docker--pool_tdata -> ../dm-2 | |||
lrwxrwxrwx. 1 root root 7 May 23 10:51 docker_vg-docker--pool_tmeta -> ../dm-1 | |||
</pre> | </pre> | ||
=Create a Linear Volume= | |||
{{Internal|Provisioning_and_Installing_a_New_Filesystem_on_a_New_Logical_Volume#linear_volume|Creating a Linear Volume}} |
Latest revision as of 23:19, 23 May 2017
Internal
Options
lvcreate --size 20G --name santorini VolGroup00
-n|--name
Sets the name for the new logical volume. If not specified, a default name will be generated.
--type
The segment type for the logical volume:
- linear
- striped
- thin-pool
- thin
- snapshot
For more details, see:
L|--size
-L|--size LogicalVolumeSize[b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E]
Gives the size to allocate for the new logical volume. A size suffix of B for bytes, S for sectors as 512 bytes, K for kilobytes, M for megabytes, G for gigabytes, T for terabytes, P for petabytes or E for exabytes is optional. Default unit is megabytes.
-l|--extents
-l|--extent LogicalExtentsNumber[%{VG|PVS|FREE|ORIGIN}]
Specifies the size of the new LV in logical extents. The number of physical extents allocated may be different, and depends on the LV type. Certain LV types require more physical extents for data redundancy or metadata. An alternate syntax allows the size to be determined indirectly as a percentage of the size of a related VG, LV, or set of PVs. The suffix %VG denotes the total size of the VG, the suffix %FREE the remaining free space in the VG, and the suffix %PVS the free space in the specified Physical Volumes. For a snapshot, the size can be expressed as a percentage of the total size of the Origin Logical Volume with the suffix %ORIGIN (100%ORIGIN provides space for the whole origin). When expressed as a percentage, the size defines an upper limit for the number of logical extents in the new LV. The precise number of logical extents in the new LV is not determined until the command has completed.
--chunksize
--chunksize ChunkSize[b|B|s|S|k|K|m|M|g|G]
Gives the size of chunk for snapshot, cache pool and thin pool logical volumes. Default unit is in kilobytes. For snapshots the value must be power of 2 between 4KiB and 512KiB and the default value is 4KiB. For cache pools the value must a multiple of 32KiB between 32KiB and 1GiB. The default is 64KiB. When the size is specified with volume caching, it may not be smaller than cache pool creation chunk size was. For thin pools the value must be a multiple of 64KiB between 64KiB and 1GiB. Default value starts with 64KiB and grows up to fit the pool metadata size within 128MiB, if the pool metadata size is not specified. See lvm.conf(5) setting allocation/thin_pool_chunk_size_policy to select different calculation policy.
--poolmetadatasize
--poolmetadatasize MetadataVolumeSize[b|B|s|S|k|K|m|M|g|G]
Sets the size of pool's metadata logical volume. Supported values are in range between 2MiB and 16GiB for thin pool, and upto 16GiB for cache pool. The minimum value is computed from pool's data size. Default value for thin pool is (Pool_LV_size / Pool_LV_chunk_size * 64b). To work with a thin pool, there should be at least 25% of free space when the size of metadata is smaller then 16MiB, or at least 4MiB of free space otherwise. Default unit is megabytes.
Create a Thin Pool Logical Volume
lvcreate -y --type thin-pool --zero n -c 512K --poolmetadatasize 1041s -L 500M -n docker-pool docker_vg
This results in the following links in /dev/mapper:
lrwxrwxrwx. 1 root root 7 May 23 10:51 docker_vg-docker--pool -> ../dm-3 lrwxrwxrwx. 1 root root 7 May 23 10:51 docker_vg-docker--pool_tdata -> ../dm-2 lrwxrwxrwx. 1 root root 7 May 23 10:51 docker_vg-docker--pool_tmeta -> ../dm-1