Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX System Administration Tasks: HP 9000 > Chapter 3 Managing Disks Using the Logical Volume Manager (LVM)

Planning for the Use of Logical Volumes

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

Using logical volumes requires some planning. Some of the issues you should consider for planning purposes are listed below and discussed in the remainder of this section. You should consider these issues before setting up or modifying logical volumes on your system.

  • If you used non-LVM disks on a pre-10.0 version of HP-UX, how can you convert these disks to logical volumes? Since this topic requires information presented throughout the chapter, the procedures required will be deferred until the close of the chapter.

  • For what purpose will you use a logical volume? For a file system, for swap space, or for raw data storage? You can also use a logical volume for booting the system or as a dump area; see "Creating the Root Volume Group and a Root Logical Volume" later in this chapter and "Setting Up Dump Areas" in Chapter 6 for details.

  • How big should you make a logical volume?

  • Is I/O performance very important to you? If so, you need to consider your disk interface types and models. You should see also Chapter 8 on disk striping.

  • Does your data require high availability? If so, see Chapter 7 on mirroring. Also see the information under "Increasing Availability with Alternate Links" later in this chapter.

Setting Up Logical Volumes for File Systems

File systems reside in a logical volume just as they do within disk sections or non-partitioned disks.

What Size Logical Volume Does a File System Require?

You can consider the space required by a file system as having three major components, as depicted in Figure 3-3 “File System Space Components”.

Figure 3-3 File System Space Components

File System Space Components

To get a rough estimate of how big to make a logical volume which will contain your file system, do the following:

  1. Estimate how much disk space users will need for their data out into the future. Allow for any anticipated changes which are usually in the direction of additional growth. (Use the du command to see how much disk space is currently being used.)

  2. Add 10% to the above amount for a "minfree" area; this area is reserved to maintain performance.

  3. Add another 5% for file system overhead; this includes all data structures required to maintain the file system.

  4. Round up to the next integer multiple of the logical extent size used in this logical volume to find the size in logical extents. (Unlike the previous steps, this step is performed automatically for you when you create a logical volume.)

For example, suppose a group of users will require 60MB space for file system data; this estimate allows for expected growth. You then add 6MB for the "minfree" space and arrive at 66MB. Then you add another 3MB for file system overhead and arrive at a grand total estimate of 69MB required by the file system, and by consequence, for the logical volume that contains the file system. If you are creating the logical volume in a volume group that has an extent size of 4MB, 69 gets rounded up to 72 to make it divisible by 4MB. That is, LVM will create your logical volumes in multiples of the logical extent size.

Although estimates are not precise, they suffice for planning how big to make a file system. You want your file system to be large enough for some useful time before having to increase its size. On the other hand, a contiguous logical volume such as the root logical volume cannot be readily increased in size. Here, it is especially important to try to choose an estimate that will allow for all subsequent growth to such logical volumes.

Changing the Size of Your File System Within a Logical Volume

Suppose as suggested above, your users have outgrown the space originally allocated for the file system. You can increase the size of a file system by first enlarging the logical volume it resides in and then using extendfs(1M). (More information can be found under "Extending the Size of a File System Within a Logical Volume" in Chapter 4.)

You cannot decrease the size of a file system once it has been created. However, you can create a new smaller file system to take its place.

NOTE: Because increasing the size of a file system is usually much easier than reducing its size, you might benefit by being conservative in estimating how large to create a file system.

However, an exception to this would be the root file system since it is difficult to extend it.

Spanning Disks With File Systems

Whenever possible, if you plan to have a file system span disks, have the logical volume span identical disk interface types. (See "Using Disk I/O Interfaces" later in this chapter.)

Normally, by default, LVM will create logical volumes on available disks, not necessarily with regard for best performance. It is possible to have a file system span two disks with different characteristics, in which case the file system performance could possibly be impaired.

As a system administrator, you can exercise control over which physical volumes will contain the physical extents of a logical volume. You can do this by using the following two steps:

  1. Create a logical volume without specifying a size using lvcreate(1M) or SAM. When you do not specify a size, by default, no physical extents are allocated for the logical volume.

  2. Now extend the logical volume (that is, allocate space) to the specific physical volumes you wish to contain the file system using lvextend(1M).

For more detailed information on this procedure, see "Extending a Logical Volume to a Specific Disk" later in this chapter.

Setting Up Logical Volumes for Swap

When you enable a swap area within a logical volume, HP-UX determines how large the area is and it will use no more space than that. If your disk has enough remaining contiguous space, you can subsequently increase the size of your primary swap area by using the lvextend command (or SAM) to enlarge the logical volume and then reboot the system. This allows HP-UX to use the extra space that you have provided.

