| Linux / Unix Command: lvcreate |
NAME
lvcreate - create a logical volume in an existing volume groupSYNOPSIS
lvcreate [-A|--autobackup {y|n}] [-C|--contiguous {y|n}] [-d|--debug] [-h|--help] [-i|--stripes StripesI] [-I|--stripesize StripeSizeI]] {-l|--extents LogicalExtentsNumber| -L|--size LogicalVolumeSize[kKmMgGtT]} [-n|--name LogicalVolumeName] [-p|--permission{r|rw}] [-r|--readahead ReadAheadSectors] [-v|--verbose][-Z|--zero{y|n}] VolumeGroupName [PhysicalVolumePath...]
lvcreate
{-l/--extents LogicalExtentsNumber |
-L/--size LogicalVolumeSize[kKmMgGtT]}
[-c/--chunksize ChunkSize]
-s/--snapshot -n/--name SnapshotLogicalVolumeName OriginalLogicalVolumePath [PhysicalVolumePath...]
DESCRIPTION
lvcreate creates a new logical volume in a volume group ( see vgcreate(8), vgchange(8) ) by allocating logical extents from the free physical extent pool of that volume group. If there are not enough free physical extents then the volume group can be extended ( see vgextend(8) ) with other physical volumes or by reducing existing logical volumes of this volume group in size ( see lvreduce(8), e2fsadm(8) ).The second form supports the creation of snapshot logical volumes which keep the contents of the original logical volume for backup purposes.
OPTIONS
- -A, --autobackup {y|n}
-
Controls automatic backup of VG metadata after the change ( see
vgcfgbackup(8)
).
Default is yes. - -c, --chunksize ChunkSize
- Power of 2 chunk size for the snapshot logical volume between 4k and 1024k.
- -C, --contiguous y/n
- Sets or resets the contiguous allocation policy for logical volumes. Default is no contiguous allocation based on a next free principle.
- -d, --debug
- Enables additional debugging output (if compiled with DEBUG).
- -h, --help
- Print a usage message on standard output and exit successfully.
- -i, --stripes Stripes
- Gives the number of stripes. This is equal to the number of physical volumes to scatter the logical volume.
- -I, --stripesize StripeSize
-
Gives the number of kilobytes for the granularity of the stripes.
StripeSize must be 2^n (n = 2 to 9) - -l, --extents LogicalExtentsNumber
- Gives the number of logical extents to allocate for the new logical volume.
- -L, --size LogicalVolumeSize[kKmMgGtT]
-
Gives the size to allocate for the new logical volume.
A size suffix of K for kilobytes, M for megabytes,
G for gigabytes or T for terabytes is optional.
Default unit is megabytes. - -n, --name LogicalVolumeName
-
The name for the new logical volume.
Without this option a default names of "lvol#" will be generated where # is the LVM internal number of the logical volume. - -p, --permission r/w
-
Set access permissions to read only or read and write.
Default is read and write. - -r, --readahead ReadAheadSectors
- Set read ahead sector count of this logical volume to a value between 2 and 120.
- -s, --snapshot
- Create a snapshot logical volume (or snapshot) for an existing, so called original logical volume (or origin). Snapshots provide a 'frozen image' of the contents of the origin while the origin can still be updated. They enable consistent backups and online recovery of removed/overwritten data/files. The snapshot does not need the same amount of storage the origin has. In a typical scenario, 15-20% might be enough. In case the snapshot runs out of storage, use lvextend(8) to grow it. Shrinking a snapshot is supported by lvreduce(8) as well. Run lvdisplay(8) on the snapshot in order to check how much data is allocated to it.
- -v, --verbose
- Gives verbose information about lvcreate's activities.
- -Z, --zero y/n
-
Controls zeroing of the first KB of data in the new logical volume.
Default is yes.
Warning: trying to mount an unzeroed logical volume can cause the system to hang.
Examples
"lvcreate -i 3 -I 8 -L 100 vg00" tries to create a striped logical volume with 3 stripes, a stripesize of 8KB and a size of 100MB in the volume group named vg00. The logical volume name will be chosen by lvcreate.
"lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1"
creates a snapshot logical volume named /dev/vg00/snap which has access to the
contents of the original logical volume named /dev/vg00/lvol1
at snapshot logical volume creation time. If the original logical volume
contains a file system, you can mount the snapshot logical volume on an
arbitrary directory in order to access the contents of the filesystem to run
a backup while the original filesystem is updated.
Important: Use the man command (% man) to see how a command is used on your particular computer.

