Thin Pool in RHEL 7 — Part 2

Continuing from Previous post, I am going to show the actual usage of thinpool.

Step 1 : We have one mounted xfs file system.

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

Step 2 : I am going to create one file on that file system using dd command. I intentionally kept the size of file larger than the size of thinpool on which volume(testlv1) is created.

[root@localhost testfs]# dd if=/dev/zero of=/testfs/file1 bs=1024 count=20000000
^C

Here after waiting for some time when the command didn’t get complete I tried to terminate it. But it didn’t get. Then I opened the another session.

Step 3 : In another session I check the status of space at thinpool (testpool1) level found that space in thin pool got depleted hence above command is not getting complete.

[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-aotz– 500.00m testpool1 20.00
testpool1 testvg twi-a-tz– 100.00m 100.00

In above output testpool1 got 100% full. LV created on it is still showing 80% free space which is actually not.

Step 4 : I increased the size of thinpool by 500MB. As soon as I increased it, dd command in another window got completed successfully file got created in file system.

[root@localhost ~]# lvextend -L+500M testvg/testpool1
Extending logical volume testpool1_tdata to 600.00 MiB
Logical volume testpool1 successfully resized

Step 5 : We can check the new increased space at thinpool level. Notice the difference in Data column as well.

[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-aotz– 500.00m testpool1 63.78
testpool1 testvg twi-a-tz– 600.00m 53.15

Step 6 : Available space at file system level will be same only. It has changed at pool level only.

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

Advertisements

11 thoughts on “Thin Pool in RHEL 7 — Part 2

  1. venkatesh

    This seems to be a pretty good feature in RHEL7. Thanks for sharing it Sir…
    Looking forward to see more n more technical updates from you.
    Good luck 🙂

    –Venky

    Reply
    1. Madhup Srivastawa

      Excellent stuff !
      Can you please put up some interview specific options and scenarios on RHEL Sol. at L2-L3 level?

      Reply
  2. birddogg

    I have noticed using the lvs command is the only way to see actual free space in the thin_pool? After this space is filled up to say 80% and many of the files are then removed it still reports 80% full. Is there anyway to reset this back to actual usage? Or does this number arise from blocks used and not actual data? I hope that makes sense!

    Thanks for the post, the RHEL7 documentation on thin provisions are pretty sparse.

    Reply
  3. birddogg

    looks like expected behaviour for xfs, with ext4 and discard on it will free up this space automatic. another draw back of xfs not being able to reduce.

    Reply
  4. Vikrant Post author

    Thanks for your comment briddogg. you brought out the intersting point to reset the usage. I will simulate it and will share the result here.

    Yes xfs can’t be reduce 😦

    Reply
  5. birddogg

    Did you try this with ext4? It seems to work on that fs, I will test again it might be the discard mount flag that makes it work.

    Reply
  6. Vikrant Post author

    Your link is very useful. After issuing fstrim I have seen the reset in data usage of xfs and also for ext4.

    I have created one testfile of 180MB approx after that I deleted the file and trimmed the file system able to see the reduced space in data column of lvs.

    [root@localhost ~]# lvs
    LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
    root rhel -wi-ao—- 10.31g
    swap rhel -wi-ao—- 1.20g
    thinxfslv1 thinvg1 twi-a-tz– 284.00m 66.92
    thinxfsvol1 thinvg1 Vwi-aotz– 200.00m thinxfslv1 95.03

    [root@localhost thinxfs]# rm testfile1
    rm: remove regular file ‘testfile1’? y

    [root@localhost thinxfs]# fstrim -v /thinxfs/
    /thinxfs/: 183.1 MiB (191967232 bytes) trimmed

    [root@localhost ~]# lvs
    LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
    root rhel -wi-ao—- 10.31g
    swap rhel -wi-ao—- 1.20g
    thinxfslv1 thinvg1 twi-a-tz– 284.00m 6.05
    thinxfsvol1 thinvg1 Vwi-aotz– 200.00m thinxfslv1 8.59

    Reply

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