If you plan device swap areas in addition to primary swap, you will attain the best performance when the device swap areas are on different physical volumes (disks). This allows for the interleaving of I/O to the physical volumes when swapping occurs. See "Guidelines for Setting Up Device Swap Areas" in Chapter 6 for more information.

You set up this swapping configuration by creating multiple logical volumes for swap, each logical volume on a separate disk. You must use HP-UX commands to help you obtain this configuration; SAM does not allow you to create a logical volume on a specific disk. See "Extending a Logical Volume to a Specific Disk" later in this chapter.

See Chapter 6, "Managing Swap Space and Dump Areas", for more information on swap.

Setting Up Logical Volumes for Raw Data Storage

You can optimize raw I/O performance by planning your logical volumes specifically for raw data storage. To create a raw data logical volume (such as for a database), you will need to consider how large to create the logical volume and how such a logical volume is distributed over your disks.

Calculating the Space Required for a Raw Data Logical Volume

Typically, you specify the size of a logical volume in megabytes. However, a logical volume's size must be a multiple of the extent size used in the volume group. By default, the size of each logical extent is 4MB.

So, for example, if a database partition requires 33MB and the default logical extent size is 4MB, LVM will create a logical volume that is 36MB (or 9 logical extents).

The maximum supported size for a raw data device is 4GB.

Distributing the Raw Data Over Your Disks

If you plan to use logical volumes heavily for raw data storage (such as for setting up database partitions), you should consider how the logical volumes are distributed over your disks.

By default, LVM will assign disk space for a logical volume from one disk, use up the space on this disk entirely, and then assign space from each successive disk in the same manner. LVM uses the disks in the order in which they were added to the volume group. This means that a logical volume's data may not turn out to be evenly distributed over all the disks within your volume group.

As a result, when I/O access to the logical volumes occurs, one or more disks within the volume group may be heavily used, while the others may be lightly used, or not even used at all. This arrangement does not provide optimum I/O performance.

As a better alternative, you can set up your logical volume on specific disks in an interleaved manner, thus balancing the I/O access and optimizing performance. (See "Extending a Logical Volume to a Specific Disk" later in the chapter.)

Naming Logical Volumes for Raw Data

Because there are no HP-UX commands that will identify that the contents of a logical volume are being used for raw data, it is a good idea to name the logical volumes you create for raw data with easily recognizable names. In this way, you can recognize the contents of such a logical volume. See "Naming Logical Volumes" later in this chapter for more information.

Using Disk I/O Interfaces

LVM supports disks that use SCSI, HP-FL, and, to a limited extent, HP-IB I/O interface types, as shown in Table 3-1.

Table 3-1 Disk Interface Types and LVM Support

SCSI

HP-FL

HP-IB

Support mixing of disks with other interface types within the same volume group?

Yes

Yes

No

Support bad block relocation?

Yes

Yes

No

Support LVM mirroring? (See Chapter 7.)

Yes

Yes

No

 

Although the table shows that mixed HP-FL and SCSI disks can belong to the same volume group, for best performance, you should keep them in separate groups, each containing identical model disks; that is, each should have the same characteristics such as size and rotational speed. HP-IB disks cannot be mixed with the other types.

NOTE: LVM can be used on all Series 700 and 800 supported disks, except for HP-FL disk arrays on Series 800 Channel Input/Output (CIO) computers. HP-IB disks are not supported on Series 700 systems.

Bad Block Relocation

If as a result of a defect on the disk, LVM is unable to store data, a mechanism is provided to store it at the end of the disk. If your disk supports automatic bad block relocation (usually known as "hardware sparing"), then LVM's bad block relocation mechanism is unnecessary.

Bad block relocation is in effect by default when a logical volume is created. You can use the -r n option of lvcreate(1M) to disable the bad block relocation feature.

NOTE: Bad block relocation is not supported for root, swap, or dump logical volumes.

The -r option of lvcreate cannot be used with HP-IB devices.

Increasing Availability with Alternate Links

Your hardware may provide the capability for dual cabling (dual controllers) to the same physical volume. This will be true if your organization has purchased an HP High Availability Disk Array or the MC/ServiceGuard product. If so, LVM can be configured with multiple paths to the same physical volume. If the primary link fails, an automatic switch to an alternate connection or link will occur. Using alternate links will increase availability. See "Setting Up Alternate Links to a Physical Volume" later in this chapter.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.