Discard unused space in thin provisioned environment

Latest response

Is there a simple way of discarding data when using  thin provisioning on storage ? I do not want to use discard option in fstab as it have impact on performace.

I have tried with fstrim but without success..

# fstrim -v /test
fstrim: /test: FITRIM ioctl failed: Operation not supported

Here is my setup:

3 luns of 1 TB and LVM and ext4 on top of them, (RHEL 6.3)

# df -h /test

Filesystem            Size  Used Avail Use% Mounted on
                      3.0T  200M  2.9T   1% /test

Storage (FC connected HDS) shows me it's full (3x 1TB/1TB)

Some additional data:

# grep . /sys/block/sd{c,d,e}/queue/discard_max_bytes

Is this LVM fault ? Or something else ?



Hi Stefan. Looks like the community hasn't been able to assist with this one yet. I'm still chasing up someone here who may be able to help out, but stay tuned...

I thought the Original Post was an explanation of a solution, not a question ;-)  I am not familiar with TP on linux (Only with Veritas on Solaris) but I will try to throw some things to consider...

Thin provisioning seems to be somewhat vague as there are a number of components that need to be TP-aware and they all need to aware of how each component works.

Did you install the Hitachi Library Software (HDLM?)?

I believe part of the issue is related to how different parts of the stack interpret "unclaimed or reclaimed" bits.  For Veritas and EMC you had to have a very selective minimum release of both storage foundation and the EMC code on the array for things to work. 

Here is a pretty interesting link I found, which may not answer your question, but it will give you an idea of what could potentially be prohibiting your environment from working correctly


Best of luck - I assume dealing with Thin Provisioning will become more of a day-to-day task for admins in the future (which probably means it will be more automated ;-)

Another cool link I found (again - it won't fix your issue, but it's good info)


LVM will pass through the required IOCTLs.

Batch discard is supported on XFS and ext4 in RHEL 6.2 and later:


However, given your discard_max_bytes is 0, it seems the underlying block device does not support discard.

Which might explain why, as our organization merges its utility-compute solution with our partner organization's utility-compute solution, the other organization is so hot to move tenants off of RHEL 5 and onto RHEL 6.3+