This section briefly describes the principles behind the Logical Volume Manager (LVM) and its multipurpose features. In Section 2.2.2, “LVM Configuration with YaST”, learn how to set up LVM with YaST.
![]() | |
Using LVM might be associated with increased risk such as data loss. Risks also include application crashes, power failures, and faulty commands. Save your data before implementing LVM or reconfiguring volumes. Never work without a backup. | |
The LVM enables flexible distribution of hard disk space over several file systems. It was developed because sometimes the need to change the segmenting of hard disk space arises only after the initial partitioning has already been done. Because it is difficult to modify partitions on a running system, LVM provides a virtual pool (volume group, VG for short) of memory space from which logical volumes (LVs) can be created as needed. The operating system accesses these LVs instead of the physical partitions. Volume groups can span more than only one disk so that several disks or parts of them may constitute one single VG. This way, LVM provides a kind of abstraction from the physical disk space that allows its segmentation to be changed in a much easier and safer way than with physical repartitioning. Background information regarding physical partitioning can be found in Section 2.1.1, “Partition Types” and Section 2.1, “Using the YaST Partitioner”.
Figure 2.2, “Physical Partitioning versus LVM” compares physical partitioning (left) with LVM segmentation (right). On the left side, one single disk has been divided into three physical partitions (PART), each with a mount point (MP) assigned so that the operating system can gain access. On the right side, two disks have been divided into two and three physical partitions each. Two LVM volume groups (VG 1 and VG 2) have been defined. VG 1 contains two partitions from DISK 1 and one from DISK 2. VG 2 contains the remaining two partitions from DISK 2. In LVM, the physical disk partitions that are incorporated in a volume group are called physical volumes (PVs). Within the volume groups, four LVs (LV 1 through LV 4) have been defined, which can be used by the operating system via the associated mount points. The border between different LVs need not be aligned with any partition border. See the border between LV 1 and LV 2 in this example.
LVM features:
Several hard disks or partitions can be combined in a large logical volume.
Provided the configuration is suitable, an LV (such as
/usr) can be enlarged if free space is exhausted.
With LVM, it is possible to add hard disks or LVs in a running system. However, this requires hot-swappable hardware.
It is possible to activate a "striping mode" that distributes the data stream of a LV over several PVs. If these PVs reside on different disks, the read and write performance is enhanced, as with RAID 0.
The snapshot feature enables consistent backups (especially for servers) in the running system.
With these features, LVM is ready for heavily used home PCs or small servers. LVM is well-suited for the user with a growing data stock (as in the case of databases, music archives, or user directories). This would allow file systems that are larger than the physical hard disk. Another advantage of LVM is that up to 256 LVs can be added. However, working with LVM is different from working with conventional partitions. Instructions and further information about configuring LVM is available in the official LVM HOWTO at http://tldp.org/HOWTO/LVM-HOWTO/.
Starting from kernel version 2.6, LVM version 2 is available, which is backward-compatible with the previous LVM and enables the continued management of old volume groups. When creating new volume groups, decide whether to use the new format or the backward-compatible version. LVM 2 does not require any kernel patches. It makes use of the device mapper integrated in kernel 2.6. This kernel only supports LVM version 2. Therefore, when talking about LVM, this section always refers to LVM version 2.
The YaST LVM configuration can be reached from the YaST Expert Partitioner (see Section 2.1, “Using the YaST Partitioner”) below . The Expert Partitioner allows you to edit and delete existing partitions and also create new ones that need to be used with LVM. The first task is to create PVs that provide space to a volume group:
Select a hard disk from .
Change to the tab.
Click and enter the desired size of the PV on this disk.
Use and change the to . Do not mount this partition.
Repeat this procedure until you have defined all the desired physical volumes on the available disks.
If no volume group exists on your system, you must add one (see Figure 2.3, “Creating a Volume Group”). It is possible to create additional groups by clicking on in the menu, and then on +. One single volume group is usually sufficient.
Enter a name for the VG, e.g. system.
Select the desired . This value defines the size of a physical block in the volume group. All the disk space in a volume group is handled in blocks of this size.
![]() | Logical Volumes and Block Sizes |
|---|---|
The possible size of an LV depends on the block size used in the volume group. The default is 4 MB and allows for a maximum size of 256 GB for physical and LVs. The physical size should be increased, for example, to 8, 16, or 32 MB, if you need LVs larger than 256 GB. | |
Add the prepared PVs to the VG by selecting the device and clicking on . Selecting several devices is possible by holding while selecting the devices.
Select to make the VG available to further configuration steps.
After the volume group has been filled with PVs, define the LVs the operating system should use in the next dialog. Choose the current volume group and change to the tab. , , , and LVs as needed until all space in the volume group has been exhausted. Assign at least one LV to each volume group.
Click and go through the wizard-like popup that opens:
Enter the name of the LV. For a partition that should be mounted to
/home, a self-explanatory name like
HOME could be used.
Select the size and the number of stripes of the LV. If you have only one PV, selecting more than one stripe is not useful.
Choose the filesystem to use on the LV as well as the mount point.
By using stripes it is possible to distribute the data stream in the LV
among several PVs (striping). If these PVs reside on different hard
disks, this generally results in a better read and write performance
(similar to RAID 0). However, a striping LV with
n stripes can only be created correctly if the hard
disk space required by the LV can be distributed evenly to
n PVs. If, for example, only two PVs are available, a
LV with three stripes is impossible.
![]() | Striping |
|---|---|
YaST cannot, at this point, verify the correctness of your entries concerning striping. Any mistake made here is apparent only later when the LVM is implemented on disk. | |
If you have already configured LVM on your system, the existing logical volumes can also be used. Before continuing, assign appropriate mount points to these LVs. With , return to the YaST Expert Partitioner and finish your work there.