Q: Is there a way to detect presence of snapshot from within VM guest OS*
A: not that I know. However, you can use the sg_vpd
to check if UNMAP is supported. For example:
# sg_vpd /dev/sdb -p lbpv
Logical block provisioning VPD page (SBC):
Unmap command supported (LBPU): 1
Write same (16) with unmap bit supported (LBWS): 0
Write same (10) with unmap bit supported (LBWS10): 0
Logical block provisioning read zeros (LBPRZ): 1
Anchored LBAs supported (ANC_SUP): 0
Threshold exponent: 1
Descriptor present (DP): 0
Provisioning type: 2
Some explanations:
provision type
is 2, so you are running from a "thin" disk;
unmap command supported (LBPU)
is 1, so your disk claims to support UNMAP/TRIM
That said, issuing fstrim
on a snapshotted disk should not have any adverse effect. On VMWare <= 6.5, it should have no effect at all, while VMWare >= 6.7 seems to support TRIM even when using snapshots.
EDIT: as detailed in the comments below, the problem is related to original disk inflation during/after "trimmed" snapshot consolidation. As shown here, this side effect seems not avoidable even on latest VMWare 6.7