Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




openSUSE 11.1 Reference Guide
Previous Page Home Next Page

2.2 LVM Configuration

This section briefly describes the principles behind the Logical Volume Manager (LVM) and its basic features that make it useful under many circumstances. In Section 2.2.2, LVM Configuration with YaST, learn how to set up LVM with YaST.

WARNING: 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.

2.2.1 The Logical Volume Manager

The LVM enables flexible distribution of hard disk space over several file systems. It was developed because sometimes the need to change the segmentation of hard disk space arises only after the initial partitioning during installation 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 physical repartitioning does. 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

Figure 2-2 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 access them. 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 when the free space is exhausted.

  • Using LVM, it is possible to add hard disks or LVs in a running system. However, this requires hot-swappable hardware that is capable of such actions.

  • 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, this can improve the reading and writing performance just like RAID 0.

  • The snapshot feature enables consistent backups (especially for servers) in the running system.

With these features, using LVM already makes sense for heavily used home PCs or small servers. If you have a growing data stock, as in the case of databases, music archives, or user directories, LVM is just the right thing for you. 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, keep in mind that 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

Starting from kernel version 2.6, LVM version 2 is available, which is downward-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 downward-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.

2.2.2 LVM Configuration with YaST

The YaST LVM configuration can be reached from the YaST Expert Partitioner (see Section 2.1, Using the YaST Partitioner). This partitioning tool enables you to edit and delete existing partitions and create new ones that should be used with LVM. The first task is to create PVs that provide space to a volume group: There, create an LVM partition by first selecting a hard disk, then clicking Create > Do not format, and finally selecting 0x8E Linux LVM as the partition identifier. After creating all the partitions to use with LVM, click Volume Management to start the LVM configuration.

  1. Select a hard disk from Hard Disks.

  2. Change to the Partitions tab.

  3. Click Add and enter the desired size of the PV on this disk.

  4. Use Do not Format the Partition and change the File System ID to 0x8E Linux LVM. Do not mount this partition.

  5. Repeat this procedure until you defined all the desired physical volumes on the available disks.

Creating Volume Groups

If no volume group exists on your system yet, you are prompted to add one (see Figure 2-3). It is possible to create additional groups with Add Volume Group, but usually one single volume group is sufficient. system is suggested as a name for the volume group in which the openSUSE® system files are located. The physical extent size defines the size of a physical block in the volume group. All the disk space in a volume group is handled in chunks of this size. This value is normally set to 4 MB and allows for a maximum size of 256 GB for physical and LVs. The physical extent size should only be increased, for example, to 8, 16, or 32 MB, if you need LVs larger than 256 GB.

Figure 2-3 Creating a Volume Group

Add the previously defined PVs to the volume group by selecting them with the mouse and using Add →. Check if the resulting size at the bottom line of Selected Physical Volumes has the right value.

If you have multiple volume groups defined, and want to add or remove PVs, select the volume group in Volume Management. Then change to the Overview tab and select Resize. In the following menu, you can add or remove PVs to the selected volume group.

Configuring Logical Volumes

After the volume group has been filled with PVs, define the LVs the operating system should use in the next dialog. Set the current volume group in a selection box to the upper left. Next to it, the free space in the current volume group is shown. The list below contains all LVs in that volume group. All normal Linux partitions to which a mount point is assigned, all swap partitions, and all already existing LVs are listed here. Add, Edit, and Remove LVs as needed until all space in the volume group has been exhausted. Assign at least one LV to each volume group.

Figure 2-4 Logical Volume Management

To create a new LV, select the volume group in Volume Management and change to the Logical Volumes tab. There, click Add and go through the wizard-like popup that opens:

  1. Enter the name of the LV. For a partition that should be mounted to /home, a selfexplaining name like HOME could be used.

  2. Select the size and the number of stripes of the LV. If you have only one PV, selecting more than one stripes is not useful.

  3. 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 reading and writing performance (like 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.

WARNING: Striping

YaST has no chance at this point to 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, too. With Next, return to the YaST Expert Partitioner and finish your work there.

openSUSE 11.1 Reference Guide
Previous Page Home Next Page

  Published under the terms fo the GNU General Public License Design by Interspire