ZFS ZFS snapshot noob question

I'know that the first initial snapshot will contain all data from source(if the disk has 500GB the 500GB will we the final size of snapshot)
and from there the snapshots contains only the diferences.

my question is, for example, already made a initial snapshot of my 500GB disk , the snapshots from now on, will we
contain only data about deleted files,changes files,etc ?
and how much space that will use in the snapshot?
a more concrete example:
After a made the initial snapshot(and send it to another machine) :

-Monday, I'made one snapshot
-Tuesday in my 500GB disk I'delete 30GB of files and folders

how much space will occupy the Monday snapshot?

and for recover, if I'only restore the Monday snapshot I'will restore the deleted files and folder of Tuesday and
will not modify the actual pool? , I'mean just like nothing happend?
 
Snapshots are made by marking the original data as "copy on write". i.e. no additional data blocks are required. ["copy on write" is implemented in the metadata.]

Snapshots contain all of the original data blocks, and provide a static reflection of the state of a file system at the exact time the snapshot was taken. This does not change over time.

Initially, the live file system contains exactly the same data blocks as a snapshot. [Think of it loosely as one common set of data blocks and two sets of pointers to those blocks.]

If the live file system is subsequently changed, then new data blocks have to be allocated to reflect the change(s) to the live file system (and the pointers to the data blocks on the live file system adjusted) -- while the original data blocks persist unchanged as part of the snapshot.

If there are large deletions from the live file system, the deleted blocks will no longer be claimed by the live file system, but will still be owned by the snapshot (so they will not be returned to the free list).

So a snapshot is not impacted by changes to the live file system after the snapshot was taken.
 
Snapshots are made by marking the original data as "copy on write". i.e. no additional data blocks are required. ["copy on write" is implemented in the metadata.]

Snapshots contain all of the original data blocks, and provide a static reflection of the state of a file system at the exact time the snapshot was taken. This does not change over time.

Initially, the live file system contains exactly the same data blocks as a snapshot. [Think of it loosely as one common set of data blocks and two sets of pointers to those blocks.]

If the live file system is subsequently changed, then new data blocks have to be allocated to reflect the change(s) to the live file system (and the pointers to the data blocks on the live file system adjusted) -- while the original data blocks persist unchanged as part of the snapshot.

If there are large deletions from the live file system, the deleted blocks will no longer be claimed by the live file system, but will still be owned by the snapshot (so they will not be returned to the free list).

So a snapshot is not impacted by changes to the live file system after the snapshot was taken.

good explanation, if I'am not wrong...
is like another filesystem , the delete file are still there until that block it's written back
(for new files or folders)
the ZFS snapshot keep information whereis that file in the file system blocks, and
if that block is not used then restore the file
so, the snapshots do not pass the 1Mb size?

sorry for the archaic explanation for that people who knows how ZFS works 🙃
 
Snapshots are made by marking the original data as "copy on write".
ZFS is a copy-on-write filesystem, it always does this, not just when you "mark" something. Because data blocks are never overwritten you can keep track of the "old" data blocks. This is essentially what a snapshot does. You can easily create snapshots because ZFS is a CoW filesystem, not the other way around.

 
one final question,if I'do a recursive snapshot(all files and folders) will be the same not?
 
snapshots work only on data sets, if you wish to snapshot the entire pool you would simpaly snapshot the /zroot .. each data set will have a unique name and the file size of the actual snapshot will reflect the changes in pointer data from the last time the data set was changed.

so a highly used data set with lots of writes and deletes will create larger files than a data set that does not see a lot of action.

for example
Code:
dataset@date                                                       size           total dataset size
zpool/dataset1@2020-04-09_08.59.35--3d                                   0      -   722G  -
zpool/dataset1@2020-04-09_11.00.08--3d                                   0      -   722G  -
zpool/dataset1@2020-04-13_13.06.13--3d                               5.84M  -   722G  -
zpool/dataset2@2020-04-09_08.59.35--3d                                   0      -   105G  -
zpool/dataset2@2020-04-09_11.00.08--3d                                   0      -   105G  -
zpool/dataset2@2020-04-13_13.06.13--3d                              1.79M   -   105G  -
zpool/dataset3@2020-04-09_08.59.35--3d                                   0      -   7.96T  -
zpool/dataset3@2020-04-09_11.00.08--3d                                   0      -   7.96T  -
zpool/dataset3@2020-04-13_13.06.13--3d                              1.11M   -   7.96T  -
zpool/dataset4@2020-04-09_08.59.35--3d                                   0      -   1.05T  -
zpool/dataset4@2020-04-09_11.00.08--3d                                   0      -   1.05T  -
zpool/dataset4@2020-04-13_13.06.13--3d                                279K   -   1.05T  -
zpool/dataset5@2020-04-09_08.59.35--3d                                126G   -   7.09T  -
zpool/dataset5@2020-04-09_11.00.08--3d                               3.29M   -  6.97T  -
zpool/dataset5@2020-04-13_13.06.13--3d                                4.87G   -  7.65T  -

as you can see, there were no change for dataset 1 . the total snapshot size is 5.84 megs and there is 722G of data in the dataset
same with 2 and 3 4 had some minor changes ... older snaps are 0 (becasue there were no changes) and the most recent snapshot is the last one taken.

data set 5 on the other hand had lots of daily changes .. each snapshot file containst the necessary info to revert to the last state.. ie 126G 2.29M 4.87G are the changes / cost in disk space to revert to that snapshot.
 
Back
Top