本站公告: 暂无公告....

Centos 创建 Thinlv pool和Thinlv

前端开发 兰亭楼 0评论 340浏览

Step:1 Create the Physical Volume using pvcreate command

Let’s assume new disk is detected as /dev/sdb.

[root@linuxtechi ~]# pvcreate /dev/sdb
 Physical volume "/dev/sdb" successfully created
[root@linuxtechi ~]#

Step:2 Create Volume group using vgcreate command

[root@linuxtechi ~]# vgcreate volgrp /dev/sdb
 Volume group "volgrp" successfully created
[root@linuxtechi ~]#

Step:3 Create a thin pool from the volume group

Thin pool is like a logical volume which is created using lvcreate command

Syntax :

# lvcreate –L <Size_of_pool> -T <volume_group>/<thin_pool_name>

Where –L is used to specify the size of the pool and –T specify the thin pool

[root@linuxtechi ~]# lvcreate -L 9.90G -T volgrp/lvpool
 Rounding up size to full physical extent 9.90 GiB
 Logical volume "lvpool" created.
[root@linuxtechi ~]#

Verify the thin pool size.

[root@linuxtechi ~]# lvs /dev/volgrp/lvpool
  LV     VG     Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvpool volgrp twi-a-tz-- 9.90g             0.00   0.59
[root@linuxtechi ~]#

Step:4 Create Logical Volumes from thin pool.

Let’s create two logical volumes of each size 4 GB.

Syntax :

# lvcreate -V <Size_of_Logical_Volume> -T <volume_group_name> /<name_of_thinpool> -n <name_of_logical_volume>

[root@linuxtechi ~]# lvcreate -V 4G -T volgrp/lvpool -n node1
Logical volume "node1" created.
[root@linuxtechi ~]# lvcreate -V 4G -T volgrp/lvpool -n node2
Logical volume "node2" created.
[root@linuxtechi ~]#

Verify the status of thin pool and logical volumes

[root@linuxtechi ~]# lvs /dev/volgrp/lvpool && lvs /dev/volgrp/node{1..2}
  LV     VG     Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvpool volgrp twi-aotz-- 9.90g             0.00   0.65
  LV    VG     Attr       LSize Pool   Origin Data%  Meta%  Move Log Cpy%Sync Convert
  node1 volgrp Vwi-a-tz-- 4.00g lvpool        0.00
  node2 volgrp Vwi-a-tz-- 4.00g lvpool        0.00
[root@linuxtechi ~]#

Step:5 Format the thin provisioned logical volumes

Use the mkfs command to  create file system(ext4) on logical volumes.

[root@linuxtechi ~]# mkfs.ext4 /dev/volgrp/node1
[root@linuxtechi ~]# mkfs.ext4 /dev/volgrp/node2
[root@linuxtechi ~]# mkdir /opt/vol1 && mkdir /opt/vol2
[root@linuxtechi ~]# mount /dev/volgrp/node1 /opt/vol1/ && mount /dev/volgrp/node2 /opt/vol2/
[root@linuxtechi ~]#

Check the mount points

[root@linuxtechi ~]# df -Th /opt/vol1/ /opt/vol2/
Filesystem               Type  Size  Used Avail Use% Mounted on
/dev/mapper/volgrp-node1 ext4 3.9G   16M  3.6G   1% /opt/vol1
/dev/mapper/volgrp-node2 ext4 3.9G   16M  3.6G   1% /opt/vol2
[root@linuxtechi ~]#

Write some data into the above created file systems

[root@linuxtechi ~]# dd if=/dev/zero of=/opt/vol1/file.txt bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.26031 s, 329 MB/s
[root@linuxtechi ~]# dd if=/dev/zero of=/opt/vol2/file.txt bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 2.70821 s, 396 MB/s
[root@linuxtechi ~]#

增加Thinlv pool大小 

lvextend -L 10G vg0/gluster


转载请注明: 兰亭楼 » Centos 创建 Thinlv pool和Thinlv

发表我的评论 换个身份
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址