18.2 Introduction to Logical Volume Manager

   

You can configure a disk either by using the whole-disk approach or with the help of Logical Volume Manager (LVM). SAM can be used to implement either of these approaches.

The Whole-Disk Approach

If you are using a whole-disk approach, a disk can be used for only one purpose. For example, a disk can be used as a file system, a swap area, or a raw data area. However, there are two exceptions as follows .

  • The swap area can coexist with a file system disk. For example, you can allocate 2 GBytes to the swap area and 4 GBytes to the file system in a 6-GByte disk.

  • The boot area can also coexist with a file system disk. The boot area of the disk is where utilities related to the boot process are stored. This area is in LIF format and occupies 2 MBytes of disk space.

It may also be noted that the swap and boot areas can be created on a file system disk. The whole-disk approach is easy to implement, but it has some serious limitations. Some of these are as follows.

  • Only one file system can exist on the disk. This means that you can't create a file system larger than the disk size .

  • If you run short of space at a later stage, it is not possible to extend the file system. In another case, if you have allocated more space to a file system than is really needed, that space goes to waste, as there is no way to take it back. It may happen that you still have plenty of space on some of the file systems but you need some space on another file system that is full. If you are using the whole-disk approach, you can't use this space for the file system that needs more space.

These limitations are removed if you use LVM as explained next .

The Logical Volume Manager Approach

To better understand LVM, let's define three basic terms: physical volume, volume group , and logical volume.

PHYSICAL VOLUME

Physical volume is the actual physical disk drive. To use a disk with LVM (and hence to mark it as a physical volume), some data structures are created on the disk. The physical volumes use the same device file names as are used with the disk drives .

VOLUME GROUP

You can combine many physical volumes to form a volume group. A volume group is used to combine all space as one entity on the included physical volumes. For example, if you have four physical disks installed in your system, each with a 10-GByte capacity, a volume group can be created having a 40-GByte capacity. On an abstract level, HP-UX treats a volume group as a single storage space of 40 GBytes. This space can then be configured into desired smaller sizes. For example, you can create an area of 26 GBytes, which was not possible if you were using the whole disk approach.

The default volume group name is vg00 , which is created when you first install HP-UX on your system. This is called the root volume group. It contains the boot disk and most of the operating system utilities and commands. You can create additional volume groups with names of your choice at any later stage.

Each volume group has a subdirectory the same name under the /dev directory. The subdirectory for the root volume group vg00 is /dev/vg00 .

LOGICAL VOLUME

Considering a volume group as a single storage space of large capacity, you can divide it in logical volumes. A logical volume may be considered as an area on the disk in which you can create a file system. You can also use a logical volume as a swap or raw data area. Also, you can resize a logical volume at any time without losing any data on it. Other properties of a logical volume are as follows.

You can create a logical volume that occupies space only on one physical volume. You can also distribute space occupied by a logical volume to multiple physical volumes if you wish to do so.

Each logical volume has a device file inside the volume group directory. These device files have the names lvol1 , lvol2 , lvol3 , and so on. However, this naming convention can be changed. A list of logical volumes in the root volume group /dev/vg00 is shown here.

 crw-r-----   1 root    sys   64 0x000000 Jul  7 20:32 group brw-r-----   1 root    sys   64 0x000001 Oct 29 20:40 lvol1 brw-r-----   1 root    sys   64 0x000002 Jul  7 20:32 lvol2 brw-r-----   1 root    sys   64 0x000003 Jul  7 20:32 lvol3 brw-r-----   1 root    sys   64 0x000004 Aug 26 15:44 lvol4 brw-r-----   1 root    sys   64 0x000005 Aug 26 15:44 lvol5 brw-r-----   1 root    sys   64 0x000006 Aug 26 15:44 lvol6 brw-r-----   1 root    sys   64 0x000007 Aug 26 15:44 lvol7 brw-r-----   1 root    sys   64 0x000008 Aug 26 15:44 lvol8 crw-r-----   1 root    sys   64 0x000001 Jul  7 20:32 rlvol1 crw-r-----   1 root    sys   64 0x000002 Jul  7 20:32 rlvol2 crw-r-----   1 root    sys   64 0x000003 Jul  7 20:32 rlvol3 crw-r-----   1 root    sys   64 0x000004 Jul  7 20:32 rlvol4 crw-r-----   1 root    sys   64 0x000005 Jul  7 20:32 rlvol5 crw-r-----   1 root    sys   64 0x000006 Jul  7 20:32 rlvol6 crw-r-----   1 root    sys   64 0x000007 Jul  7 20:32 rlvol7 crw-r-----   1 root    sys   64 0x000008 Jul  7 20:32 rlvol8 

As you can see, the first file in the list is named group . This is the volume group device file. Every logical volume has two device files, like disk drives. One of these files is the block device file, and the other one is the character or raw device file. The name of the raw device file starts with " r ".

Like other device files, each of these files has a major and a minor device number. The major device number for all LVM device files is 64. The minor number shows the logical volume name and its volume group membership. The first two digits from the left side show the group membership. In this listing, these are "00", showing that the file is related to the vg00 group. The last two digits (first two digits from the right side) show the file name. A pattern "04" shows a file name lvol04 . The middle two digits are not used, and should be "00".

When you create a volume group, the volume device file is created using the mknod command. At a later stage, if you add a new logical volume to a volume group, new device files will be created automatically in the volume group directory.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net