garden3.jpg

Logical Volume Manager


It used to be that you can have a file system span only within a single disk partition, but that was a problem because when the file system got full you could not expand it into a different partition; imagine your /data file system is full and you can not extend it. This is why we have logical volumes, called LVM.

To better understand the concept of logical volume, consider the following:

I have two physical disks of 2GB each; I create a 4GB volume group using my two physical disks. So now I can create one or more logical volumes within this volume group; for example I create a logical volume sized 1GB within this volume group. This 1GB space allocated within the 4GB volume group is called a logical volume; I can then create a file system within this logical volume and when needed I can extend my file system by first extending the logical volume within it’s volume group and then extending my file system within it’s logical volume.

LVOL: logical volume.

VG: volume group.

Disclaimer: Apply to a TEST environment first. Use on production systems is at DBAs own risk.

To find out which disks make up our existing vg (volume group), do as follow:

1) ioscan -funC disk

à This would list all your physical disks.

2) vgdisplay -v vg00

à At the end of this list, I can see the physical volumes that are a part of vg00.

Notes:
  • You create a volume group including one or more physical volumes.
  • You create logical groups within a volume group.
  • You create a file system within a logical group.
  • A file system cannot span over a single logical volume.
  • Each logical volume contains one and only one file system.
  • To extent a file system; you need to increase the size of the logical volume, then increase the size of that file system within the logical volume.
  • You can increase the size of a volume group by adding a new physical disk. You have to make that new disk a physical volume first by using pvcreate.
  • Limit: 255 max logical volumes (LVOL) per volume group. 16 physical disks per volume.
  • Vg00 is always the boot disk.
Displaying physical volume:

pvdisplay: Displays information about physical volumes within a volume group.

pvdisplay /dev/dsk/c0t5d0

à Displays information about physical volume c0t5d0.

PV Name: Name of the physical volume.

VG Name: Name of the volume group PV is belonging to.

PV Status: State of the physical volume: available or unavailable.

Cur LV: Number of logical volumes using the physical volume.

PE Size: Size of physical extents on the volume.

Total PE: Total number of physical extents on the physical volume.

Free PE: Number of free physical extents on the physical volume.

Allocated PE: Number of physical extents on the physical volume that

are allocated to logical volumes.

pvdisplay -v /dev/dsk/c0t5d0

à Displays a long list of logical extents for c0t5d0.

Important numbers:

Total free space available on the physical volume = PE Size x Free PE

Total size of the physical volume = PE Size x Total PE

Displaying volume group:

vgdisplay: Displays information about volume groups.

vgdisplay –v

à Displays all volume groups.

vgdisplay -v vg01

à Displays only volume group vg01.

vgdisplay when -v command-line option is not specified produces a listing as below:

VG Name: Name of the volume group.

Max LV: Maximum number of logical volumes allowed in the volume group.

Cur LV: Current number of logical volumes in the volume group.

Max PV: Maximum number of physical volumes allowed in the volume group.

Cur PV: Current number of physical volumes in the volume group.

PE Size: Size of each physical extent.

Max PE per PV: Maximum number (limit) of physical extents that can be

allocated from any of the physical volumes in the volume group.

Total PE for VG: Total number of physical extents within the volume group: the

sum of the number of physical extents belonging to each available

physical volume in the volume group.

Alloc PE Number of physical extents currently allocated to logical volumes.

Free PE for VG: Number of physical extents not allocated.

Total PVG: Total number of physical volume groups within the volume group.

vgdisplay when -v command-line option is specified lists additional info as below:

Logical volumes: Lists information about logical volumes belonging to volume group:

LV Name: Name of logical volume in the volume group.

LV Status: State of the logical volume.

LV Size: Size of the logical volume.

Total LE: Number of logical extents in the logical volume.

Used PE: Number of physical extents used by the logical volume.

Used PV: Number of physical volumes used by the logical volume. Physical volumes: Lists information about physical volumes belonging to volume group:

PV Name: Name of physical volume in the group.

PV status: State of the physical volume.

Total PE: Total number of physical extents on the physical volume.

Free PE: Number of free physical extents on the physical volume.

Physical Volume Group: Lists information about physical volume groups belonging to volume group:

PVG Name: Name of physical volume group in the volume group.

PV Name: Name of physical volume in the physical volume group.

Important numbers:

Total free space available on the volume group = PE Size x Free PE for VG

Maximum disk size that can be added to this group = PE Size x Max PE per PV

Total size of the volume group = PE Size x Total PE for VG

Displaying logical volume:

lvdisplay: Displays information about logical volumes.

lvdisplay -v /dev/vg00/lvol4

or lvdisplay /dev/vg00/lvol4 :for the short version.

à Displays the characteristics and status of each logical volume specified, the -v (verbose) option displays physical volume (PV) distribution information, and map of logical extents.

lvdisplay when -v command-line option is not specified lists the following:

LV Name: Name of the logical volume.

VG Name: Name of the volume group.

LV Permission:Access permission: read-only or read-write.

LV Status: State of the logical volume.

LV Size: Size of the logical volume in Mbytes.

Current LE: Number of logical extents currently in the logical volume.

Allocated PE: Number of physical extents allocated to the logical volume.

lvdisplay when -v command-line option is specified lists additional info as below:

Distribution of logical volume: Lists distribution of logical within the volume group.

PV Name: Name of the physical volume to which the logical extents are

allocated.

LE on PV: Number of logical extents allocated on the physical volume.

PE on PV: Number of physical extents allocated on the physical volume.

LE: Logical extent number.

Latest Blog Items

email

Thank you for your interest in idbasolutions.

Contact us using this email: contact.us@idbasolutions.com