[linux-lvm] Bug: 'cow' partitions for old active snapshots are not reliably removed.

Linda A. Walsh lvm at tlinx.org
Sat Sep 28 20:29:24 UTC 2013


I create snapshots of my Home partition.  After a day, I create a new snapshot, 
and use rsync to determine the diffs that occurred since the last snapshot, 
then remove the 'active snapshot', and copy the diffs to a new, static
partition that is sized for the size of the diffs that were found.  This 
leaves me with a partition that holds changes for the given date.

A "cow" is created for each active snap.  When I stop the active shapshot
and later delete it (replacing it with a normal, non-active partition
by the same name), I notice that none of the "cow" partitions are deleted
when I remove the old 'active' the old snapshot. It seems this is an
oversight -- i.e. -- the 'cow' partitions are no longer needed since there
is no active snapshot.  What's worse that 'dm' reuses old active snap names,
so some of the old 'cow' partitions point to new partitions that are unrelated
to the old active snap.

In addition, old snapshots are "pruned" based on age.  They are not pruned via
a simple "delete oldest", but by some number of snaps that I wish to keep for
a given age

Example:
...
lrwxrwxrwx 1       7 Sep 28 05:09 HnS-Home -> ../dm-3 (origin; static)
lrwxrwxrwx 1       8 Sep  4 08:55 HnS-Home--2013.08.28--04.07.02 -> ../dm-20 (reused)
lrwxrwxrwx 1       7 Sep  6 04:07 HnS-Home--2013.09.04--04.07.03-cow -> ../dm-4 (reused)
lrwxrwxrwx 1       8 Sep  7 04:07 HnS-Home--2013.09.06--04.07.03-cow -> ../dm-19 (reused)
lrwxrwxrwx 1       8 Sep  8 04:07 HnS-Home--2013.09.07--04.07.03-cow -> ../dm-21 (reused)
lrwxrwxrwx 1       8 Sep  9 04:07 HnS-Home--2013.09.08--04.07.02-cow -> ../dm-19 (reused)
lrwxrwxrwx 1       8 Sep 10 05:29 HnS-Home--2013.09.09--04.07.03 -> ../dm-21 (static)
lrwxrwxrwx 1       8 Sep 10 04:07 HnS-Home--2013.09.09--04.07.03-cow -> ../dm-23 (reused)
lrwxrwxrwx 1       8 Sep 11 04:07 HnS-Home--2013.09.10--04.07.02-cow -> ../dm-26 (reused)
lrwxrwxrwx 1       8 Sep 13 04:07 HnS-Home--2013.09.12--04.07.03-cow -> ../dm-26 (reused)
lrwxrwxrwx 1       7 Sep 14 05:00 HnS-Home--2013.09.13--04.07.03 -> ../dm-4 (static)
lrwxrwxrwx 1       8 Sep 14 04:07 HnS-Home--2013.09.13--04.07.03-cow -> ../dm-24 (invalid)
lrwxrwxrwx 1       8 Sep 16 06:13 HnS-Home--2013.09.15--04.07.03 -> ../dm-14 (static)
lrwxrwxrwx 1       8 Sep 17 04:07 HnS-Home--2013.09.16--04.07.03-cow -> ../dm-26 (reused)
lrwxrwxrwx 1       8 Sep 18 05:22 HnS-Home--2013.09.17--04.07.04 -> ../dm-16 (static)
lrwxrwxrwx 1       8 Sep 18 04:07 HnS-Home--2013.09.17--04.07.04-cow -> ../dm-24 (invalid)
lrwxrwxrwx 1       8 Sep 19 04:07 HnS-Home--2013.09.18--04.07.03-cow -> ../dm-26 (reused)
lrwxrwxrwx 1       8 Sep 20 04:58 HnS-Home--2013.09.19--04.07.03 -> ../dm-19 (static)
lrwxrwxrwx 1       8 Sep 20 04:07 HnS-Home--2013.09.19--04.07.03-cow -> ../dm-24 (invalid)
lrwxrwxrwx 1       8 Sep 21 05:02 HnS-Home--2013.09.20--04.07.03 -> ../dm-25 (static)
lrwxrwxrwx 1       8 Sep 21 04:07 HnS-Home--2013.09.20--04.07.03-cow -> ../dm-26 (reused)
lrwxrwxrwx 1       8 Sep 22 05:00 HnS-Home--2013.09.21--04.07.03 -> ../dm-18 (static)
lrwxrwxrwx 1       8 Sep 22 04:07 HnS-Home--2013.09.21--04.07.03-cow -> ../dm-24 (invalid)
.....
The ones marked 'invalid' are dangling symlinks.  The ones marked 'reused', 
exist and usually point to some other non-cow partition (a static partition).
FWIW, the names are in Vol/subvol-date-time format (a format that works
with MS's snapshot names and allows a user to find previous versions of files that
have changed since that date.

While cow partitions are not normally mounted, they seem to be potential future
problems and at best, are dangling symlinks that aren't cleaned up and sometimes 
point to new, valid data.

How is it that they are not deleted when I close and delete the active snapshot that
corresponds to them.  I can modify my "snapper" to manually delete 'cow' 
partitions, but this seems like a "hack" that should be unnecessary.

I'm assuming these "should" not be there, as they are no longer valid?

Thanks!







More information about the linux-lvm mailing list