Thin Pool in RHEL 7 — Part 1

RHEL 7 came with very exciting feature thinpool. This is similar to thin provisioning in VMware and Sparse Disk in OVM. In this post I am going to explain how to create thin pool and then how to create volume on that thin pool.

Step 1 : First we have to follow our traditional approach to create PV(physical volume) and VG(Volume Group).

[root@localhost ~]# vgs

VG     #PV #LV #SN Attr   VSize  VFree
rhel     1   2   0 wz–n- 19.51g    0
testvg   2   0   0 wz–n-  1.99g 1.99g

Step 2 : I am going to create thin pool named testpool1 of size 100MB over testvg.

[root@localhost ~]# lvcreate -L 100m -T testvg/testpool1
Logical volume “lvol0” created
Logical volume “testpool1” created

Step 3 : We can check the attributes of thinpool using lvs command.

[root@localhost ~]# lvs
LV        VG     Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
root      rhel   -wi-ao—-  17.51g
swap      rhel   -wi-ao—-   2.00g
testpool1 testvg twi-a-tz– 100.00m               0.00

Step 4 : Create the volume now using thinpool. We can check the status with lvs. Here we have created volume named testlv1 of size 500MB over thinpool named testpool1 of size 100M.

[root@localhost ~]# lvcreate -V500m -T testvg/testpool1 -n testlv1
Logical volume “testlv1” created

[root@localhost ~]# lvs
LV        VG     Attr       LSize   Pool      Origin Data%  Move Log Cpy%Sync Convert
root      rhel   -wi-ao—-  17.51g
swap      rhel   -wi-ao—-   2.00g
testlv1   testvg Vwi-a-tz– 500.00m testpool1          0.00
testpool1 testvg twi-a-tz– 100.00m                    0.00

Step 5 : In this step we are creating the xfs file system on newly created volume and mounting it.

[root@localhost ~]# mkfs.xfs /dev/testvg/testlv1
meta-data=/dev/testvg/testlv1    isize=256    agcount=8, agsize=16000 blks
=                       sectsz=512   attr=2, projid32bit=1
=                       crc=0
data     =                       bsize=4096   blocks=128000, imaxpct=25
=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=4265, version=2
=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@localhost ~]# mount /dev/testvg/testlv1 /testfs

[root@localhost ~]# df -h /testfs
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/testvg-testlv1  484M   26M  459M   6% /testfs

So what here we did is that we are presenting 100MB space as 500MB.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s