Just wondering, since snapshots don''t use additional disc space, how do they work.? I did some tests of backup/recovery using snapshots and I can''t see how (or where) snapshots store the information. I deleted some files and then restored from snapshot: everything was back into place. Could someone put some light into this?? Thanks a lot. Toni. This message posted from opensolaris.org
Hi (again) Toni, On Tue, 2005-12-20 at 08:36 -0800, Toni Ribas wrote:> Just wondering, since snapshots don''t use additional disc space, how do they work.?Magic :-) Well, no, not quite magic - but it is very clever. Snapshots do use disk space, but just not in the way you''re thinking.> I did some tests of backup/recovery using snapshots and I can''t see > how (or where) snapshots store the information. I deleted some files > and then restored from snapshot: everything was back into place. > > Could someone put some light into this??ZFS is a copy-on-write filesystem, which means that when you make changes to a file on ZFS, behind the scenes ZFS makes a copy of each block of data that''s to be changed in the file, applies the changes to that copy, then once those changes have succeeded, makes the file point to the changed block. (in a nutshell) When you take a snapshot of a ZFS filesystem, you''re telling the system that you want to remember the state of the files and blocks on the system at that point in time. So, if you make no changes to the original filesystem after taking the snapshot, the snapshot will appear to take no additional space. Every change you make to the original filesystem after taking the snapshot will start to allocate new storage for those changed blocks. There''s diagrams on slides 11 and 12 that might help to explain this at: http://www.opensolaris.org/os/community/zfs/docs/zfs_last.pdf To try this out, take a ZFS filesystem and put say 100mb of data in it, take a snapshot of that filesystem, then remove that 100mb of data from the original filesystem, then see how much the snapshot is taking. (you should see that it''s now using 100mb) Hope this helps, cheers, tim -- Tim Foster, Sun Microsystems Inc, Operating Platforms Group Engineering Operations http://blogs.sun.com/timf
Hello Toni, Tuesday, December 20, 2005, 5:36:09 PM, you wrote: TR> Just wondering, since snapshots don''t use additional disc space, how do they work.? TR> I did some tests of backup/recovery using snapshots and I can''t see how (or where) snapshots store the information. I deleted some files and then restored from snapshot: everything was back TR> into place. TR> Could someone put some light into this?? TR> Thanks a lot. They (ZFS team) have made use of Q-bits (quantum bits) so ZFS can store more information in a q-bit. :))) ok, seriously - check ZFS Documentation at http://opensolaris.org/os/community/zfs/docs/ Some implementation details on snapshots you can find at http://blogs.sun.com/roller/page/ahrens?entry=is_it_magic -- Best regards, Robert mailto:rmilkowski at task.gda.pl http://milek.blogspot.com
> Just wondering, since snapshots don''t use additional > disc space, how do they work.?Since ZFS is a copy-on-write filesystem, it always writes new data to previously-unused space. Ie. it never overwrites. Snapshots simply tell us to not bother freeing up space that we otherwise would. Initially, snapshots don''t use any additional disk space. However, if you remove files that are snapshotted, their space won''t be reclaimed. So as time goes on, the snapshot could be said to use some space. The amount of space that will be freed up when a snapshot is destroyed is reported as the "used" property by ''zfs list'' or ''zfs get used''. You can read more about how snapshots are implemented in my blog: http://blogs.sun.com/roller/page/ahrens?entry=is_it_magic --matt This message posted from opensolaris.org