ONTAP Discussions

Snapshots Explained

matt090385
9,756 Views

Hi, Could someone help me get my head around snapshots and how in some instances deleting one snapshot doesn't save me space.

My understanding of snapshot technology is also a little sketchy and this doesn't help me with my question above.

Here a step by step guide of what I think I know.

AFS contains blocks A, B, C

T0 snapshot occurs - Size of snapshot is zero (although I'm assuming this is not strictly true as what I believe happens is the pointers to the active blocks are copied into the snapshot, so ill say zero even though it might be a couple of Kb - (Blocks A,B,C are locked in place)

Block D is added, this goes into the active file system the snapshot doesn't change size at all as new data has no effect

T1 snapshot occurs Size is zero - blocks locked by this snapshot are A,B,C,D or is it just Block D as A,B,C are locked by the previous snapshot?

T0 Snapshot is still zero

Block D is deleted

T1 snapshot grows by the size of Block D

T0 snapshot is still zero

Block E is created - This has no affect on any snapshots

Block A is deleted

T1 snapshot grows by the size of Block A (so now is A+D big)

T0 snapshot stays at zero

T2 Snapshot is created and is zero - BLOCKS being locked are B,C,E

Block E is deleted

T2 snapshot goes up by the value of E

T1 is still A+D

T0 is still Zero

Is this all correct so far?

Right, so if I were to delete T0 I would gain back nothing - Sure I get that.

If I were to delete T1 which currently holds A+D, the space reclaimable would be zero as the 2 blocks would role over to T0 as they are still referenced in this snapshot.. correct?

Does anyone have a way of summing this up therefore making it easier to understand?

1 ACCEPTED SOLUTION

GARDINEC_EBRD
9,756 Views

Yes, that's correct.  Just as long as the block is locked by other snapshot(s) and/or the AFS, deleting the snapshot will not allow it to be freed.

You may already know this, but you can also use the 'snap reclaimable' command to find out how much space would be reclaimed by deleting a specified snapshot or snapshots.

View solution in original post

4 REPLIES 4

GARDINEC_EBRD
9,756 Views

Comments below in BOLD:

matt090385 wrote:

Hi, Could someone help me get my head around snapshots and how in some instances deleting one snapshot doesn't save me space.

My understanding of snapshot technology is also a little sketchy and this doesn't help me with my question above.

Here a step by step guide of what I think I know.

AFS contains blocks A, B, C

T0 snapshot occurs - Size of snapshot is zero (although I'm assuming this is not strictly true as what I believe happens is the pointers to the active blocks are copied into the snapshot, so ill say zero even though it might be a couple of Kb - (Blocks A,B,C are locked in place)

Block D is added, this goes into the active file system the snapshot doesn't change size at all as new data has no effect

T1 snapshot occurs Size is zero - blocks locked by this snapshot are A,B,C,D or is it just Block D as A,B,C are locked by the previous snapshot?

>>> a snapshot 'locks' every block in the AFS at the time regardless of whether they are already locked by any other snapshot.

T0 Snapshot is still zero

Block D is deleted

T1 snapshot grows by the size of Block D

T0 snapshot is still zero

>>> Correct, but see below...

Block E is created - This has no affect on any snapshots

Block A is deleted

T1 snapshot grows by the size of Block A (so now is A+D big)

T0 snapshot stays at zero

>>> Here's probably where you are getting confused.  I find it's better not to think of individual snapshots having sizes, rather the size of all snapshots in a given volume.  The reason is the .snapshot usage at this point will be the sum of blocks locked by snapshots that are not currently part of the active filesystem.  So, at this point the snapshot's will consume A and D.  Both T0 and T1 have locks on block A.  Deleting one snapshot or the other will not release block A, only if you delete both snapshots.

T2 Snapshot is created and is zero - BLOCKS being locked are B,C,E

Block E is deleted

T2 snapshot goes up by the value of E

T1 is still A+D

T0 is still Zero

>>> think of it in terms of blocks, and what has a lock on what.  So (and I think I've followed you correctly so far):

A is locked by T0, T1

B is locked by T0, T1, T2, AFS

C is locked by T0, T1, T2, AFS

D is locked by T1

E is locked by T2

Is this all correct so far?

Right, so if I were to delete T0 I would gain back nothing - Sure I get that.

If I were to delete T1 which currently holds A+D, the space reclaimable would be zero as the 2 blocks would role over to T0 as they are still referenced in this snapshot.. correct?

>>> Not quite; T1 only has an exclusive lock on block D, so only block D would be freed by deleting snapshot T1.

Does anyone have a way of summing this up therefore making it easier to understand?

>>> Hope that helps.

matt090385
9,756 Views

Thanks for the reply. I think I get it. The statement at the end was a slip of the old brain "I should have spotted that T0 has nothing to do with block D"

So to sum this up into a statement... Any block which was referenced in any previous snapshot from the one which you deleting will still hold onto that block and therefore you wont reclaim that space that you had hoped?

The same statement could also be true for any block which is referenced in more current snapshots than the one being deleted?

GARDINEC_EBRD
9,757 Views

Yes, that's correct.  Just as long as the block is locked by other snapshot(s) and/or the AFS, deleting the snapshot will not allow it to be freed.

You may already know this, but you can also use the 'snap reclaimable' command to find out how much space would be reclaimed by deleting a specified snapshot or snapshots.

matt090385
9,756 Views

OK great so you can specify many snapshots under one command. I was thinking it would be rather pointless only being able to give one argument.

Public