1.8. LVM Configuration

This professional partitioning tool enables you to edit and delete existing partitions and create new ones. Access the Soft RAID and LVM configuration from here.

[Important]Important

Background information and partitioning tips can be found in Section 1.7. “Partitioning for Experts”.

In normal circumstances, partitions are set up during installation. However, it is possible to integrate a second hard disk in an existing Linux system. First, the new hard disk must be partitioned. Then it must be mounted and entered into the /etc/fstab file. It may be necessary to copy some of the data to move an /opt partition from the old hard disk to the new one.

Use caution repartitioning the hard disk in use — this is essentially possible, but you will have to reboot the system right afterwards. It is a bit safer to boot from CD then repartition it.

Experts… opens a pop-up menu containing the following commands:

Reread Partition Table

Rereads the partitioning from disk. For example, you need this for manual partitioning in the text console.

Adopt Mount Points from Existing /etc/fstab

This is only relevant during installation. Reading the old fstab is useful for completely reinstalling your system rather than just updating it. In this case, it is not necessary to enter the mount points by hand.

Delete Partition Table and Disk Label

This completely overwrites the old partition table. For example, this can be helpful if you have problems with unconventional disk labels. Using this method, all data on the hard disk is lost.

1.8.1. Logical Volume Manager (LVM)

Starting from kernel version 2.6, you can use LVM version 2, 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. LVM2 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 chapter always refer to LVM version 2.

Instead of LVM2, you can also use EVMS (Enterprise Volume Management System), which offers a uniform interface for logical volumes as well as RAID volumes. Like LVM2, EVMS makes use of the device mapper in kernel 2.6.

The Logical Volume Manager (LVM) enables flexible distribution of hard disk space over several file systems. As it is difficult to modify partitions on a running system, LVM was developed. It provides a virtual pool (Volume Group — VG for short) of memory space from which logical volumes (LV) can be generated if needed. The operating system accesses these instead of the physical partitions.

Features:

  • Several hard disks or partitions can be combined to a large logical partition.

  • Provided the configuration is suitable, a LV (such as /usr) can be enlarged when the free space is exhausted.

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

  • Several hard disks can be used with improved performance in the RAID 0 (striping) mode.

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

Implementing 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, MP3 archives, or user directories, LVM is just the right thing for you. This would allow file systems that are larger than physical hard disk. Another advantage of the LVM is that up to 256 LVs can be added. Keep in mind that working with LVM is very different than 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/.

1.8.1.1. LVM Configuration with YaST

Prepare the LVM configuration in YaST by creating an LVM partition when installing. To do this, click Partitioning in the suggestion window then Discard or Change in the screen that follows. Next, create a partition for LVM by first clicking Add -> Do not format in the Partitioner then clicking 0x8e Linux LVM. Continue partitioning with LVM immediately afterwards or wait until after the system is completely installed. To do this, highlight the LVM partition in the partitioner then click LVM....

Figure 1.5. Activating LVM During Installation

Activating LVM During Installation

1.8.1.2. LVM — Partitioning

After selecting LVM... in the partitioning section, continue automatically to a dialog in which to repartition your hard disks. Delete or modify existing partitions here or add new ones. A partition to use for LVM must have the partition label 8E. These partitions are indicated by “Linux LVM” in the partition list.

Figure 1.6. YaST: LVM Partitioner

YaST: LVM Partitioner
[Tip]Repartitioning Logical Volumes

At the beginning of the physical volumes (PVs), information about the volume is written to the partition. In this way, a PV “knows” to which volume group it belongs. To repartition, it is advisable to delete the beginning of this volume. In VG “system” and PV “/dev/sda2”, this can be done with the command dd if=/dev/zero of=/dev/sda2 bs=512 count=1.

