1LVCREATE(8)                 System Manager's Manual                LVCREATE(8)
2
3
4

NAME

6       lvcreate - create a logical volume in an existing volume group
7

SYNOPSIS

9       lvcreate  [--addtag  Tag]  [--alloc  AllocationPolicy] [-A|--autobackup
10       y|n] [-C|--contiguous y|n] [-d|--debug]  [-h|-?|--help]  [--noudevsync]
11       [--ignoremonitoring]    [--monitor    {y|n}]    [-i|--stripes   Stripes
12       [-I|--stripesize    StripeSize]]    {-l|--extents    LogicalExtentsNum‐
13       ber[%{VG|PVS|FREE}] |
14        -L|--size  LogicalVolumeSize[bBsSkKmMgGtTpPeE]}  [-M|--persistent y|n]
15       [--minor   minor]   [-m|--mirrors   Mirrors   [--nosync]   [--mirrorlog
16       {disk|core|mirrored}]   [--corelog]  [-R|--regionsize  MirrorLogRegion‐
17       Size]]    [-n|--name    LogicalVolumeName]    [-p|--permission    r|rw]
18       [-r|--readahead  ReadAheadSectors|auto|none]  [-t|--test]  [--type Seg‐
19       mentType] [-v|--verbose] [-Z|--zero y|n] VolumeGroupName  [PhysicalVol‐
20       umePath[:PE[-PE]]...]
21
22       lvcreate {-l|--extents LogicalExtentsNumber[%{VG|FREE|ORIGIN}] |
23        -L|--size  LogicalVolumeSize[bBsSkKmMgGtTpPeE]} [-c|--chunksize Chunk‐
24       Size] [--noudevsync] [--ignoremonitoring] [--monitor  {y|n}]  -n|--name
25       SnapshotLogicalVolumeName  {{-s|--snapshot} OriginalLogicalVolumePath |
26       [-s|--snapshot] VolumeGroupName --virtualsize VirtualSize}
27

DESCRIPTION

29       lvcreate creates a new logical volume in a volume group  (  see  vgcre‐
30       ate(8), vgchange(8) ) by allocating logical extents from the free phys‐
31       ical extent pool of that volume group.  If there are  not  enough  free
32       physical  extents  then  the  volume  group can be extended ( see vgex‐
33       tend(8) ) with other physical volumes or by reducing  existing  logical
34       volumes  of this volume group in size ( see lvreduce(8) ). If you spec‐
35       ify one or more PhysicalVolumes, allocation of physical extents will be
36       restricted to these volumes.
37       The second form supports the creation of snapshot logical volumes which
38       keep the contents of the original logical volume for backup purposes.
39

OPTIONS

