/[pkg-lvm]/lvm10/trunk/1.0.8/ABSTRACT
ViewVC logotype

Contents of /lvm10/trunk/1.0.8/ABSTRACT

Parent Directory Parent Directory | Revision Log Revision Log


Revision 27 - (show annotations) (download)
Wed Feb 16 16:15:56 2005 UTC (8 years, 3 months ago) by waldi
File size: 11435 byte(s)
Initial trunk from 1.0.8.
1 $Date: 2002/01/22 14:49:34 $
2 Logical Volume Manager Abstract
3
4 Goals:
5 ------
6 Implement a very flexible virtual disk subsystem to handle disk storage.
7 Online allocation and relocation of storage.
8 Online extension and reduction of storage.
9
10
11 Function:
12 ---------
13 The Logical Volume Manager (LVM) adds an additional layer between
14 the physical peripherals and the i/o interface in the kernel to
15 get a logical view of disks.
16
17 This allows the concatenation of several disks (so-called physical volumes
18 or PVs) to form a storage pool (so-called Volume Group or VG) with
19 allocation units called physical extents (called PE).
20
21 Parts out of this VG then can be allocated in form of
22 so-called Logical Volumes or LVs in units called logical extents or LEs.
23 Each logical extent is mapped to a corresponding physical extent
24 of equal size. These physical extents are mapped to offsets and blocks
25 on the disk(s).
26
27 The LVs can then be used through device special files similar to
28 /dev/sd[a-z]* or /dev/hd[a-z]* named /dev/VolumeGroupName/LogicalVolumeName.
29
30 But going beyond this, you are able to extend or reduce VGs AND LVs at runtime.
31
32
33 Concept:
34 --------
35 The configuration information for the physical volume, volume group and
36 logical volume(s) is stored on each physical volume and in automatically
37 created backup files, which are stored in the /etc/lvmtab.d directory.
38
39 The config area on the disk(s) is called Volume Group Descriptor Area or VGDA.
40
41 A LVM driver holds mapping tables between the LEs of LVs and the PEs of PVs.
42 These tables are created/updated/deleted by superuser LVM commands.
43
44 The main mapping function of the driver is called with a logical block
45 in a LV from functions in /usr/src/linux/drivers/block/ll_rw_blk.c
46 (in functions ll_rw_block() and ll_rw_swap_file() ) and looks up the
47 corresponding physical block/disk pair in a table.
48 Then it returns this pair to the calling ll_rw_*() function causing a
49 physical i/o request to the disk block(s) to be queued.
50
51
52
53 Example:
54 --------
55 If the capacity of a LV gets too small and your VG containing this LV is full,
56 you could add another PV to that VG and simply extend the LV afterwards.
57 If you reduce or delete a LV you can use the freed capacity for different
58 LVs of the same VG.
59
60
61 The above scenario looks like this:
62
63 /------------------------------------------\
64 | /--------\ VG 1 /--------\ |
65 | | | | | |
66 | | PV 1 | ...... | PV n | |
67 | | /-----------------------\ | |
68 | | \-------LV 1------------/ | |
69 | \--------/ \--------/ |
70 \------------------------------------------/
71
72 PV 1 could be /dev/sdc1
73 PV n could be /dev/sde1
74 VG 1 could be vg00
75 LV 1 could be /dev/test_vg/test_lv
76
77
78
79
80 The configuration steps for getting the above scenario are:
81
82 1. after installing LVM do an "insmod lvm" or
83 setup kerneld/kmod to load it automatic (see INSTALL)
84
85 2. set up partitions (#1) on both disks with partition type 0x8e
86 (I used this type to avoid using Linux primary partitions etc.)
87
88 3. do a "pvcreate /dev/sd[ce]1"
89 For testing purposes you can use more than one
90 primary and/or extended partition on a disk.
91 Don't do that for normal LVM operation for performance reasons.
92 Unless you have to, don't stripe logical volumes over physical volumes
93 associated to partitions on the same disk.
94
95 4. do a "vgcreate test_vg /dev/sd[ce]1"
96 (vgcreate activates the volume group too)
97
98 5. do a "lvcreate -L100 -ntest_lv test_vg" to get a 100MB linear LV
99 or a "lvcreate -i2 -I4 -l100 -nanother_test_lv test_vg" to get a
100 100 LE large logical volume with 2 stripes and stripe size 4 KB.
101
102 6. use created LVs as you want to.
103 For example generate a filesystem in one with "mke2fs /dev/test_vg/test_lv"
104 and mount it.
105
106
107
108 Overview and concept of commands:
109 ---------------------------------
110 I grouped and named LVM commands analogous to HP's.
111 So the commands for physical volume handling all start with pv,
112 those for volume group handling start with vg and the ones for
113 logical volumes start with lv.
114
115
116 e2fsadm - administration wrapper for logical volume including filesystem
117 resizing for lvextend, lvreduce, e2fsck and resize2fs
118
119 lvchange - change attributes of a logical volume
120 lvcreate - create a logical volume
121 lvdisplay - display logical volume config data
122 lvextend - extend a logical volume in size
123 lvreduce - reduce a logical volume in size
124 lvremove - remove a logical volume
125 lvrename - rename an inactive logical volume
126 lvscan - find all existing logical volumes
127
128 lvmchange - emergency program to change attributes of the LVM
129 lvmdiskscan - scan all disks / partitions and multiple devices and list them
130 lvmsadc - statistic data collector
131 lvmsar - statistic data reporter
132
133 pvchange - change attributes of physical volumes
134 pvcreate - create a physical volume
135 pvdata - debug list physical volume group descriptor area
136 pvdisplay - display physical volume config information
137 pvmove - move logical extents to a different physical volume
138 pvscan - find all existing physical volumes
139
140 vgcfgbackup - backup all volume group descriptor areas
141 vgcfgrestore - restore volume group descriptor area(s) to disk(s)
142 vgchange - activate/deactivate volume group(s)
143 vgck - check volume group descriptor area for consistency
144 vgcreate - create a volume group from physical volume(s)
145 vgdisplay - display volume group config information
146 vgexport - export volume group (make it unknown to the system)
147 vgextend - extend a volume group by one or more physical volumes
148 vgimport - import a volume group (make it known to the/another system)
149 vgmerge - merge two volume groups into one
150 vgmknodes - create volume group directory with all logical volume specials
151 vgreduce - reduce a volume group by one or more empty physical volume(s)
152 vgremove - remove an empty volume group
153 vgrename - rename an inactive volume group
154 vgscan - scan for volume groups
155 vgsplit - split one volume group into two
156
157
158
159 Example LVM session output:
160 ---------------------------
161
162 # create physical volumes on 9 SCSI disk primary partition 1
163 pvcreate /dev/sd[b-eg-k]1
164 pvcreate -- /dev/sdb1 has an invalid physical volume identifier
165 pvcreate -- physical volume on /dev/sdb1 successfully created
166 pvcreate -- reinitializing physical volume
167 pvcreate -- physical volume on /dev/sdc1 successfully created
168 pvcreate -- reinitializing physical volume
169 pvcreate -- physical volume on /dev/sdd1 successfully created
170 pvcreate -- reinitializing physical volume
171 pvcreate -- physical volume on /dev/sde1 successfully created
172 pvcreate -- reinitializing physical volume
173 pvcreate -- physical volume on /dev/sdg1 successfully created
174 pvcreate -- reinitializing physical volume
175 pvcreate -- physical volume on /dev/sdh1 successfully created
176 pvcreate -- reinitializing physical volume
177 pvcreate -- physical volume on /dev/sdi1 successfully created
178 pvcreate -- reinitializing physical volume
179 pvcreate -- physical volume on /dev/sdj1 successfully created
180 pvcreate -- reinitializing physical volume
181 pvcreate -- physical volume on /dev/sdk1 successfully created
182
183
184
185 # create a volume group with default physical extent size
186 # from these physical volumes
187 vgcreate my_first_vg /dev/sd[b-eg-k]1
188 vgcreate -- INFO: using default physical extent size 4096 KB
189 vgcreate -- INFO: maximum logical volume size is 256 GB
190 vgcreate -- doing automatic backup of vg05
191 vgcreate -- volume group my_first_vg successfully created
192
193
194 # Oops ;-)
195 # Don't like the limitations caused by default physical extent size
196 # --> deactivate and delete volume
197 vgchange -an my_first_vg
198 vgchange -- my_first_vg successfully deactivated
199
200 vgremove my_first_vg
201 vgremove -- volume group my_first_vg successfully removed
202
203
204
205 # create a volume group with physical extent size of 8192 KB
206 # from these physical volumes
207 vgcreate -s 8192 my_first_vg /dev/sd[b-eg-k]1
208 vgcreate -- INFO: maximum logical volume size is 512 GB
209 vgcreate -- doing automatic backup of my_first_vg
210 vgcreate -- volume group my_first_vg successfully created
211
212
213
214 # display volume group config
215 vgdisplay my_first_vg
216 --- Volume group ---
217 VG Name my_first_vg
218 VG Write Access read/write
219 VG Status available
220 VG # 1
221 MAX LV 31
222 Cur LV 0
223 Open LV 0
224 MAX LV Size 512 GB
225 Max PV 256
226 Cur PV 9
227 Act PV 9
228 VG Size 12636 MB
229 PE Size 8192 KB
230 Total PE 1579
231 Alloc PE / Size 0 / 0 KB
232 Free PE / Size 1579 / 12632 MB
233
234
235 # do it again Sam but verbose
236 vgdisplay -v my_first_vg
237 --- Volume group ---
238 VG Name my_first_vg
239 VG Write Access read/write
240 VG Status available
241 VG # 1
242 MAX LV 31
243 Cur LV 0
244 Open LV 0
245 MAX LV Size 512 GB
246 Max PV 256
247 Cur PV 9
248 Act PV 9
249 VG Size 12636 MB
250 PE Size 8192 KB
251 Total PE 1579
252 Alloc PE / Size 0 / 0 KB
253 Free PE / Size 1579 / 12636 MB
254
255 --- No logical volumes defined in my_first_vg ---
256
257
258 --- Physical volumes ---
259 PV Name (#) /dev/sdb1 (1)
260 PV Status available / allocatable
261 Total PE / Free PE 131 / 131
262
263 PV Name (#) /dev/sdc1 (2)
264 PV Status available / allocatable
265 Total PE / Free PE 131 / 131
266
267 PV Name (#) /dev/sdd1 (3)
268 PV Status available / allocatable
269 Total PE / Free PE 131 / 131
270
271 PV Name (#) /dev/sde1 (4)
272 PV Status available / allocatable
273 Total PE / Free PE 131 / 131
274
275 PV Name (#) /dev/sdg1 (5)
276 PV Status available / allocatable
277 Total PE / Free PE 131 / 131
278
279 PV Name (#) /dev/sdh1 (6)
280 PV Status available / allocatable
281 Total PE / Free PE 131 / 131
282
283 PV Name (#) /dev/sdi1 (7)
284 PV Status available / allocatable
285 Total PE / Free PE 131 / 131
286
287 PV Name (#) /dev/sdj1 (8)
288 PV Status available / allocatable
289 Total PE / Free PE 125 / 125
290
291 PV Name (#) /dev/sdk1 (9)
292 PV Status available / allocatable
293 Total PE / Free PE 537 / 537
294
295
296
297 # create a linear physical volume with all space of the volume group
298 lvcreate -l1579 my_first_vg
299 lvcreate -- doing automatic backup of my_first_vg
300 lvcreate -- logical volume /dev/my_first_vg/lvol1 successfully created
301
302
303
304 # create an ext2fs on newly created logical volume
305 mke2fs /dev/my_first_vg/lvol1
306 mke2fs 1.10, 24-Apr-97 for EXT2 FS 0.5b, 95/08/09
307 Linux ext2 filesystem format
308 Filesystem label=
309 3235840 inodes, 12939264 blocks
310 646963 blocks (5.00%) reserved for the super user
311 First data block=1
312 Block size=1024 (log=0)
313 Fragment size=1024 (log=0)
314 1580 block groups
315 8192 blocks per group, 8192 fragments per group
316 2048 inodes per group
317 Superblock backups stored on blocks:
318 8193, 16385, 24577, 32769, 40961, 49153, 57345, 65537, 73729,
319 81921, 90113, 98305, 106497, 114689, 122881, 131073, 139265, 147457,
320 <SNIP>
321 Writing superblocks and filesystem accounting information: done
322 0.66user 26.55system 3:06.62elapsed 14%CPU (0avgtext+0avgdata 0maxresident)k
323 0inputs+0outputs (97major+522minor)pagefaults 0swaps
324
325
326
327 # and mount it (not very exiting :-) )
328 mount /dev/my_first_vg/lvol1 /mnt
329

  ViewVC Help
Powered by ViewVC 1.1.5