The LVM utility allows you to manage logical volumes within X windows or graphically. You can access the application by selecting from your menu panel
system-config-lvm from a terminal.
> > . Alternatively you can start the Logical Volume Management utility by typing
In the example used in this section, the following are the details for the volume group that was created during the installation:
/boot - (Ext3) file system. Displayed under 'Uninitialized Entities'. (DO NOT initialize this partition).
LogVol00 - (LVM) contains the (/) directory (312 extents).
LogVol02 - (LVM) contains the (/home) directory (128 extents).
LogVol03 - (LVM) swap (28 extents).
The logical volumes above were created in disk entity
was created in
. The system also consists of 'Uninitialized Entities' which are illustrated in Figure 11.17, “Uninitialized Entities”
. The figure below illustrates the main window in the LVM utility. The logical and the physical views of the above configuration are illustrated below. The three logical volumes exist on the same physical volume (hda2).
Figure 11.13. Main LVM Window
The figure below illustrates the physical view for the volume. In this window, you can select and remove a volume from the volume group or migrate extents from the volume to another volume group. Steps to migrate extents are discussed in Figure 11.22, “Migrate Extents”
Figure 11.14. Physical View Window
The figure below illustrates the logical view for the selected volume group. The logical volume size is also indicated with the individual logical volume sizes illustrated.
Figure 11.15. Logical View Window
On the left side column, you can select the individual logical volumes in the volume group to view more details about each. In this example the objective is to rename the logical volume name for 'LogVol03' to 'Swap'. To perform this operation select the respective logical volume and click on the
button. This will display the Edit Logical Volume window from which you can modify the Logical volume name, size (in extents) and also use the remaining space available in a logical volume group. The figure below illustrates this.
Please note that this logical volume cannot be changed in size as there is currently no free space in the volume group. If there was remaining space, this option would be enabled (see Figure 11.31, “Edit logical volume”
). Click on the button to save your changes (this will remount the volume). To cancel your changes click on the button. To revert to the last snapshot settings click on the button. A snapshot can be created by clicking on the button on the LVM utility window. If the selected logical volume is in use by the system (for example) the
(root) directory, this task will not be successful as the volume cannot be unmounted.
Figure 11.16. Edit Logical Volume
11.5.1. Utilizing uninitialized entities
'Uninitialized Entities' consist of unpartitioned space and non LVM file systems. In this example partitions 3, 4, 5, 6 and 7 were created during installation and some unpartitioned space was left on the hard disk. Please view each partition and ensure that you read the 'Properties for Disk Entity' on the right column of the window to ensure that you do not delete critical data. In this example partition 1 cannot be initialized as it is
/boot. Uninitialized entities are illustrated below.
Figure 11.17. Uninitialized Entities
In this example, partition 3 will be initialized and added to an existing volume group. To initialize a partition or unpartioned space, select the partition and click on the
button. Once initialized, a volume will be listed in the 'Unallocated Volumes' list.
11.5.2. Adding Unallocated Volumes to a volume group
Once initialized, a volume will be listed in the 'Unallocated Volumes' list. The figure below illustrates an unallocated partition (Partition 3). The respective buttons at the bottom of the window allow you to:
create a new volume group,
add the unallocated volume to an existing volume group,
remove the volume from LVM.
To add the volume to an existing volume group, click on the button.
Figure 11.18. Unallocated Volumes
Clicking on the
button will display a pop up window listing the existing volume groups to which you can add the physical volume you are about to initialize. A volume group may span across one or more hard disks. In this example only one volume group exists as illustrated below.
Figure 11.19. Add physical volume to volume group
Once added to an existing volume group the new logical volume is automatically added to the unused space of the selected volume group. You can use the unused space to:
The figure below illustrates the logical view of 'VolGroup00' after adding the new volume group.
Figure 11.20. Logical view of volume group
In the figure below, the uninitialized entities (partitions 3, 5, 6 and 7) were added to 'VolGroup00'.
Figure 11.21. Logical view of volume group
11.5.3. Migrating extents
To migrate extents from a physical volume, select the volume and click on the Section 11.5.6, “Extending a volume group”
). If a sufficient number of free extents is detected in the volume group, a pop up window will be displayed from which you can select the destination for the extents or automatically let LVM choose the physical volumes (PVs) to migrate them to. This is illustrated below.
button. Please note that you need to have a sufficient number of free extents to migrate extents within a volume group. An error message will be displayed if you do not have a sufficient number of free extents. To resolve this problem, please extend your volume group (see
Figure 11.22. Migrate Extents
The figure below illustrates a migration of extents in progress. In this example, the extents were migrated to 'Partition 3'.
Figure 11.23. Migrating extents in progress
Once the extents have been migrated, unused space is left on the physical volume. The figure below illustrates the physical and logical view for the volume group. Please note that the extents of LogVol00 which were initially in hda2 are now in hda3. Migrating extents allows you to move logical volumes in case of hard disk upgrades or to manage your disk space better.
Figure 11.24. Logical and physical view of volume group
11.5.4. Adding a new hard disk using LVM
button. For more details, see
Figure 11.25. Uninitialized hard disk
11.5.5. Adding a new volume group
Once initialized, LVM will add the new volume to the list of unallocated volumes where you can add it to an existing volume group or create a new volume group. You can also remove the volume from LVM. The volume if removed from LVM will be listed in the list of 'Uninitialized Entities' as illustrated in Figure 11.25, “Uninitialized hard disk”
. In this example, a new volume group was created as illustrated below.
Figure 11.26. Create new volume group
Once created a new volume group will be displayed in the list of existing volume groups as illustrated below. The logical view will display the new volume group with unused space as no logical volumes have been created. To create a logical volume, select the volume group and click on the
button as illustrated below. Please select the extents you wish to use on the volume group. In this example, all the extents in the volume group were used to create the new logical volume.
Figure 11.27. Create new logical volume
The figure below illustrates the physical view of the new volume group. The new logical volume named 'Backups' in this volume group is also listed.
Figure 11.28. Physical view of new volume group
11.5.6. Extending a volume group
In this example, the objective was to extend the new volume group to include an uninitialized entity (partition). This was to increase the size or number of extents for the volume group. To extend the volume group, click on the Figure 11.25, “Uninitialized hard disk”
). In the example, the disk entity (partition)
was selected as illustrated below.
button. This will display the 'Extend Volume Group' window as illustrated below. On the 'Extend Volume Group' window, you can select disk entities (partitions) to add to the volume group. Please ensure that you check the contents of any 'Uninitialized Disk Entities' (partitions) to avoid deleting any critical data (see
Figure 11.29. Select disk entities
Once added, the new volume will be added as 'Unused Space' in the volume group. The figure below illustrates the logical and physical view of the volume group after it was extended.
Figure 11.30. Logical and physical view of an extended volume group
11.5.7. Editing a Logical Volume
The LVM utility allows you to select a logical volume in the volume group and modify its name, size and specify filesystem options. In this example, the logical volume named 'Backups" was extended onto the remaining space for the volume group.
Clicking on the
button will display the 'Edit Logical Volume' popup window from which you can edit the properties of the logical volume. On this window, you can also mount the volume after making the changes and mount it when the system is rebooted. Please note that you should indicate the mount point. If the mount point you specify does not exist, a popup window will be displayed prompting you to create it. The 'Edit Logical Volume' window is illustrated below.
Figure 11.31. Edit logical volume
If you wish to mount the volume, select the 'Mount' checkbox indicating the preferred mount point. To mount the volume when the system is rebooted, select the 'Mount when rebooted' checkbox. In this example, the new volume will be mounted in
/mnt/backups. This is illustrated in the figure below.
Figure 11.32. Edit logical volume - specifying mount options
The figure below illustrates the logical and physical view of the volume group after the logical volume was extended to the unused space. Please note in this example that the logical volume named 'Backups' spans across two hard disks. A volume can be striped across two or more physical devices using LVM.
Figure 11.33. Edit logical volume