Skip to contentSkip to conversation

How to check if thin volume or snapshot was ever activated

linux-lvm Gionatan Danti 2 participants 5 messages Aug 7, 2021 – Aug 10, 2021 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

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.

Signature · 11 lines
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: [email protected] - [email protected]
GPG public key ID: FF5F32A8

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
#1 lore raw
Quoted 10 lines · Gionatan Danti

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
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#2 lore raw
Quoted 8 lines · Ming-Hung Tsai
Quoted 5 lines · Gionatan Danti

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).

Quoted 4 lines

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

                ^^^^^^^^^^^^
Quoted 1 line

device's creation time.

sorry, I mean "greater than or equal to"

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

#3 lore raw
In reply to Ming-Hung Tsai

Il 2021-08-09 05:53 Ming-Hung Tsai ha scritto:

Quoted 2 lines

It sounds like you intend to keep snapshots that have been updated (written) since its creation, right?

True.

Quoted 3 lines

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.

Quoted 3 lines

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.

Signature · 11 lines
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: [email protected] - [email protected]
GPG public key ID: FF5F32A8

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

A message that is not in the archive (sent off-list or not yet received): CAAYit8RWCA3W0y4vuZju6aZVSeu7e6SjErkZ1orLceJj0nhsvw@mail.gmail.com

#5 lore raw

Il 2021-08-10 10:40 Ming-Hung Tsai ha scritto:

Quoted 8 lines

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!

Signature · 11 lines
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: [email protected] - [email protected]
GPG public key ID: FF5F32A8

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