 |
» |
|
|
 |
Logical volumes are implemented on both the Series 800 and
Series 700 by the Logical Volume Manager
(LVM) subsystem, a set of commands for handling your system's entire
disk storage. LVM combines one or more physical disk devices into
a complete disk management system, allowing the allocation of disk
space according to current need.  |  |  |  |  | NOTE: See Tables 3-2, 3-3, and 3-4, and the example following
Table 3-4 for the commands to implement the information presented
within this "Introduction" section. |  |  |  |  |
Useful Facts About LVM |  |
To use LVM, a disk must be first initialized into a physical
volume (also called an LVM disk). Once you have initialized one or more physical volumes,
you assign them into one or more volume groups.
If you think of all of your physical volumes as forming a storage
pool, then a subset of disks from the pool can be joined together
into a volume group. A given disk can only belong to one volume group.
The maximum number of volume groups that can be created is determined
by the configurable parameter maxvgs.
See "Reconfiguring the Kernel" in Chapter 1 for information on modifying
system parameters. A volume group can contain from one to 255 physical
volumes. Disk space from the volume group is allocated into
a logical volume, a distinct unit of usable
disk space. A volume group can contain up to 255 logical volumes. A logical volume can exist on only one disk or can
reside on portions of many disks. The disk space within a logical volume can be used
for swap, dump, raw data, or you can create a file system on it. In Figure 3-1 “Disk Space Partitioned
into Logical Volumes ”, logical volume
/dev/vg01/lvol1
might contain a file system, /dev/vg01/lvol2
might contain swap space, and /dev/vg01/lvol3
might contain raw data. As the figure illustrates, a file system,
swap space, or raw data area may exist within a logical volume that
resides on more than one disk. If a logical volume spans multiple physical volumes,
it is not required that each disk be of the same interface type
except in the case of HP-IB disks; however, having the same interface
type will result in better performance. See "Using Disk I/O Interfaces"
later in this chapter for more information on interface types and
limitations.
How LVM Works |  |
LVM divides each physical
disk into addressable units called physical extents.
Extents are allocated to disks sequentially starting from the beginning
of the disk with address zero, and incrementing the address by one
for each unit. Physical extent size is configurable at the time
you form a volume group and applies to all disks in the volume group.
By default, each physical extent has a size of 4 megabytes (MB).
This value can be changed when you create the volume group to a
value between 1MB and 256MB. The basic allocation unit for a logical volume is
called a logical extent. A logical extent
is mapped to a physical extent; thus, if the physical extent size
is 4MB, so will be the logical extent size. The size of a logical
volume is determined by the number of logical extents configured. When LVM allocates disk space to a logical volume,
it automatically creates a mapping of the physical extents to logical
extents. Logical extents are also allocated sequentially, starting
at zero, for each logical volume. Therefore, regardless of where
the actual physical data resides for a logical volume within a volume
group, LVM will use this mapping to access the data. Commands are
provided for you to examine this mapping; see pvdisplay(1M)
and lvdisplay(1M). Except for mirrored or striped logical volumes,
each logical extent is mapped to one physical extent. For mirrored
logical volumes, either two or three physical extents are mapped
for each logical extent depending upon whether you are using single
or double mirroring. For example, if one mirror copy exists, then
each logical extent maps to two physical extents, one extent for
the original and one for the mirror copy. (See Chapter 7 for more
information on mirroring.) For information on striped logical volumes,
see Chapter 8. Figure 3-2 “Physical Extents and Logical
Extents ” on the following
page shows an example of several types of mapping available between
physical extents and logical extents within a volume group. As can be seen in Figure 3-2, the contents of the first logical
volume are contained on all three physical volumes in the volume
group. Since the second logical volume is mirrored, each logical
extent is mapped to more than one physical extent. In this case,
there are two physical extents containing the data, each on both
the second and third disks within the volume group. By default, LVM assigns physical extents to logical
volumes by selecting available physical extents from disks in the
order you added physical volumes to the volume group. As a system
administrator, you can bypass this default assignment and control
which disks are used by a logical volume (see "Spanning Disks With
File Systems" in this chapter). If a logical volume is to be used for root, primary
swap, or dump, the physical extents must be contiguous.
This means that the physical extents must be allocated with no gaps
on a single physical volume. On non-root disks, physical extents
that correspond to contiguous logical extents within a logical volume
can be non-contiguous on a physical volume or reside on entirely
different disks. As a result, it becomes possible for a file system
created within one logical volume to reside on more than one disk.
|