OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [Documentation/] [LVM-HOWTO] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
Heinz Mauelshagen's LVM (Logical Volume Manager) howto.             02/10/1999
2
 
3
 
4
Abstract:
5
---------
6
The LVM adds a kind of virtual disks and virtual partitions functionality
7
to the Linux operating system.
8
 
9
It achieves this by adding an additional layer between the physical peripherals
10
and the i/o interface in the kernel.
11
 
12
This allows the concatenation of several disk partitions or total disks
13
(so-called physical volumes or PVs) or even multiple devices
14
to form a storage pool (so-called Volume Group or VG) with
15
allocation units called physical extents (called PE).
16
You can think of the volume group as a virtual disk.
17
Please see scenario below.
18
 
19
Some or all PEs of this VG then can be allocated to so-called Logical Volumes
20
or LVs in units called logical extents or LEs.
21
Each LE is mapped to a corresponding PE.
22
LEs and PEs are equal in size.
23
Logical volumes are a kind of virtual partitions.
24
 
25
 
26
The LVs can be used through device special files similar to the known
27
/dev/sd[a-z]* or /dev/hd[a-z]* named /dev/VolumeGroupName/LogicalVolumeName.
28
 
29
But going beyond this, you are able to extend or reduce
30
VGs _AND_ LVs at runtime!
31
 
32
So...
33
If for example the capacity of a LV gets too small and your VG containing
34
this LV is full, you could add another PV to that VG and simply extend
35
the LV afterwards.
36
If you reduce or delete a LV you can use the freed capacity for different
37
LVs in the same VG.
38
 
39
 
40
The above scenario looks like this:
41
 
42
     /------------------------------------------\
43
     |  /--PV2---\      VG 1      /--PVn---\    |
44
     |  |-VGDA---|                |-VGDA-- |    |
45
     |  |PE1PE2..|                |PE1PE2..|    |
46
     |  |        |     ......     |        |    |
47
     |  |        |                |        |    |
48
     |  |    /-----------------------\     |    |
49
     |  |    \-------LV 1------------/     |    |
50
     |  |   ..PEn|                |   ..PEn|    |
51
     |  \--------/                \--------/    |
52
     \------------------------------------------/
53
 
54
PV 1 could be /dev/sdc1 sized 3GB
55
PV n could be /dev/sde1 sized 4GB
56
VG 1 could be test_vg
57
LV 1 could be /dev/test_vg/test_lv
58
VGDA is the volume group descriptor area holding the LVM metadata
59
PE1 up to PEn is the number of physical extents on each disk(partition)
60
 
61
 
62
 
63
Installation steps see INSTALL and insmod(1)/modprobe(1), kmod/kerneld(8)
64
to load the logical volume manager module if you did not bind it
65
into the kernel.
66
 
67
 
68
Configuration steps for getting the above scenario:
69
 
70
1. Set the partition system id to 0x8e on /dev/sdc1 and /dev/sde1.
71
 
72
2. do a "pvcreate /dev/sd[ce]1"
73
   For testing purposes you can use more than one partition on a disk.
74
   You should not use more than one partition because in the case of
75
   a striped LV you'll have a performance breakdown.
76
 
77
3. do a "vgcreate test_vg /dev/sd[ce]1" to create the new VG named "test_vg"
78
   which has the total capacity of both partitions.
79
   vgcreate activates (transfers the metadata into the LVM driver in the kernel)
80
   the new volume group too to be able to create LVs in the next step.
81
 
82
4. do a "lvcreate -L1500 -ntest_lv test_vg" to get a 1500MB linear LV named
83
   "test_lv" and it's block device special "/dev/test_vg/test_lv".
84
 
85
   Or do a "lvcreate -i2 -I4 -l1500 -nanother_test_lv test_vg" to get a 100 LE
86
   large logical volume with 2 stripes and stripesize 4 KB.
87
 
88
5. For example generate a filesystem in one LV with
89
   "mke2fs /dev/test_vg/test_lv" and mount it.
90
 
91
6. extend /dev/test_vg/test_lv to 1600MB with relative size by
92
   "lvextend -L+100 /dev/test_vg/test_lv"
93
   or with absolute size by
94
   "lvextend -L1600 /dev/test_vg/test_lv"
95
 
96
7. reduce /dev/test_vg/test_lv to 900 logical extents with relative extents by
97
   "lvreduce -l-700 /dev/test_vg/test_lv"
98
   or with absolute extents by
99
   "lvreduce -l900 /dev/test_vg/test_lv"
100
 
101
9. rename a VG by deactivating it with
102
   "vgchange -an test_vg"   # only VGs with _no_ open LVs can be deactivated!
103
   "vgrename test_vg whatever"
104
   and reactivate it again by
105
   "vgchange -ay whatever"
106
 
107
9. rename a LV after closing it by
108
   "lvchange -an /dev/whatever/test_lv" # only closed LVs can be deactivated
109
   "lvrename  /dev/whatever/test_lv  /dev/whatever/whatvolume"
110
   or by
111
   "lvrename  whatever test_lv whatvolume"
112
   and reactivate it again by
113
   "lvchange -ay /dev/whatever/whatvolume"
114
 
115
10. if you own Ted Tso's/Powerquest's resize2fs program, you are able to
116
    resize the ext2 type filesystems contained in logical volumes without
117
    destroyiing the data by
118
    "e2fsadm -L+100 /dev/test_vg/another_test_lv"
119
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.