Saturday, 30 November 2013

Understanding NetApp Snapshots

Here’s my attempt at explaining how NetApp snapshots work. It’s not a discussion on the benefits of the redirect-on-write (as opposed to copy-on-write) method that NetApp uses, simply an example illustrating what happens when you add and delete stuff.

We have a 1GB (1024MB) volume with 5% snapshot reserve (51MB) which gives 972MB filesystem visible space.

na81::> df -m cdotshare
Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB    0MB   972MB       0%
/vol/cdotshare/.snapshot  51MB    0MB    51MB       0%

We add roughly 10MB’s worth.

Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB   10MB   962MB       1%
/vol/cdotshare/.snapshot  51MB    0MB    51MB       0%

We take a snapshot.

na81::> snap create -vserver vs1 -volume cdotshare -snapshot snap01

Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB   10MB   962MB       1%
/vol/cdotshare/.snapshot  51MB    0MB    51MB       0%

We add 10MB more to make it 20MB.

Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB   20MB   952MB       2%
/vol/cdotshare/.snapshot  51MB    0MB    51MB       0%

We take a second snapshot.

na81::> snap create -vserver vs1 -volume cdotshare -snapshot snap02

Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB   20MB   952MB       2%
/vol/cdotshare/.snapshot  51MB    0MB    51MB       0%

We add 10MB more to make it 30MB.

Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB   30MB   941MB       3%
/vol/cdotshare/.snapshot  51MB    0MB    51MB       0%

Now we’re starting to see how it works. We can keep adding new stuff to this volume (without deleting anything) and no snapshot space will ever be consumed.

Okay, we delete the 10MB we added just after the last snapshot.

Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB   20MB   951MB       2%
/vol/cdotshare/.snapshot  51MB    0MB    51MB       0%

Of course, the latest 10MB is not referenced in any snapshot so no snapshot space is consumed.

We delete all 20MB we’ve added.

Filesystem               total   used   avail capacity
/vol/cdotshare/          972MB    0MB   972MB       0%
/vol/cdotshare/.snapshot  51MB   20MB    30MB      40%

And there we see it; the volume is back to 0MB filesystem data, but with 20MB referenced in snapshots.



No comments:

Post a Comment