41       See lvm for common options.
42
43       -c, --chunksize ChunkSize
44              Power of 2 chunk size for the snapshot logical volume between 4k
45              and 512k.
46
47       -C, --contiguous y|n
48              Sets or resets the contiguous allocation policy for logical vol‐
49              umes. Default is no contiguous allocation based on a  next  free
50              principle.
51
52       -i, --stripes Stripes
53              Gives  the  number  of  stripes.  This is equal to the number of
54              physical volumes to scatter the logical volume.
55
56       -I, --stripesize StripeSize
57              Gives the  number  of  kilobytes  for  the  granularity  of  the
58              stripes.
59              StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
60              For metadata in LVM2 format, the stripe size  may  be  a  larger
61              power of 2 but must not exceed the physical extent size.
62
63       -l, --extents LogicalExtentsNumber[%{VG|PVS|FREE|ORIGIN}]
64              Gives the number of logical extents to allocate for the new log‐
65              ical volume.  The number can also be expressed as  a  percentage
66              of the total space in the Volume Group with the suffix %VG, as a
67              percentage of the remaining free space in the Volume Group  with
68              the  suffix  %FREE,  as a percentage of the remaining free space
69              for the specified PhysicalVolume(s) with  the  suffix  %PVS,  or
70              (for  a snapshot) as a percentage of the total space in the Ori‐
71              gin Logical Volume with the suffix %ORIGIN.
72
73       -L, --size LogicalVolumeSize[bBsSkKmMgGtTpPeE]
74              Gives the size to allocate for the new logical volume.   A  size
75              suffix  of  K for kilobytes, M for megabytes, G for gigabytes, T
76              for terabytes, P for petabytes or E for exabytes is optional.
77              Default unit is megabytes.
78
79       --minor minor
80              Set the minor number.
81
82       -M, --persistent y|n
83              Set to y to make the minor number specified persistent.
84
85       -m, --mirrors Mirrors
86              Creates a mirrored logical  volume  with  Mirrors  copies.   For
87              example,  specifying  "-m  1" would result in a mirror with two-
88              sides; that is, a linear volume plus one copy.
89
90              Specifying the optional argument --nosync will  cause  the  cre‐
91              ation  of the mirror to skip the initial resynchronization.  Any
92              data written afterwards will be mirrored, but the original  con‐
93              tents  will not be copied.  This is useful for skipping a poten‐
94              tially long and resource intensive  initial  sync  of  an  empty
95              device.
96
97              The  optional  argument --mirrorlog specifies the type of log to
98              be used.  The default is disk, which is persistent and  requires
99              a  small  amount  of storage space, usually on a separate device
100              from the data being mirrored.  Using core means  the  mirror  is
101              regenerated by copying the data from the first device again each
102              time the device is activated, for example, after  every  reboot.
103              Using  "mirrored"  will  create  a persistent log that is itself
104              mirrored.
105
106              The optional argument --corelog  is  equivalent  to  --mirrorlog
107              core.
108
109
110       -n, --name LogicalVolumeName
111              The name for the new logical volume.
112              Without this option a default names of "lvol#" will be generated
113              where # is the LVM internal number of the logical volume.
114
115       --noudevsync
116              Disable udev synchronisation. The  process  will  not  wait  for
117              notification  from  udev.   It will continue irrespective of any
118              possible udev processing in the background.  You should only use
119              this if udev is not running or has rules that ignore the devices
120              LVM2 creates.
121
122       --monitor y|n
123              Start or avoid monitoring a mirrored or snapshot logical  volume
124              with  dmeventd, if it is installed.  If a device used by a moni‐
125              tored mirror reports  an  I/O  error,  the  failure  is  handled
126              according to mirror_image_fault_policy and mirror_log_fault_pol‐
127              icy set in lvm.conf.
128
129       --ignoremonitoring
130              Make no attempt to interact with dmeventd  unless  --monitor  is
131              specified.
132
133       -p, --permission r|rw
134              Set access permissions to read only or read and write.
135              Default is read and write.
136
137       -r, --readahead ReadAheadSectors|auto|none
138              Set  read ahead sector count of this logical volume.  For volume
139              groups with metadata in  lvm1  format,  this  must  be  a  value
140              between 2 and 120.  The default value is "auto" which allows the
141              kernel to choose a  suitable  value  automatically.   "None"  is
142              equivalent to specifying zero.
143
144       -R, --regionsize MirrorLogRegionSize
145              A  mirror  is divided into regions of this size (in MB), and the
146              mirror log uses this granularity to track which regions  are  in
147              sync.
148
149       -s, --snapshot
150              Create  a snapshot logical volume (or snapshot) for an existing,
151              so called original logical volume (or origin).   Snapshots  pro‐
152              vide  a  'frozen  image' of the contents of the origin while the
153              origin can still be updated. They enable consistent backups  and
154              online  recovery of removed/overwritten data/files. The snapshot
155              does not need the same amount of storage the origin  has.  In  a
156              typical  scenario,  15-20% might be enough. In case the snapshot
157              runs out of storage, use lvextend(8) to  grow  it.  Shrinking  a
158              snapshot  is  supported by lvreduce(8) as well. Run lvdisplay(8)
159              on the snapshot in order to check how much data is allocated  to
160              it.   Note  that a small amount of the space you allocate to the
161              snapshot is used to track the locations of the chunks  of  data,
162              so  you  should  allocate  slightly more space than you actually
163              need and monitor the rate at which the snapshot data is  growing
164              so you can avoid running out of space.
165
166       --type SegmentType
167              Create  a  logical  volume  that uses the specified segment type
168              (e.g. "mirror", "snapshot", "striped").  Especially useful  when
169              no  existing  commandline  switch  alias  enables the use of the
170              desired type (e.g. "error" or "zero" types).  Many segment types
171              already  have  a commandline switch alias that will enable their
172              use (-s is an alias for --type snapshot).
173
174       --virtualsize VirtualSize
175              Create a sparse device of the given  size  (in  MB  by  default)
176              using  a  snapshot.   Anything  written  to  the  device will be
177              returned when reading from it.  Reading from other areas of  the
178              device will return blocks of zeros.  It is implemented by creat‐
179              ing a hidden virtual device of the requested size using the zero
180              target.  A suffix of _vorigin is used for this device.
181
182       -Z, --zero y|n
183              Controls zeroing of the first KB of data in the new logical vol‐
184              ume.
185              Default is yes.
186              Volume will not be zeroed if read only flag is set.
187              Snapshot volumes are zeroed always.
188
189              Warning: trying to mount an unzeroed logical  volume  can  cause
190              the system to hang.
191

Examples

193       "lvcreate  -i  3  -I  8 -L 100M vg00" tries to create a striped logical
194       volume with 3 stripes, a stripesize of 8KB and a size of 100MB  in  the
195       volume  group  named  vg00.  The  logical volume name will be chosen by
196       lvcreate.
197
198       "lvcreate -m1 -L 500M vg00" tries to create  a  mirror  logical  volume
199       with  2  sides  with  a  useable size of 500 MiB.  This operation would
200       require 3 devices - two for the mirror devices and  one  for  the  disk
201       log.
202
203       "lvcreate  -m1  --mirrorlog core -L 500M vg00" tries to create a mirror
204       logical volume with 2 sides with a useable size of 500 MiB.  This oper‐
205       ation would require 2 devices - the log is "in-memory".
206
207       "lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1"
208       creates a snapshot logical volume named /dev/vg00/snap which has access
209       to the contents of the original logical volume named /dev/vg00/lvol1 at
210       snapshot  logical  volume creation time. If the original logical volume
211       contains a file system, you can mount the snapshot logical volume on an
212       arbitrary  directory  in order to access the contents of the filesystem
213       to run a backup while the original filesystem continues to get updated.
214
215       "lvcreate --virtualsize 1T --size 100M --snapshot --name sparse vg1"
216       creates a sparse device named /dev/vg1/sparse of size  1TB  with  space
217       for just under 100MB of actual data on it.
218
219       "lvcreate -L 64M -n lvol1 vg00 /dev/sda:0-7 /dev/sdb:0-7"
220       creates  a  linear  logical  volume "vg00/lvol1" using physical extents
221       /dev/sda:0-7 and /dev/sdb:0-7 for allocation of extents.
222
223
224

SEE ALSO

226       lvm(8), vgcreate(8), lvremove(8), lvrename(8) lvextend(8), lvreduce(8),
227       lvdisplay(8), lvscan(8)
228
229
230
231Sistina Software UK    LVM TOOLS 2.02.84(2) (2011-02-09)           LVCREATE(8)
Impressum