You do not need to set the 8E label for all partitions designated for LVM. If needed, YaST automatically sets the partition label of a partition assigned to an LVM volume group to 8E. For any unpartitioned areas on your disks, create LVM partitions in this dialog. These partitions should then be designated the partition label 8E. They do not need to be formatted and no mount point can be entered.

Figure 1.7. Creating LVM Partitions

Creating LVM Partitions

If a working LVM configuration already exists on your system, it is automatically activated as soon as you begin configuring the LVM. If this is successfully activated, any disks containing a partition belonging to an activated volume group can no longer be repartitioned. The Linux kernel will refuse to read the modified partitioning of a hard disk as long as only one partition on this disk is used.

Repartitioning disks not belonging to an LVM volume group is not a problem at all. If you already have a functioning LVM configuration on your system, repartitioning is usually not necessary. In this screen, configure all mount points not located on LVM Logical Volumes. The root file system in YaST must be stored on a normal partition. Select this partition from the list and specify this as root file system using the Edit button. In view of the flexibility of LVM, we recommend that you place all additional file systems in LVM logical volumes. After specifying the root partition, exit this dialog.

1.8.1.3. LVM — Configuring Physical Volumes

In the dialog LVM, the LVM volume groups are managed. If no volume group exists on your system yet, you will be prompted to add one. system is suggested as a name for the volume group in which the SUSE LINUX system files are located. Physical extent size (PE Size) defines the maximum size of a physical and logical volume in this volume group. This value is normally set to four megabytes. This allows for a maximum size of 256 GB for physical and logical volumes. The physical extent size should only be increased if you need logical volumes larger than 256 GB (e.g., to 8, 16, or 32 MB).

Figure 1.8. Adding a Volume Group

Adding a Volume Group

The following dialog lists all partitions with either the “Linux LVM” or “Linux native” type. No swap or DOS partitions are shown. If a partition is already assigned to a volume group, the name of the volume group is shown in the list. Unassigned partitions are indicated by “--”.

The volume group currently being edited can be modified in the selection box to the upper left. The buttons in the upper right enable creation of additional volume groups and deletion of existing volume groups. Only volume groups to which no partitions are assigned can be deleted. No more than one volume group needs to be created for a normally installed SUSE LINUX system. A partition assigned to a volume group is also referred to as a physical volume (PV).

Figure 1.9. Partition List

Partition List

To add a previously unassigned partition to the selected volume group, first click the partition then Add Volume. At this point, the name of the volume group is entered next to the selected partition. Assign all partitions reserved for LVM to a volume group. Otherwise, the space on the partition will remain unused. Before exiting the dialog, every volume group must be assigned at least one physical volume.

1.8.1.4. Logical Volumes

This dialog is responsible for managing logical volumes. Assign one logical volume to each volume group. To create a striping array when you create the logical volumes, first create the LV with the largest number of stripes. 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 physical volumes. If only PVs are available, an LV with three stripes is impossible.

Figure 1.10. Logical Volume Management

Logical Volume Management

Normally, a file system is created on a logical volume (e.g., reiserfs, ext2) and is then designated a mount point. The files stored on this logical volume can be found at this mount point on the installed system. All normal Linux partitions to which a mount point is assigned, all swap partitions, and all already existing logical volumes are listed here.

[Warning]Warning

Using LVM might be associated with increased risk factors, 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.

If you have already configured LVM on your system, the existing logical volumes must be entered now. Before continuing, assign the appropriate mount point to these logical volumes. If you are configuring LVM on a system for the first time, no logical volumes are displayed in this screen yet. A logical volume must be generated for each mount point (using Add). Also set the size, the file system type (e.g., reiserfs or ext2), and the mount point (e.g., /var, /usr, /home).

Figure 1.11. Creating Logical Volumes

Creating Logical Volumes

If you have created several volume groups, switch between individual volume groups by means of the selection list at the top left. Added logical volumes are listed in the volume group displayed there. After creating all the logical volumes required, exit the dialog. If you are still in the installation process, you can proceed with the software selection.