Creating an LVM Thin Pool with Prioritization of Two PVs: Fast PV on /dev/sdb3, Slow PV on /dev/sda1
In this article, we will discuss how to create an LVM thin pool with prioritization of two physical volumes (PVs), where the fast PV is on /dev/sdb3 and the slow PV is on /dev/sda1. We will also cover the key concepts related to LVM thin pools and their prioritization.
What is an LVM Thin Pool?
LVM (Logical Volume Manager) thin pool is a storage management feature that allows the creation of thinly provisioned logical volumes. Thin provisioning is a disk space allocation technique that allows you to allocate disk space to logical volumes as needed, rather than upfront. This can help you save disk space and reduce the time it takes to create new logical volumes.
An LVM thin pool is a special type of volume group that contains thinly provisioned logical volumes. Thin pools are created using physical volumes (PVs) as their backing storage. When you create a thinly provisioned logical volume in a thin pool, the logical volume only consumes the actual disk space it needs, rather than the entire allocated disk space.
Why Prioritize PVs in a Thin Pool?
Prioritizing PVs in a thin pool allows you to specify which PVs should be used first when allocating disk space to thinly provisioned logical volumes. This can be useful in situations where you have multiple PVs with different performance characteristics, such as a fast PV and a slow PV. By prioritizing the fast PV, you can ensure that the logical volumes created in the thin pool will use the fast PV for their disk space allocation, resulting in better performance.
Creating an LVM Thin Pool with Prioritized PVs
To create an LVM thin pool with prioritized PVs, you can use the following steps:
- Create a volume group (VG) using the two PVs, with the fast PV having a higher priority than the slow PV. This can be done using the
vgcreatecommand, as shown below:
# vgcreate -s 512M --priority 100 vg\_thinpool /dev/sdb3 /dev/sda1
In this example, the volume group is named vg\_thinpool, the allocation size is set to 512 MB, and the priority of the fast PV (/dev/sdb3) is set to 100, while the priority of the slow PV (/dev/sda1) is set to the default value of 0.
- Create a thin pool using the volume group. This can be done using the
lvcreatecommand, as shown below:
# lvcreate -L 1T -n thinpool vg\_thinpool
In this example, the thin pool is named thinpool and has a size of 1 TB.
Using the Thin Pool
Once the thin pool has been created, you can create thinly provisioned logical volumes in it using the lvcreate command, as shown below:
# lvcreate -L 100G -n mylv vg\_thinpool
In this example, a thinly provisioned logical volume named mylv with a size of 100 GB is created in the thin pool.
- LVM thin pools allow the creation of thinly provisioned logical volumes.
- Prioritizing PVs in a thin pool allows you to specify which PVs should be used first when allocating disk space to thinly provisioned logical volumes.
- You can create an LVM thin pool with prioritized PVs using the
vgcreateandlvcreatecommands.