前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS7中配置LVM精简卷(Thinly-Provisioned Logical Volumes)

CentOS7中配置LVM精简卷(Thinly-Provisioned Logical Volumes)

作者头像
yuanfan2012
发布2019-11-12 18:21:15
4.9K0
发布2019-11-12 18:21:15
举报
文章被收录于专栏:WalkingCloudWalkingCloud

LVM精简卷(Thinly-Provisioned Logical Volumes)的概念:

As of the Red Hat Enterprise Linux 6.4 release, logical volumes can be thinly provisioned. This allows you to create logical volumes that are larger than the available extents. Using thin provisioning, you can manage a storage pool of free space, known as a thin pool, which can be allocated to an arbitrary number of devices when needed by applications. You can then create devices that can be bound to the thin pool for later allocation when an application actually writes to the logical volume. The thin pool can be expanded dynamically when needed for cost-effective allocation of storage space.

By using thin provisioning, a storage administrator can over-commit the physical storage, often avoiding the need to purchase additional storage. For example, if ten users each request a 100GB file system for their application, the storage administrator can create what appears to be a 100GB file system for each user but which is backed by less actual storage that is used only when needed. When using thin provisioning, it is important that the storage administrator monitor the storage pool and add more capacity if it starts to become full.

To make sure that all available space can be used, LVM supports data discard. This allows for re-use of the space that was formerly used by a discarded file or other block range.

翻译如下:

从Red Hat Enterprise Linux 6.4版本开始,可以精简配置逻辑卷。这使您可以创建大于可用盘区的逻辑卷。使用精简配置,您可以管理可用空间的存储池(称为精简池),可以在应用程序需要时将其分配给任意数量的设备。然后,您可以创建可以绑定到精简池以供以后在应用程序实际写入逻辑卷时分配的设备。精简池可以在需要时进行动态扩展,以节省成本地分配存储空间。

通过使用自动精简配置,存储管理员可以过量使用物理存储,从而通常避免购买额外的存储。例如,如果十个用户各自为他们的应用程序请求一个100GB的文件系统,则存储管理员可以为每个用户创建一个看上去是100GB的文件系统,但由较少的实际存储作为后盾,仅在需要时才使用。使用精简配置时,重要的是,存储管理员监视存储池并在存储池开始变满时增加更多容量。

为了确保可以使用所有可用空间,LVM支持数据丢弃。这样可以重新使用以前由废弃文件或其他块范围使用的空间。

摘至RedHat官方文档,链接如下

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/thinprovisioned_volumes

如何创建精简卷,可以参考如下链接中的文档说明或者参考man帮助文档

1、https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/thinly_provisioned_volume_creation

2、在LVM中设置精简资源调配卷(第四部分)——Linux中国

https://linux.cn/article-4288-1.html

3、查看帮助文档man lvmthin

下面演示如何创建LVM精简卷

1、创建PV物理卷,创建VG卷组

pvcreate /dev/sda5

vgcreate VG_CentOS /dev/sda5

vgdisplay

2、创建ThinPoolLV

To create a thin volume, you perform the following tasks:

  1. Create a volume group with the vgcreate command.
  2. Create a thin pool with the lvcreate command.
  3. Create a thin volume in the thin pool with the lvcreate command.

lvcreate -L 20G --thinpool Data_Pool VG_CentOS

3、创建精简卷ThinLV

1)创建thin_LV_data01

lvcreate -V 10G --thin -n thin_LV_data01 VG_CentOS/Data_Pool

2)创建thin_LV_data02

lvcreate -V10G -T VG_CentOS/Data_Pool -n thin_LV_data02

3)假设现在再创建一个大小为10G的thin_LV_data03

lvcreate -V10G -T VG_CentOS/Data_Pool -n thin_LV_data03

这时会弹出告警提示,超出了Data_Pool精简池20G的大小

4)格式化并挂载

mkdir /data_01

mkdir /data_02

mkdir /data_03

mkfs.ext4 /dev/VG_CentOS/thin_LV_data01

mkfs.ext4 /dev/VG_CentOS/thin_LV_data02

mkfs.ext4 /dev/VG_CentOS/thin_LV_data03

mount /dev/VG_CentOS/thin_LV_data01 /data_01

mount /dev/VG_CentOS/thin_LV_data02 /data_02

mount /dev/VG_CentOS/thin_LV_data03 /data_03

5)测试写入

dd if=/dev/zero of=/data_01/data_01.iso bs=1M count=8000

dd if=/dev/zero of=/data_02/data_02.iso bs=1M count=8000

lvs查看可以看到Data_Pool已经使用80%

这时再dd if=/dev/zero of=/data_03/data_03.iso bs=1M count=8000

其实这时写入其实是有问题的,因为已经超额了,lvs可以看到Data%为100%了

不明白dd写入时为啥不报错,待求证

6)扩容精简卷池Data_Pool

lvextend -L +15G /dev/VG_CentOS/Data_Pool

这时精简卷池Data_Pool就不会溢出,可见精简卷这种配置方式比较灵活

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-11-09,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WalkingCloud 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 翻译如下:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档