3

I have LVM with thin-provisioning enabled. I have two almost identical thin logical volumes with ext4 file systems that slightly differs. The first volume is used entirely for storing file system. On the second volume file system is stored with a small offset. It is mounted with -o offset=1048576 option.

First volume could be cleaned with the fstrim command, but the second one could not. It gives the error instead:

fstrim: second: the discard operation is not supported

That is because of offset mounting I believe. Receiving offset option mount command creates temporary loop device and mounts it. So the main suspect is loop device.

Is it possible somehow to clean filesystem that has offset to the volume start block address?

1

1 Answer 1

1

It doesn't seem to be possible. I tried to find out why - this is a comment from loop.c:

        /*
         * If the backing device is a block device, mirror its zeroing
         * capability. Set the discard sectors to the block device's zeroing
         * capabilities because loop discards result in blkdev_issue_zeroout(),
         * not blkdev_issue_discard(). This maintains consistent behavior with
         * file-backed loop devices: discarded regions read back as zero.
         */

LVM thin devices do NOT report zeroing capability (write_zeroes_max_bytes is 0). I specifically checked dm-thin.c to confirm it.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .