All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] How to check if thin volume or snapshot was ever activated
@ 2021-08-07 11:39 Gionatan Danti
  2021-08-09  3:53 ` Ming-Hung Tsai
  0 siblings, 1 reply; 5+ messages in thread
From: Gionatan Danti @ 2021-08-07 11:39 UTC (permalink / raw)
  To: linux-lvm

Dear all,
as you know, a thin snapshot does have the "k" (skip activation) flag 
set, so one has to force activation by ignoring the flag (or removing 
the flag itself).

I wonder: can we detect if a volume/snapshot was *ever* activated? My 
reasoning is that a never-activated snapshot surely did not receive any 
application writes, so it can be safely removed (ignoring snapshot 
retention policy).

Regards.

-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti@assyoma.it - info@assyoma.it
GPG public key ID: FF5F32A8

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to check if thin volume or snapshot was ever activated
  2021-08-07 11:39 [linux-lvm] How to check if thin volume or snapshot was ever activated Gionatan Danti
@ 2021-08-09  3:53 ` Ming-Hung Tsai
  2021-08-09  4:16   ` Ming-Hung Tsai
  2021-08-09  8:33   ` Gionatan Danti
  0 siblings, 2 replies; 5+ messages in thread
From: Ming-Hung Tsai @ 2021-08-09  3:53 UTC (permalink / raw)
  To: LVM general discussion and development

On Sat, Aug 7, 2021 at 7:43 PM Gionatan Danti <g.danti@assyoma.it> wrote:
>
> Dear all,
> as you know, a thin snapshot does have the "k" (skip activation) flag
> set, so one has to force activation by ignoring the flag (or removing
> the flag itself).
>
> I wonder: can we detect if a volume/snapshot was *ever* activated? My
> reasoning is that a never-activated snapshot surely did not receive any
> application writes, so it can be safely removed (ignoring snapshot
> retention policy).

It sounds like you intend to keep snapshots that have been updated
(written) since its creation, right?
The precise way might be checking the data mappings via thin_dump. An
updated device has data mappings with timestamps greater than the
device's creation time.

Checking device activation might not meet what you need. An activated
device might or might not receive any write, so you don't know whether
a device has been updated by looking into its activation history.

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to check if thin volume or snapshot was ever activated
  2021-08-09  3:53 ` Ming-Hung Tsai
@ 2021-08-09  4:16   ` Ming-Hung Tsai
  2021-08-09  8:33   ` Gionatan Danti
  1 sibling, 0 replies; 5+ messages in thread
From: Ming-Hung Tsai @ 2021-08-09  4:16 UTC (permalink / raw)
  To: LVM general discussion and development

On Mon, Aug 9, 2021 at 11:53 AM Ming-Hung Tsai <mingnus@gmail.com> wrote:
>
> On Sat, Aug 7, 2021 at 7:43 PM Gionatan Danti <g.danti@assyoma.it> wrote:
> >
> > I wonder: can we detect if a volume/snapshot was *ever* activated? My
> > reasoning is that a never-activated snapshot surely did not receive any
> > application writes, so it can be safely removed (ignoring snapshot
> > retention policy).
>
> It sounds like you intend to keep snapshots that have been updated
> (written) since its creation, right?
> The precise way might be checking the data mappings via thin_dump. An
> updated device has data mappings with timestamps greater than the

                ^^^^^^^^^^^^
> device's creation time.

sorry, I mean "greater than or equal to"

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to check if thin volume or snapshot was ever activated
  2021-08-09  3:53 ` Ming-Hung Tsai
  2021-08-09  4:16   ` Ming-Hung Tsai
@ 2021-08-09  8:33   ` Gionatan Danti
       [not found]     ` <CAAYit8RWCA3W0y4vuZju6aZVSeu7e6SjErkZ1orLceJj0nhsvw@mail.gmail.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Gionatan Danti @ 2021-08-09  8:33 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: Ming-Hung Tsai

Il 2021-08-09 05:53 Ming-Hung Tsai ha scritto:
> It sounds like you intend to keep snapshots that have been updated
> (written) since its creation, right?

True.

> The precise way might be checking the data mappings via thin_dump. An
> updated device has data mappings with timestamps greater than the
> device's creation time.

Interesting approach, thanks.

> Checking device activation might not meet what you need. An activated
> device might or might not receive any write, so you don't know whether
> a device has been updated by looking into its activation history.

Sure, but it can be a reasonable approximation before further 
inspection. Also, I wonder if dumping data mappings can be slow for big 
volumes.

Thanks.

-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti@assyoma.it - info@assyoma.it
GPG public key ID: FF5F32A8

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to check if thin volume or snapshot was ever activated
       [not found]     ` <CAAYit8RWCA3W0y4vuZju6aZVSeu7e6SjErkZ1orLceJj0nhsvw@mail.gmail.com>
@ 2021-08-10  8:46       ` Gionatan Danti
  0 siblings, 0 replies; 5+ messages in thread
From: Gionatan Danti @ 2021-08-10  8:46 UTC (permalink / raw)
  To: Ming-Hung Tsai; +Cc: linux-lvm

Il 2021-08-10 10:40 Ming-Hung Tsai ha scritto:
> It depends on the number of thin volumes and the space utilization. A
> selective dump might also help, e.g.,
> # thin_dump <metadata> --dev-id <thin-id1> --dev-id <thin-id2> ...
> 
> The thin-ids could be obtained from lvs, using listing:
> # lvs -o lv_name,vg_name,thin_id
> or querying:
> # lvs -o thin_id --select <criteria> --noheadings

Greatly appreciated, thanks!

-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti@assyoma.it - info@assyoma.it
GPG public key ID: FF5F32A8

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-10  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07 11:39 [linux-lvm] How to check if thin volume or snapshot was ever activated Gionatan Danti
2021-08-09  3:53 ` Ming-Hung Tsai
2021-08-09  4:16   ` Ming-Hung Tsai
2021-08-09  8:33   ` Gionatan Danti
     [not found]     ` <CAAYit8RWCA3W0y4vuZju6aZVSeu7e6SjErkZ1orLceJj0nhsvw@mail.gmail.com>
2021-08-10  8:46       ` Gionatan Danti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.