Chapter 4. Basic logical volume management
With LVM, you can do the following tasks:
- Create new logical volumes to extend storage capabilities of your system
- Extend existing volumes and thin pools to accommodate growing data
- Rename volumes for better organization
- Reduce volumes to free up unused space
- Safely remove volumes when they are no longer needed
- Activate or deactivate volumes to control the system’s access to its data
4.1. Overview of logical volume features
With the Logical Volume Manager (LVM), you can manage disk storage in a flexible and efficient way that traditional partitioning schemes cannot offer. Below is a summary of key LVM features that are used for storage management and optimization.
- Concatenation
- Concatenation involves combining space from one or more physical volumes into a singular logical volume, effectively merging the physical storage.
- Striping
- Striping optimizes data I/O efficiency by distributing data across multiple physical volumes. This method enhances performance for sequential reads and writes by allowing parallel I/O operations.
- RAID
- LVM supports RAID levels 0, 1, 4, 5, 6, and 10. When you create a RAID logical volume, LVM creates a metadata subvolume that is one extent in size for every data or parity subvolume in the array.
- Thin provisioning
- Thin provisioning enables the creation of logical volumes that are larger than the available physical storage. With thin provisioning, the system dynamically allocates storage based on actual usage instead of allocating a predetermined amount upfront.
- Snapshots
- With LVM snapshots, you can create point-in-time copies of logical volumes. A snapshot starts empty. As changes occur on the original logical volume, the snapshot captures the pre-change states through copy-on-write (CoW), growing only with changes to preserve the state of the original logical volume.
- Caching
- LVM supports the use of fast block devices, such as SSD drives as write-back or write-through caches for larger slower block devices. Users can create cache logical volumes to improve the performance of their existing logical volumes or create new cache logical volumes composed of a small and fast device coupled with a large and slow device.
4.2. Creating logical volumes
LVM provides a flexible approach to handling disk storage by abstracting the physical layer into logical volumes that can be created and adjusted based on your needs.
4.2.1. Creating a linear (thick) logical volume
With linear logical volumes (LVs), you can merge multiple physical storage units into one virtual storage space. You can easily expand or reduce linear LVs to accommodate the data requirements.
Prerequisites
- Administrative access.
-
The
lvm2
package is installed. - The volume group is created. For more information, see Creating LVM volume group.
Procedure
List the names of volume groups and their size:
# vgs -o vg_name,vg_size VG VSize VolumeGroupName 30.75g
Create a linear LV:
# lvcreate --name LogicalVolumeName --size VolumeSize VolumeGroupName
Replace LogicalVolumeName with the name of the LV. Replace VolumeSize with the size for the LV. If no size suffix is provided the command defaults to MB. Replace VolumeGroupName with the name of the volume group.
Verification
Verify that the linear LV is created:
# lvs -o lv_name,seg_type LV Type LogicalVolumeName linear
Additional resources
-
The
vgs(8)
,lvs(8)
,lvcreate(8)
man pages
4.2.2. Creating a striped logical volume
With striped logical volume (LV), you can distribute the data across multiple physical volumes (PVs), potentially increasing the read and write speed by utilizing the bandwidth of multiple disks simultaneously.
When creating a striped LV, it is important to consider the stripe number and size. The stripe number is the count of PVs across which data is distributed. Increasing the stripe number can enhance performance by utilizing multiple disks concurrently. Stripe size is the size of the data chunk written to each disk in the stripe set before moving to the next disk and is specified in kilobytes (KB). The optimal stripe size depends on your workload and the filesystem block size. The default is 64KB and can be adjusted.
Prerequisites
- Administrative access.
Procedure
List the names of volume groups and their size:
# vgs -o vg_name,vg_size VG VSize VolumeGroupName 30.75g
Create a striped LV:
# lvcreate --stripes NumberOfStripes --stripesize StripeSize --size LogicalVolumeSize --name LogicalVolumeName VolumeGroupName
Replace NumberOfStripes with the number of stripes. Replace StripeSize with the stripe size in kilobytes. The
--stripesize
is not a required option. If you do not specify the stripe size it defaults to 64KB. Replace LogicalVolumeName with the name of the LV. Replace VolumeGroupName with the name of the volume group.
Verification
Verify that the striped LV is created:
# lvs -o lv_name,seg_type LV Type LogicalVolumeName striped
Additional resources
-
The
vgs(8)
lvs(8)
,lvcreate(8)
man pages
4.2.3. Creating a RAID logical volume
RAID logical volumes enable you to use multiple disks for redundancy and performance. LVM supports various RAID levels, including RAID0, RAID1, RAID4, RAID5, RAID6, and RAID10.
With LVM you can create striped RAIDs (RAID0, RAID4, RAID5, RAID6), mirrored RAID (RAID1), or a combination of both (RAID10).
RAID 4, RAID 5, and RAID 6 offer fault tolerance by storing parity data that can be used to reconstruct lost information in case of a disk failure.
When creating RAID LVs, place each stripe on a separate PV. The number of stripes equals to the number of PVs that should be in the volume group (VG).
RAID level | Type | Parity | Minimum number of devices | Minimum stripe number |
---|---|---|---|---|
RAID0 | Striping | None | 2 | 2 |
RAID1 | Mirroring | None | 2 | - |
RAID4 | Striping | Uses first device to store parity | 3 | 2 |
RAID5 | Striping | Uses an extra device to store parity | 3 | 2 |
RAID6 | Striping | Uses two extra devices to store parity | 5 | 3 |
RAID10 | Striping and mirroring | None | 4 | 2 |
Prerequisites
- Administrative access.
Procedure
List the names of volume groups and their size:
# vgs -o vg_name,vg_size VG VSize VolumeGroupName 30.75g
Create a RAID LV:
To create a striped raid, use:
# lvcreate --type raidlevel --stripes NumberOfStripes --stripesize StripeSize --size Size --name LogicalVolumeName VolumeGroupName
Replace level with the RAID level 0, 4, 5, or 6. Replace NumberOfStripes with the number of stripes. Replace StripeSize with the stripe size in kilobytes. Replace Size with the size of the LV. Replace LogicalVolumeName with the name of the LV.
To create a mirrored RAID, use:
# lvcreate --type raid1 --mirrors MirrorsNumber --size Size --name LogicalVolumeName VolumeGroupName
Replace MirrorsNumber with the number of mirrors. Replace Size with the size of the LV. Replace LogicalVolumeName with the name of the LV.
To create a mirrored and striped RAID, use:
# lvcreate --type raid10 --mirrors MirrorsNumber --stripes NumberOfStripes --stripesize StripeSize --size Size --name LogicalVolumeName VolumeGroupName
Replace MirrorsNumber with the number of mirrors. Replace NumberOfStripes with the number of stripes. Replace StripeSize with the stripe size in kilobytes. Replace Size with the size of the LV. Replace LogicalVolumeName with the name of the LV.
Verification
Verify that the RAID LV is created:
# lvs -o lv_name,seg_type LV Type LogicalVolumeName raid0
Additional resources
-
lvmraid(7)
,vgs(8)
,lvs(8)
,lvcreate(8)
man pages
4.2.4. Creating a thin logical volume
Under thin provisioning, physical extents (PEs) from a volume group (VG) are allocated to create a thin pool with a specific physical size. Logical volumes (LVs) are then allocated from this thin pool based on a virtual size, not limited by the pool’s physical capacity. With this, the virtual size of each thin LV can exceed the actual size of the thin pool leading to over-provisioning, when the collective virtual sizes of all thin LVs surpasses the physical capacity of the thin pool. Therefore, it is essential to monitor both logical and physical usage closely to avoid running out of space and outages.
Thin provisioning optimizes storage efficiency by allocating space as needed, lowering initial costs and improving resource utilization. However, when using thin LVs, beware of the following drawbacks:
- Improper discard handling can block the release of unused storage space, causing full allocation of the space over time.
- Copy on Write (CoW) operation can be slower on file systems with snapshots.
- Data blocks can be intermixed between multiple file systems leading to random access limitations.
Prerequisites
- Administrative access.
- You have created a physical volume. For more information, see Creating LVM physical volume.
- You have created a volume group. For more information, see Creating LVM volume group.
- You have created a logical volume. For more information, see Creating logical volumes.
Procedure
List the names of volume groups and their size:
# vgs -o vg_name,vg_size VG VSize VolumeGroupName 30.75g
Create a thin pool:
# lvcreate --type thin-pool --size PoolSize --name ThinPoolName VolumeGroupName
Replace PoolSize with the maximum amount of disk space the thin pool can use. Replace ThinPoolName with the name for the thin pool. Replace VolumeGroupName with the name of the volume group.
Create a thin LV:
# lvcreate --type thin --virtualsize MaxVolumeSize --name ThinVolumeName --thinpool ThinPoolName VolumeGroupName
Replace MaxVolumeSize with the maximum size the volume can grow to within the thin pool. Replace ThinPoolName with the name for the thin pool. Replace VolumeGroupName with the name of the volume group.
NoteYou can create other thin LVs within the same thin pool.
Verification
Verify that the thin LV is created:
# lvs -o lv_name,seg_type LV Type ThinPoolName thin-pool ThinVolumeName thin
Additional resources
-
The
lvs(8)
,lvcreate(8)
man pages
4.2.5. Creating a VDO logical volume
VDO logical volumes (LVs) use the Virtual Data Optimizer (VDO) technology to enhance storage efficiency. VDO LVs have both a virtual size and a physical size. The virtual size refers to the total amount of storage presented to users and applications. The physical size is the actual amount of physical storage allocated from the VG and consumed by the VDO pool.
The virtual size of a VDO LV is generally larger than the physical size of the VDO pool, making it over-provisioned. Due to over-provisioning the physical space in the VDO pool needs to be closely monitored and extended when needed.
A VDO LV and a VDO pool are created as a pair, and always exist as a pair.
Prerequisites
- Administrative access.
Procedure
List the names of volume groups and their size:
# vgs -o vg_name,vg_size VG VSize VolumeGroupName 30.75g
Create a VDO LV:
# lvcreate --type vdo --virtualsize VolumeSize --size PhysicalPoolSize --name VDOVolumeName --vdopool VDOPoolName VolumeGroupName
Replace the VolumeSize with the size for the volume. Replace the PhysicalPoolSize with the size for the pool. Replace the VDOVolumeName with the name for your VDO volume. Replace the VDOPoolName with the name for your VDO pool. Replace VolumeGroupName with the name of the volume group.
Verification
Verify that the VDO LV is created:
# lvs -o name,seg_type,size LV Type LSize VDOPoolName vdo-pool 5.00g VDOVolumeName vdo 5.00g
Additional resources
-
The
vgs(8)
,lvs(8)
,lvcreate(8)
man pages
4.3. Resizing logical volumes
With Logical Volume Manager (LVM), you can resize logical volumes (LVs) as needed without affecting the data stored on them.
4.3.1. Extending a linear logical volume
You can extend linear (thick) LVs and their snapshots with the lvextend
command.
Prerequisites
- Administrative access.
Procedure
Ensure your volume group has enough space to extend your LV:
# lvs -o lv_name,lv_size,vg_name,vg_size,vg_free LV LSize VG VSize VFree LogicalVolumeName 1.49g VolumeGroupName 30.75g 29.11g
Extend the linear LV and resize the file system:
# lvextend --size +AdditionalSize --resizefs VolumeGroupName/LogicalVolumeName
Replace AdditionalSize with how much space to add to the LV. The default unit of measurement is megabytes, but you can specify other units. Replace VolumeGroupName with the name of the volume group. Replace LogicalVolumeName with the name of the thin volume.
Verification
Verify that the linear LV is extended:
# lvs -o lv_name,lv_size LV LSize NewLogicalVolumeName 6.49g
4.3.2. Extending a thin logical volume
You can extend the thin logical volume (LV) with the lvextend
command.
Prerequisites
- Administrative access.
Procedure
Ensure the thin pool has enough space for the data you plan to add:
# lvs -o lv_name,lv_size,data_percent LV LSize Data% MyThinPool 20.10g 3.21 ThinVolumeName 1.10g 4.88
Extend the thin LV and resize the file system:
# lvextend --size +AdditionalSize --resizefs VolumeGroupName/ThinVolumeName
Replace AdditionalSize with how much space to add to the LV. The default unit of measurement is megabytes, but you can specify other units. Replace VolumeGroupName with the name of the volume group. Replace ThinVolumeName with the name of the thin volume.
Verification
Verify the thin LV is extended:
# lvs -o lv_name,lv_size,data_percent LV LSize Data% MyThinPool 20.10g 3.21 ThinVolumeName 6.10g 0.43
4.3.3. Extending a thin pool
The virtual size of thin logical volumes can exceed the physical capacity of the thin pool resulting in over-provisioning. To prevent running out of space, you must monitor and periodically extend the capacity of the thin pool.
The data_percent
metric indicates the percentage of the allocated data space that the thin pool currently uses. The metadata_percent
metric reflects the percentage of space used for storing metadata, which is essential for managing the mappings within the thin pool.
Monitoring these metrics is vital to ensure efficient storage management and to avoid capacity issues.
LVM provides the option to manually extend the data or metadata capacity as needed. Alternatively, you can enable monitoring and automate the expansion of your thin pool.
4.3.3.1. Manually extending a thin pool
Logical Volume Manager (LVM) provides the option to manually extend the data segment, the metadata segment, or the thin pool.
4.3.3.1.1. Extending a thin pool
You can use the lvextend
command to extend the thin pool.
Prerequisites
- Administrative access.
Procedure
Display the data and metadata space used:
# lvs -o lv_name,seg_type,data_percent,metadata_percent LV Type Data% Meta% ThinPoolName thin-pool 97.66 26.86 ThinVolumeName thin 48.80
Extend the thin pool:
# lvextend -L Size VolumeGroupName/ThinPoolName
Replace Size with the new size for your thin pool. Replace VolumeGroupName with the name of the volume group. Replace ThinPoolName with the name of the thin pool.
The data size will be extended. The metadata size will be extended if necessary.
Verification
Verify that the thin pool is extended:
# lvs -o lv_name,seg_type,data_percent,metadata_percent LV Type Data% Meta% ThinPoolName thin-pool 24.41 16.93 ThinVolumeName thin 24.41
Additional resources
-
The
lvs(8)
,lvextend(8)
man pages -
lvs -o help
4.3.3.1.2. Extending a thin pool data segment
You can use the lvextend
command to extend the data_percent
segment.
Prerequisites
- Administrative access.
Procedure
Display the
data_percent
segment:# lvs -o lv_name,seg_type,data_percent LV Type Data% ThinPoolName thin-pool 93.87
Extend the
data_percent
segment:# lvextend -L Size VolumeGroupName/ThinPoolName_tdata
Replace Size with the size for your data segment. Replace VolumeGroupName with name of the volume group. Replace ThinPoolName with the name of the thin pool.
Verification
Verify that the
data_percent
segment is extended:# lvs -o lv_name,seg_type,data_percent LV Type Data% ThinPoolName thin-pool 40.23
Additional resources
-
The
lvs(8)
,lvextend(8)
man pages -
lvs -o help
4.3.3.1.3. Extending a thin pool metadata segment
You can use the lvextend
command to extend the metadata_percent
segment.
Prerequisites
- Administrative access.
Procedure
Display the
metadata_percent
segment:# lvs -o lv_name,seg_type,metadata_percent LV Type Meta% ThinPoolName thin-pool 75.00
Extend the
metadata_percent
segment:# lvextend -L Size VolumeGroupName/ThinPoolName_tmeta
Replace Size with the size for your metadata segment. Replace VolumeGroupName with name of the volume group. Replace ThinPoolName with the name of the thin pool.
Verification
Verify that the
metadata_percent
segment is extended:# lvs -o lv_name,seg_type,metadata_percent LV Type Meta% ThinPoolName thin-pool 0.19
Additional resources
-
The
lvs(8)
,lvextend(8)
man pages -
lvs -o help
4.3.3.2. Automatically extending a thin pool
You can automate the expansion of your thin pool by enabling monitoring and setting the thin_pool_autoextend_threshold
and the thin_pool_autoextend_percent
configuration parameters.
Prerequisites
- Administrative access.
Procedure
Check if the thin pool is monitored:
# lvs -o lv_name,vg_name,seg_monitor LV VG Monitor ThinPoolName VolumeGroupName not monitored
Enable thin pool monitoring with the
dmeventd
daemon:# lvchange --monitor y VolumeGroupName/ThinPoolName
Replace VolumeGroupName with the name of the volume group. Replace ThinPoolName with the name of the thin pool.
-
As the
root
user, open the/etc/lvm/lvm.conf
file in an editor of your choice. Uncomment the
thin_pool_autoextend_threshold
andthin_pool_autoextend_percent
lines and set each parameter to a required value:thin_pool_autoextend_threshold = 70 thin_pool_autoextend_percent = 20
thin_pool_autoextend_threshold
determines the percentage at which LVM starts to auto-extend the thin pool. For example, setting it to 70 means LVM will try to extend the thin pool when it reaches 70% capacity.thin_pool_autoextend_percent
specifies by what percentage the thin pool should be extended when it reaches threshold. For example, setting it to 20 means the thin pool will be increased by 20% of its current size.- Save the changes and exit the editor.
Restart the
lvm2-monitor
:# systemctl restart lvm2-monitor
Additional resources
-
The
lvs(8)
,lvchange(8)
,dmeventd(8)
man pages
4.3.4. Extending a VDO Pool
It is crucial to monitor and periodically extend the capacity of the VDO pool to prevent running out of space.
Logical Volume Manager (LVM) provides the option to manually extend the VDO pool capacity as needed. Alternatively, you can enable monitoring and automate the extension of your VDO pool.
4.3.4.1. Manually extending a VDO Pool
Use the lvextend
command to extend a VDO pool.
Prerequisites
- Administrative access.
Procedure
Display the current VDO usage:
# lvs -o lv_name,vg_name,lv_size,data_percent VolumeGroupName/VDOPoolName LV VG LSize Data% VDOPoolName VolumeGroupName 5.00g 60.03
Replace VolumeGroupName with the name of the volume group. Replace the VDOPoolName with the name of the VDO pool.
Extend the VDO Pool:
# lvextend --size PhysicalSize VolumeGroupName/VDOPoolName
Replace PhysicalSize with the new physical size. Replace VolumeGroupName with the name of the volume group. Replace the VDOPoolName with the name of the VDO pool.
Verification
Verify that the VDO pool is extended:
# lvs -o lv_name,vg_name,lv_size,data_percent VolumeGroupName/VDOPoolName LV VG LSize Data% VDOPoolName VolumeGroupName 10.00g 30.02
Additional resources
-
The
lvs(8)
,lvextend(8)
man pages
4.3.4.2. Automatically extending a VDO Pool
You can automate the expansion of your Virtual Data Optimizer (VDO) pool by enabling monitoring and setting the vdo_pool_autoextend_threshold
and the vdo_pool_autoextend_percent
parameters.
Prerequisites
- Administrative access.
Procedure
Check if the VDO pool is monitored:
# lvs -o name,seg_monitor VolumeGroupName/VDOPoolName LV VG Monitor VDOPoolName VolumeGroupName not monitored
Replace VolumeGroupName with the name of the volume group. Replace VDOPoolName with the name of the VDO pool.
Enable VDO pool monitoring with the
dmeventd
daemon:# lvchange --monitor y VolumeGroupName/VDOPoolName
Replace VolumeGroupName with the name of the volume group. Replace VDOPoolName with the name of the VDO pool.
-
As the
root
user, open the/etc/lvm/lvm.conf
file in an editor of your choice. Uncomment the
vdo_pool_autoextend_percent
andvdo_pool_autoextend_threshold
lines and set each parameter to a required value:vdo_pool_autoextend_threshold = 70 vdo_pool_autoextend_percent = 20
vdo_pool_autoextend_threshold
determines the percentage at which LVM starts to auto-extend the VDO pool. For example, setting it to 70 means LVM tries to extend the VDO pool when it reaches 70% capacity.vdo_pool_autoextend_percent
specifies by what percentage the VDO pool should be extended when it reaches the threshold. For example, setting it to 20 means the VDO pool will be increased by 20% of its current size.- Save the changes and exit the editor.
Restart the
lvm2-monitor
:# systemctl restart lvm2-monitor
Additional resources
-
The
lvs(8)
,lvchange(8)
,dmeventd(8)
man pages
4.3.5. Shrinking logical volumes
When the size of the LV is reduced, the freed up logical extents are returned to the volume group and then can be used by other LVs.
Data stored in the reduced area is lost. Always back up the data and resize the file system before proceeding.
Prerequisites
- Administrative access.
Procedure
List the logical volumes and their volume groups:
# lvs -o lv_name,vg_name,lv_size LV VG LSize LogicalVolumeName VolumeGroupName 6.49g
Check where the logical volume is mounted:
# findmnt -o SOURCE,TARGET /dev/VolumeGroupName/LogicalVolumeName SOURCE TARGET /dev/mapper/VolumeGroupName-NewLogicalVolumeName /MountPoint
Replace /dev/VolumeGroupName/LogicalVolumeName with the path to your logical volume.
Unmount the logical volume:
# umount /MountPoint
Replace /MountPoint with the mounting point for your logical volume.
Check and repair any file system errors:
# e2fsck -f /dev/VolumeGroupName/LogicalVolumeName
Resize the LV and the file system:
# lvreduce --size TargetSize --resizefs VolumeGroupName/LogicalVolumeName
Replace TargetSize with the new size of the LV. Replace VolumeGroupName/LogicalVolumeName with the path to your logical volume.
Remount the file system:
# mount -o remount /MountPoint
Replace /MountPoint with the mounting point for your file system.
Verification
Verify the space usage of the file system:
# df -hT /MountPoint/ Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VolumeGroupName-NewLogicalVolumeName ext4 2.9G 139K 2.7G 1% /MountPoint
Replace /MountPoint with the mounting point for your logical volume.
Verify the size of the LV:
# lvs -o lv_name,lv_size LV LSize NewLogicalVolumeName 4.00g
4.4. Renaming logical volumes
You can rename an existing logical volume, including snapshots, using the lvrename
command.
Prerequisites
- Administrative access.
Procedure
List the logical volumes and their volume groups:
# lvs -o lv_name,vg_name LV VG LogicalVolumeName VolumeGroupName
Rename the logical volume:
# lvrename VolumeGroupName/LogicalVolumeName VolumeGroupName/NewLogicalVolumeName
Replace VolumeGroupName with name of the volume group. Replace LogicalVolumeName with the name of the logical volume. Replace NewLogicalVolumeName with the new logical volume name.
Verification
Verify that the logical volume is renamed:
# lvs -o lv_name LV NewLogicalVolumeName
Additional resources
-
lvrename(8)
man page on your system
4.5. Removing logical volumes
You can remove an existing logical volume, including snapshots, using the lvremove
command.
Prerequisites
- Administrative access.
Procedure
List the logical volumes and their paths:
# lvs -o lv_name,lv_path LV Path LogicalVolumeName /dev/VolumeGroupName/LogicalVolumeName
Check where the logical volume is mounted:
# findmnt -o SOURCE,TARGET /dev/VolumeGroupName/LogicalVolumeName SOURCE TARGET /dev/mapper/VolumeGroupName-LogicalVolumeName /MountPoint
Replace /dev/VolumeGroupName/LogicalVolumeName with the path to your logical volume.
Unmount the logical volume:
# umount /MountPoint
Replace /MountPoint with the mounting point for your logical volume.
Remove the logical volume:
# lvremove VolumeGroupName/LogicalVolumeName
Replace VolumeGroupName/LogicalVolumeName with the path to your logical volume.
Additional resources
-
lvs(8)
,lvremove(8)
man pages on your system
4.6. Activating logical volumes
You can activate the logical volume with the lvchange
command.
Prerequisites
- Administrative access.
Procedure
List the logical volumes, their volume groups, and their paths:
# lvs -o lv_name,vg_name,lv_path LV VG Path LogicalVolumeName VolumeGroupName VolumeGroupName/LogicalVolumeName
Activate the logical volume:
# lvchange --activate y VolumeGroupName/LogicalVolumeName
Replace VolumeGroupName with the name of the volume group. Replace LogicalVolumeName with the name of the logical volume.
NoteWhen activating a thin LV that was created as a snapshot of another LV, you might need to use the
--ignoreactivationskip
option to activate it.
Verification
Verify that the LV is active:
# lvdisplay VolumeGroupName/LogicalVolumeName ... LV Status available
Replace VolumeGroupName with the name of the volume group. Replace LogicalVolumeName with the name of the logical volume.
Additional resources
-
The
lvs(8)
lvchange(8)
,lvdisplay(8)
man pages
4.7. Deactivating logical volumes
By default, when you create a logical volume, it is in an active state. You can deactivate the logical volume with the lvchange
command.
Deactivating a logical volume with active mounts or in use can lead to data inconsistencies and system errors.
Prerequisites
- Administrative access.
Procedure
List the logical volumes, their volume groups, and their paths:
# lvs -o lv_name,vg_name,lv_path LV VG Path LogicalVolumeName VolumeGroupName /dev/VolumeGroupName/LogicalVolumeName
Check where the logical volume is mounted:
# findmnt -o SOURCE,TARGET /dev/VolumeGroupName/LogicalVolumeName SOURCE TARGET /dev/mapper/VolumeGroupName-LogicalVolumeName /MountPoint
Replace /dev/VolumeGroupName/LogicalVolumeName with the path to your logical volume.
Unmount the logical volume:
# umount /MountPoint
Replace /MountPoint with the mounting point for your logical volume.
Deactivate the logical volume:
# lvchange --activate n VolumeGroupName/LogicalVolumeName
Replace VolumeGroupName with name of the volume group. Replace LogicalVolumeName with the name of the logical volume.
Verification
Verify that the LV is not active:
# lvdisplay VolumeGroupName/LogicalVolumeName ... LV Status NOT available
Replace VolumeGroupName with name of the volume group. Replace LogicalVolumeName with the name of the logical volume.
Additional resources
-
The
lvs(8)
lvchange(8)
,lvdisplay(8)
man pages