In an LVM structure, LVM physical partitions, also known as extents, are organized into logical groups, which are in turn used by logical volumes. In effect, you are dealing with three different levels of organization. At the lowest level, you have physical volumes. These are physical hard disk partitions that you create with partition creation tools such as parted or fdisk. The partition type will be a Linux LVM partition, code 8e. These physical volumes are organized into logical groups, known as volume groups, that operate much like logical hard disks. You assign collections of physical volumes to different logical groups.
Once you have your logical groups, you can then create logical volumes. Logical volumes function much like hard disk partitions on a standard setup. For example, on the turtle group volume, you could create a /var logical volume, and on the rabbit logical group, you could create /home and /projects logical volumes. You can have several logical volumes on one logical group, just as you can have several partitions on one hard disk.
You treat the logical volumes as you would any ordinary hard disk partition. You create a file system on one with the mkfs command, and then you can mount the file system to use it with the mount command. For Fedora the file system type is ext3.
Storage on logical volumes is managed using extents. A logical group defines a standard size for an extent, say 4MB, and then divides each physical volume in its group into extents of that size. Logical volumes are, in turn, divided into extents of the same size, which are then mapped to those on the physical volumes.
Logical volumes can be linear, striped, or mirrored. The mirror option will create a mirror copy of a logical volume, providing a restore capability. The striped option lets you automatically distribute your logical volume across several partitions as you would a RAID device. This adds better efficiency for very large files but is complicated to implement. As on a RAID device, stripe sizes have to be consistent across partitions. As LVM partitions can be of any size, the stripe sizes have to be carefully calculated. The simplest approach is just to use a linear implementation, much like a RAID 0 device, just treating the storage as one large ordinary drive, with storage accessed sequentially.
There is one restriction and recommendation for logical volumes. The boot partition cannot be part of a logical volume. You still have to create a separate hard disk partition as your boot partition with the /boot mountpoint in which your kernel and all needed boot files are installed. In addition, it is recommended that you not place your root partition on a logical volume. Doing so can complicate any needed data recovery. This is why a default partition configuration set up during Fedora installation will include a separate /boot partition of 100MB of type ext3, whereas the root and swap partitions will be installed on logical volumes. There will be two partitions, one for the logical group (LVM physical volume, pv) holding both swap and root volumes, and another for the boot partition (ext3). The logical volumes will in turn both be ext3 file systems.
Was this article helpful?