[dm-devel] how to refresh LV to apply fstrim online

Zdenek Kabelac zkabelac at redhat.com
Tue Oct 25 14:12:39 UTC 2016


Dne 25.10.2016 v 16:04 Gianluca Cecchi napsal(a):
>
>
> On Fri, Oct 21, 2016 at 1:32 AM, Gianluca Cecchi <gianluca.cecchi at gmail.com
> <mailto:gianluca.cecchi at gmail.com>> wrote:
>
>
>     On Thu, Oct 20, 2016 at 1:40 PM, Zdenek Kabelac <zkabelac at redhat.com
>     <mailto:zkabelac at redhat.com>> wrote:
>
>
>         Hi
>
>         Please provide listing of all your 'multipath'  leg devices - are
>         they support TRIM ?
>         Then 'check' dm device.
>
>         See  (and attach)
>
>          grep "" /sys/block/*/queue/discard_granularity
>
>
>         Also make sure you are NOT using 'ext2' filesystem which does not
>         support discard on RHEL6 and you are on latest available RHEL6 kernel.
>
>
>         Regards
>
>         Zdenek
>
>
>
>     Hello,
>     thanks for answer.
>     I'm using ext3 filesystem that supports discard.
>     Currently I'm on this kernel
>
>     [root at dbatest1 ~]# uname -r
>     2.6.32-431.29.2.el6.x86_64
>     [root at dbatest1 ~]#
>
>
>     It seems that I was myself able to find a way to online refresh the
>     logical volume and so to successfully run fstrim command against the
>     related file system, without deactivating the lv and most important
>     without generating downtime for my users.
>     Please note that what I'm doing is working on a test system where I have
>     the same situation as in production.
>     Can you certify my approach and comment about it, so that I can eventually
>     apply in production?
>
>
> [snip]
>
>
>
>     [root at dbatest1 ~]# dmsetup suspend /dev/dm-4 ; dmsetup reload /dev/dm-4
>     my_dm_table ; dmsetup resume /dev/dm-4
>     [root at dbatest1 ~]# echo $?
>     0
>     [root at dbatest1 ~]#
>
>     And now the magic:
>
>     [root at dbatest1 ~]# fstrim /ALM/rdoffline
t giving downtime, in a safe way.


Normally it's not advised  to use 'dmsetup' command for  LV.
The above sequence should be equivalent to:

lvchange --refresh  vg/lv
(or  vgchange --refresh vg  -  doing it for every active LV in VG)

It's unclear how this could help  - unless you we doing some 'pvmove'
operations (which might be worth a BZ).

You should collect all states  while it 'DOES NOT' work.
And then  run  the --refresh (which you thing it's fixing it for your)
ATM I'm clueless how you get mapping without TRIM where --refresh can fix it.


Regards

Zdenek





More information about the dm-devel mailing list