Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / lvm2 / dist / man / lvcreate.8
1 .\"    $NetBSD: lvcreate.8,v 1.2 2009/02/18 12:16:13 haad Exp $
2 .\"
3 .TH LVCREATE 8 "LVM TOOLS 2.02.44-cvs (02-17-09)" "Sistina Software UK" \" -*- nroff -*-
4 .SH NAME
5 lvcreate \- create a logical volume in an existing volume group
6 .SH SYNOPSIS
7 .B lvcreate
8 [\-\-addtag Tag]
9 [\-\-alloc AllocationPolicy]
10 [\-A|\-\-autobackup y|n] [\-C|\-\-contiguous y|n] [\-d|\-\-debug]
11 [\-h|\-?|\-\-help]
12 [\-i|\-\-stripes Stripes [\-I|\-\-stripesize StripeSize]]
13 {\-l|\-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}] |
14  \-L|\-\-size LogicalVolumeSize[kKmMgGtT]}
15 [\-M|\-\-persistent y|n] [\-\-minor minor]
16 [\-m|\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|core}] [\-\-corelog]
17 [\-R|\-\-regionsize MirrorLogRegionSize]]
18 [\-n|\-\-name LogicalVolumeName]
19 [\-p|\-\-permission r|rw] [\-r|\-\-readahead ReadAheadSectors|auto|none]
20 [\-t|\-\-test]
21 [\-v|\-\-verbose] [\-Z|\-\-zero y|n]
22 VolumeGroupName [PhysicalVolumePath...]
23 .br
24
25 .br
26 .B lvcreate
27 {\-l|\-\-extents LogicalExtentsNumber[%{VG|FREE}] |
28  \-L|\-\-size LogicalVolumeSize[kKmMgGtT]}
29 [\-c|\-\-chunksize ChunkSize]
30 \-s|\-\-snapshot \-n|\-\-name SnapshotLogicalVolumeName OriginalLogicalVolumePath
31 .SH DESCRIPTION
32 lvcreate creates a new logical volume in a volume group ( see
33 .B vgcreate(8), vgchange(8)
34 ) by allocating logical extents from the free physical extent pool
35 of that volume group.  If there are not enough free physical extents then
36 the volume group can be extended ( see
37 .B vgextend(8)
38 ) with other physical volumes or by reducing existing logical volumes
39 of this volume group in size ( see
40 .B lvreduce(8)
41 ).
42 .br
43 The second form supports the creation of snapshot logical volumes which 
44 keep the contents of the original logical volume for backup purposes.
45 .SH OPTIONS
46 See \fBlvm\fP for common options.
47 .TP
48 .I \-c, \-\-chunksize ChunkSize
49 Power of 2 chunk size for the snapshot logical volume between 4k and 512k.
50 .TP
51 .I \-C, \-\-contiguous y|n
52 Sets or resets the contiguous allocation policy for
53 logical volumes. Default is no contiguous allocation based
54 on a next free principle.
55 .TP
56 .I \-i, \-\-stripes Stripes
57 Gives the number of stripes.
58 This is equal to the number of physical volumes to scatter
59 the logical volume.
60 .TP
61 .I \-I, \-\-stripesize StripeSize
62 Gives the number of kilobytes for the granularity of the stripes.
63 .br
64 StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format.
65 For metadata in LVM2 format, the stripe size may be a larger
66 power of 2 but must not exceed the physical extent size.
67 .TP
68 .I \-l, \-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}]
69 Gives the number of logical extents to allocate for the new
70 logical volume.
71 This can also be expressed as a percentage of the total space
72 in the Volume Group with the suffix %VG, of the remaining
73 free space in the Volume Group with the suffix %FREE, or
74 of the remaining free space for the specified PhysicalVolume(s)
75 with the suffix %PVS,
76 .TP
77 .I \-L, \-\-size LogicalVolumeSize[kKmMgGtTpPeE]
78 Gives the size to allocate for the new logical volume.
79 A size suffix of K for kilobytes, M for megabytes,
80 G for gigabytes, T for terabytes, P for petabytes
81 or E for exabytes is optional.
82 .br
83 Default unit is megabytes.
84 .TP
85 .I \-\-minor minor
86 Set the minor number.
87 .TP
88 .I \-M, \-\-persistent y|n
89 Set to y to make the minor number specified persistent.
90 .TP
91 .I \-m, \-\-mirrors Mirrors
92 Creates a mirrored logical volume with Mirrors copies.  For example,
93 specifying "-m 1" would result in a mirror with two-sides; that is, a
94 linear volume plus one copy.
95
96 Specifying the optional argument --nosync will cause the creation
97 of the mirror to skip the initial resynchronization.  Any data written
98 afterwards will be mirrored, but the original contents will not be
99 copied.  This is useful for skipping a potentially long and resource
100 intensive initial sync of an empty device.
101
102 The optional argument --mirrorlog specifies the type of log to be used.
103 The default is disk, which is persistent and requires
104 a small amount of storage space, usually on a separate device from the
105 data being mirrored. Using core means the mirror is regenerated
106 by copying the data from the first device again each time the
107 device is activated, for example, after every reboot.
108
109 The optional argument --corelog is equivalent to --mirrorlog core.
110
111 .TP
112 .I \-n, \-\-name LogicalVolumeName
113 The name for the new logical volume.
114 .br
115 Without this option a default names of "lvol#" will be generated where
116 # is the LVM internal number of the logical volume.
117 .TP
118 .I \-p, \-\-permission r|rw
119 Set access permissions to read only or read and write.
120 .br
121 Default is read and write.
122 .TP
123 .I \-r, \-\-readahead ReadAheadSectors|auto|none
124 Set read ahead sector count of this logical volume.
125 For volume groups with metadata in lvm1 format, this must
126 be a value between 2 and 120.
127 The default value is "auto" which allows the kernel to choose
128 a suitable value automatically.
129 "None" is equivalent to specifying zero.
130 .TP
131 .I \-R, \-\-regionsize MirrorLogRegionSize
132 A mirror is divided into regions of this size (in MB), and the mirror log 
133 uses this granularity to track which regions are in sync.
134 .TP
135 .I \-s, \-\-snapshot
136 Create a snapshot logical volume (or snapshot) for an existing, so called
137 original logical volume (or origin).
138 Snapshots provide a 'frozen image' of the contents of the origin
139 while the origin can still be updated. They enable consistent
140 backups and online recovery of removed/overwritten data/files. The snapshot
141 does not need the same amount of storage the origin has. In a typical scenario,
142 15-20% might be enough. In case the snapshot runs out of storage, use
143 .B lvextend(8)
144 to grow it. Shrinking a snapshot is supported by
145 .B lvreduce(8)
146 as well. Run
147 .B lvdisplay(8)
148 on the snapshot in order to check how much data is allocated to it.
149 .TP
150 .I \-Z, \-\-zero y|n
151 Controls zeroing of the first KB of data in the new logical volume.
152 .br
153 Default is yes.
154 .br
155 Volume will not be zeroed if read only flag is set.
156 .br
157 Snapshot volumes are zeroed always.
158
159 .br
160 Warning: trying to mount an unzeroed logical volume can cause the system to
161 hang.
162 .SH Examples
163 "lvcreate -i 3 -I 8 -L 100M vg00" tries to create a striped logical
164 volume with 3 stripes, a stripesize of 8KB and a size of 100MB in the volume
165 group named vg00. The logical volume name will be chosen by lvcreate.
166
167 "lvcreate -m1 -L 500M vg00" tries to create a mirror logical volume
168 with 2 sides with a useable size of 500 MiB.  This operation would
169 require 3 devices - two for the mirror devices and one for the disk
170 log.
171
172 "lvcreate -m1 --mirrorlog core -L 500M vg00" tries to create a mirror logical volume
173 with 2 sides with a useable size of 500 MiB.  This operation would
174 require 2 devices - the log is "in-memory".
175
176 "lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1"
177 .br
178 creates a snapshot logical volume named /dev/vg00/snap which has access to the
179 contents of the original logical volume named /dev/vg00/lvol1
180 at snapshot logical volume creation time. If the original logical volume
181 contains a file system, you can mount the snapshot logical volume on an
182 arbitrary directory in order to access the contents of the filesystem to run
183 a backup while the original filesystem continues to get updated.
184
185 .SH SEE ALSO
186 .BR lvm (8), 
187 .BR vgcreate (8), 
188 .BR lvremove (8), 
189 .BR lvrename (8)
190 .BR lvextend (8), 
191 .BR lvreduce (8), 
192 .BR lvdisplay (8), 
193 .BR lvscan (8)