精简卷是可以创建大于可用磁盘的逻辑卷。使用精简卷,你可以管理可用空间的存储池(称为精简池),可以在应用程序需要时将其分配给任意数量的设备。精简池可以在需要时进行动态扩展,以节省成本。 |
系统环境
创建精简池
下面我们添加一块硬盘。创建物理卷,然后创建卷组:
[root@localhost ~]# pvcreate /dev/sda Physical volume "/dev/sda" successfully created. [root@localhost ~]# vgcreate vg_thin /dev/sda Volume group "vg_thin" successfully created [root@localhost ~]# vgs VG #PV #LV #SN Attr VSize VFree cl 1 2 0 wz--n- <19.00g <2.00g vg_thin 1 0 0 wz--n- <20.00g <20.00g
上面已经创建好一个新的卷组了,名字为vg_thin
。然后在现有卷组的中创建一个精简池:
[root@localhost ~]# lvcreate -L 1G -T vg_thin/thin_pool Thin pool volume with chunk size 64.00 KiB can address at most 15.81 TiB of data. Logical volume "thin_pool" created. [root@localhost ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root cl -wi-ao---- 15.00g swap cl -wi-ao---- 2.00g thin_pool vg_thin twi-a-tz-- 1.00g 0.00 10.94
创建精简卷
创建精简池之后,我们就可以从精简池中创建精简卷。在本实验中创建四个精简卷,每个精简卷的大小为200 MB。
[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user1 Logical volume "tp_lv_user1" created. [root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user2 Logical volume "tp_lv_user2" created. [root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user3 Logical volume "tp_lv_user3" created. [root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user4 Logical volume "tp_lv_user4" created.