mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
3bc417488d
Use chunksize option to specify data_block_size for thin pool target. Drop low_water_mark to zero.
341 lines
12 KiB
Groff
341 lines
12 KiB
Groff
.TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
|
|
.SH NAME
|
|
lvcreate \- create a logical volume in an existing volume group
|
|
.SH SYNOPSIS
|
|
.B lvcreate
|
|
.RB [ \-\-addtag
|
|
.IR Tag ]
|
|
.RB [ \-\-alloc
|
|
.IR AllocationPolicy ]
|
|
.RB [ \-a | \-\-available
|
|
.RI { y | n | ey | en | ly | ln }]
|
|
.RB [ \-A | \-\-autobackup
|
|
.RI { y | n }]
|
|
.RB [ \-C | \-\-contiguous
|
|
.RI { y | n }]
|
|
.RB [ \-d | \-\-debug ]
|
|
.RB [ \-h | \-? | \-\-help ]
|
|
.RB [ \-\-noudevsync ]
|
|
.RB [ \-\-ignoremonitoring ]
|
|
.RB [ \-\-monitor
|
|
.RI { y | n }]
|
|
.RB [ \-i | \-\-stripes
|
|
.IR Stripes
|
|
.RB [ \-I | \-\-stripesize
|
|
.IR StripeSize ]]
|
|
.RB { \-l | \-\-extents
|
|
.IR LogicalExtentsNumber [ % { VG | PVS | FREE }]
|
|
|
|
|
.BR \-L | \-\-size
|
|
.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
|
|
.RB [ \-M | \-\-persistent
|
|
.RI { y | n }]
|
|
.RB [ \-\-minor
|
|
.IR minor ]
|
|
.RB [ \-m | \-\-mirrors
|
|
.IR Mirrors
|
|
.RB [ \-\-nosync ]
|
|
.RB [ \-\-mirrorlog
|
|
.RI { disk | core | mirrored }
|
|
|
|
|
.BR \-\-corelog ]
|
|
.RB [ \-R | \-\-regionsize
|
|
.IR MirrorLogRegionSize ]]
|
|
.RB [ \-n | \-\-name
|
|
.IR LogicalVolumeName ]
|
|
.RB [ \-p | \-\-permission
|
|
.RI { r | rw }]
|
|
.RB [ \-r | \-\-readahead
|
|
.RI { ReadAheadSectors | auto | none }]
|
|
.RB [ \-t | \-\-test ]
|
|
.RB [ \-\-type
|
|
.IR SegmentType ]
|
|
.RB [ \-v | \-\-verbose ]
|
|
.RB [ \-Z | \-\-zero
|
|
.RI { y | n }]
|
|
.IR VolumeGroupName
|
|
.RI [ PhysicalVolumePath [ :PE [ -PE ]]...]
|
|
.br
|
|
|
|
.br
|
|
.B lvcreate
|
|
.RB { \-l | \-\-extents
|
|
.IR LogicalExtentsNumber [ % { VG | FREE | ORIGIN }]
|
|
|
|
|
.BR \-L | \-\-size
|
|
.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
|
|
.RB [ \-c | \-\-chunksize
|
|
.IR ChunkSize ]
|
|
.RB [ \-\-noudevsync ]
|
|
.RB [ \-\-ignoremonitoring ]
|
|
.RB [ \-\-monitor " {" \fIy | \fIn }]
|
|
.RB [ \-n | \-\-name
|
|
.IR SnapshotLogicalVolumeName ]
|
|
.BR \-s | \-\-snapshot
|
|
.RI [ OriginalLogicalVolumePath
|
|
|
|
|
.IR VolumeGroupName
|
|
.BR \-V | \-\-virtualsize
|
|
.IR VirtualSize ]
|
|
.br
|
|
|
|
.B lvcreate
|
|
.RB [ \-l | \-\-extents
|
|
.IR LogicalExtentsNumber [ % { VG | FREE | ORIGIN }]
|
|
|
|
|
.BR \-L | \-\-size
|
|
.IR LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]]
|
|
.RB [ \-V | \-\-virtualsize
|
|
.IR VirtualSize ]
|
|
.RB [ \-n | \-\-name
|
|
.IR ThinLogicalVolumeName ]
|
|
.RB [ \-\-thinpool
|
|
.IR ThinPoolLogicalVolumeName ]
|
|
.B \-T
|
|
.IR VolumeGroupName [/ ThinPoolLogicalVolumeName ]
|
|
.br
|
|
|
|
.SH DESCRIPTION
|
|
lvcreate creates a new logical volume in a volume group ( see
|
|
.BR 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
|
|
.BR vgextend (8)
|
|
) with other physical volumes or by reducing existing logical volumes
|
|
of this volume group in size ( see
|
|
.BR lvreduce (8)
|
|
). If you specify one or more PhysicalVolumes, allocation of physical
|
|
extents will be restricted to these volumes.
|
|
.br
|
|
.br
|
|
The second form supports the creation of snapshot logical volumes which
|
|
keep the contents of the original logical volume for backup purposes.
|
|
.SH OPTIONS
|
|
See
|
|
.BR lvm (8)
|
|
for common options.
|
|
.TP
|
|
.IR \fB\-a ", " \fB\-\-available " {" y | n | ey | en | ly | ln }
|
|
Controls the availability of the Logical Volumes for immediate use after
|
|
the command finishes running.
|
|
By default, new Logical Volumes are activated automatically (\fB-a\fIy\fR).
|
|
If it is possible technically, \fB-a\fIn\fR will leave the new Logical Volume inactive.
|
|
But for example, snapshots can only be created
|
|
in the active state so \fB-a\fIn\fR cannot be used with --snapshot.
|
|
Normally the --zero n argument has to be supplied too because zeroing (the
|
|
default behaviour) also requires activation.
|
|
If clustered locking is enabled, \fB-a\fIey\fR will activate exclusively
|
|
on one node and \fB-a\fIly\fR will activate only on the local node.
|
|
.TP
|
|
.BR \-c ", " \-\-chunksize " " \fIChunkSize
|
|
Power of 2 chunk size in sector units (512b).
|
|
For snapshot logical volume the value must be between 8 (4KB) and 1024 (512KB)
|
|
and the default value is 8.
|
|
For thin pool logical volume the value must be between 128 (64KB) and
|
|
2097152 (1MB) and the default value is 128.
|
|
.TP
|
|
.BR \-C ", " \-\-contiguous " {" \fIy | \fIn }
|
|
Sets or resets the contiguous allocation policy for
|
|
logical volumes. Default is no contiguous allocation based
|
|
on a next free principle.
|
|
.TP
|
|
.BR \-i ", " \-\-stripes " " \fIStripes
|
|
Gives the number of stripes.
|
|
This is equal to the number of physical volumes to scatter
|
|
the logical volume.
|
|
.TP
|
|
.BR \-I ", " \-\-stripesize " " \fIStripeSize
|
|
Gives the number of kilobytes for the granularity of the stripes.
|
|
.br
|
|
StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
|
|
For metadata in LVM2 format, the stripe size may be a larger
|
|
power of 2 but must not exceed the physical extent size.
|
|
.TP
|
|
.IR \fB\-l ", " \fB\-\-extents " " LogicalExtentsNumber [ % { VG | PVS | FREE | ORIGIN }]
|
|
Gives the number of logical extents to allocate for the new
|
|
logical volume.
|
|
The number can also be expressed as a percentage of the total space
|
|
in the Volume Group with the suffix \fI%VG\fR, as a percentage of the
|
|
remaining free space in the Volume Group with the suffix \fI%FREE\fR, as a
|
|
percentage of the remaining free space for the specified
|
|
PhysicalVolume(s) with the suffix \fI%PVS\fR, or (for a snapshot) as a
|
|
percentage of the total space in the Origin Logical Volume with the
|
|
suffix \fI%ORIGIN\fR.
|
|
.TP
|
|
.IR \fB\-L ", " \fB\-\-size " " LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]
|
|
Gives the size to allocate for the new logical volume.
|
|
A size suffix of \fIK\fR for kilobytes, \fIM\fR for megabytes,
|
|
\fIG\fR for gigabytes, \fIT\fR for terabytes, \fIP\fR for petabytes
|
|
or \fIE\fR for exabytes is optional.
|
|
.br
|
|
Default unit is megabytes.
|
|
.TP
|
|
.B \-\-minor \fIminor
|
|
Set the minor number.
|
|
.TP
|
|
.IR \fB\-M ", " \fB\-\-persistent " {" y | n }
|
|
Set to y to make the minor number specified persistent.
|
|
.TP
|
|
.BR \-m ", " \-\-mirrors " " \fIMirrors
|
|
Creates a mirrored logical volume with Mirrors copies. For example,
|
|
specifying "-m 1" would result in a mirror with two-sides; that is, a
|
|
linear volume plus one copy.
|
|
|
|
Specifying the optional argument --nosync will cause the creation
|
|
of the mirror to skip the initial resynchronization. Any data written
|
|
afterwards will be mirrored, but the original contents will not be
|
|
copied. This is useful for skipping a potentially long and resource
|
|
intensive initial sync of an empty device.
|
|
|
|
The optional argument --mirrorlog specifies the type of log to be used.
|
|
The default is disk, which is persistent and requires
|
|
a small amount of storage space, usually on a separate device from the
|
|
data being mirrored. Using core means the mirror is regenerated
|
|
by copying the data from the first device again each time the
|
|
device is activated, for example, after every reboot. Using "mirrored"
|
|
will create a persistent log that is itself mirrored.
|
|
|
|
The optional argument --corelog is equivalent to --mirrorlog core.
|
|
|
|
.TP
|
|
.BR \-n ", " \-\-name " " \fILogicalVolumeName
|
|
The name for the new logical volume.
|
|
.br
|
|
Without this option a default names of "lvol#" will be generated where
|
|
# is the LVM internal number of the logical volume.
|
|
.TP
|
|
.B \-\-noudevsync
|
|
Disable udev synchronisation. The
|
|
process will not wait for notification from udev.
|
|
It will continue irrespective of any possible udev processing
|
|
in the background. You should only use this if udev is not running
|
|
or has rules that ignore the devices LVM2 creates.
|
|
.TP
|
|
.BR \-\-monitor " {" \fIy | \fIn }
|
|
Start or avoid monitoring a mirrored or snapshot logical volume with
|
|
dmeventd, if it is installed.
|
|
If a device used by a monitored mirror reports an I/O error,
|
|
the failure is handled according to
|
|
\fBmirror_image_fault_policy\fP and \fBmirror_log_fault_policy\fP
|
|
set in \fBlvm.conf\fP.
|
|
.TP
|
|
.B \-\-ignoremonitoring
|
|
Make no attempt to interact with dmeventd unless \-\-monitor
|
|
is specified.
|
|
.TP
|
|
.BR \-p ", " \-\-permission " {" \fIr | \fIrw }
|
|
Set access permissions to read only or read and write.
|
|
.br
|
|
Default is read and write.
|
|
.TP
|
|
.IR \fB\-r ", " \fB\-\-readahead " {" ReadAheadSectors | auto | none }
|
|
Set read ahead sector count of this logical volume.
|
|
For volume groups with metadata in lvm1 format, this must
|
|
be a value between 2 and 120.
|
|
The default value is "auto" which allows the kernel to choose
|
|
a suitable value automatically.
|
|
"None" is equivalent to specifying zero.
|
|
.TP
|
|
.BR \-R ", " \-\-regionsize " " \fIMirrorLogRegionSize
|
|
A mirror is divided into regions of this size (in MB), and the mirror log
|
|
uses this granularity to track which regions are in sync.
|
|
.TP
|
|
.BR \-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
|
|
.BR lvextend (8)
|
|
to grow it. Shrinking a snapshot is supported by
|
|
.BR lvreduce (8)
|
|
as well. Run
|
|
.BR lvdisplay (8)
|
|
on the snapshot in order to check how much data is allocated to it.
|
|
Note that a small amount of the space you allocate to the snapshot is
|
|
used to track the locations of the chunks of data, so you should
|
|
allocate slightly more space than you actually need and monitor the
|
|
rate at which the snapshot data is growing so you can avoid running out
|
|
of space.
|
|
.TP
|
|
.B \-\-type \fISegmentType
|
|
Create a logical volume that uses the specified segment type
|
|
(e.g. "raid5", "mirror", "snapshot"). Many segment types have a
|
|
commandline switch alias that will enable their use (-s is an alias for
|
|
--type snapshot). However, this argument must be used when no existing
|
|
commandline switch alias is available for the desired type, as is the case
|
|
with "error", "zero", "raid4", "raid5", or "raid6".
|
|
.TP
|
|
.BR \-V ", " \-\-virtualsize " " \fIVirtualSize
|
|
Create a sparse device of the given size (in MB by default) using a snapshot.
|
|
Anything written to the device will be returned when reading from it.
|
|
Reading from other areas of the device will return blocks of zeros.
|
|
It is implemented by creating a hidden virtual device of the
|
|
requested size using the zero target. A suffix of _vorigin is used for
|
|
this device.
|
|
.TP
|
|
.BR \-Z ", " \-\-zero " {" \fIy | \fIn }
|
|
Controls zeroing of the first KB of data in the new logical volume.
|
|
.br
|
|
Default is yes.
|
|
.br
|
|
Volume will not be zeroed if read only flag is set.
|
|
.br
|
|
Snapshot volumes are zeroed always.
|
|
|
|
.br
|
|
Warning: trying to mount an unzeroed logical volume can cause the system to
|
|
hang.
|
|
.SH Examples
|
|
"lvcreate -i 3 -I 8 -L 100M 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 -m1 -L 500M vg00" tries to create a mirror logical volume
|
|
with 2 sides with a useable size of 500 MiB. This operation would
|
|
require 3 devices - two for the mirror devices and one for the disk
|
|
log.
|
|
|
|
"lvcreate -m1 --mirrorlog core -L 500M vg00" tries to create a mirror logical volume
|
|
with 2 sides with a useable size of 500 MiB. This operation would
|
|
require 2 devices - the log is "in-memory".
|
|
|
|
"lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1"
|
|
.br
|
|
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 continues to get updated.
|
|
|
|
"lvcreate --virtualsize 1T --size 100M --snapshot --name sparse vg1"
|
|
.br
|
|
creates a sparse device named /dev/vg1/sparse of size 1TB with space for just
|
|
under 100MB of actual data on it.
|
|
.br
|
|
|
|
"lvcreate -L 64M -n lvol1 vg00 /dev/sda:0-7 /dev/sdb:0-7"
|
|
.br
|
|
creates a linear logical volume "vg00/lvol1" using physical extents
|
|
/dev/sda:0-7 and /dev/sdb:0-7 for allocation of extents.
|
|
.br
|
|
|
|
"lvcreate --type raid5 -L 5G -i 3 -I 64 -n my_lv vg00"
|
|
.br
|
|
creates a 5GiB RAID5 logical volume "vg00/my_lv", with 3 stripes (plus
|
|
a parity drive for a total of 4 devices) and a stripesize of 64kiB.
|
|
|
|
.SH SEE ALSO
|
|
.BR lvm (8),
|
|
.BR vgcreate (8),
|
|
.BR lvremove (8),
|
|
.BR lvrename (8)
|
|
.BR lvextend (8),
|
|
.BR lvreduce (8),
|
|
.BR lvdisplay (8),
|
|
.BR lvscan (8)
|