[linux-lvm] How to check if thin volume or snapshot was ever activated

Ming-Hung Tsai mingnus at gmail.com
Mon Aug 9 03:53:46 UTC 2021

On Sat, Aug 7, 2021 at 7:43 PM Gionatan Danti <g.danti at 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.

More information about the linux-lvm mailing list