Do snapshots "save" entire files or just the delta when changing an existing file

guermantes

Patron
Joined
Sep 27, 2017
Messages
213
Do snapshots only save the delta (I think that's what it's called?) when a file is changed, rather than a copy of the entire file prior to change?

I am perplexed/surprised. Yesterday, 1 July, I made ID3 metadata changes to over thousand lossless music files. Small changes only in the year tag, e.g., changing "1972-73" to "1973", and "September 1980" to "1980". But for many many years in many many files. Total file size for the concerned files is over 25 GB.

1)When I woke up this morning I expected to see that the nightly snapshot task would have created a new snapshot, and that the previous snapshot would have increased considerably in size, reflecting the 25 GB file size of the files concerned. But the previous snapshot (26 June) is just a measly 208K. Is this a sign that ZFS has only saved the changes and not the entire files?

2) Furthermore, the new snapshot taken last night is also occupying 208 KB. Shouldn't the latest snapshot always occupy 0KB since it references the actual files in their current state?

The DAILY snapshot at 02.45 only fires if there have been changes since the last DAILY.
Code:
TANK/bibliotek/musica@auto-1YEAR-20220203-0245                          448K      -     1.88T  -
TANK/bibliotek/musica@auto-1YEAR-20220303-0245                          208K      -     1.88T  -
TANK/bibliotek/musica@auto-1YEAR-20220403-0245                          272K      -     1.88T  -
TANK/bibliotek/musica@auto-1YEAR-20220603-0245                         79.9K      -     1.89T  -
TANK/bibliotek/musica@auto-DAILY-20220625-0300                         79.9K      -     1.89T  -
TANK/bibliotek/musica@auto-DAILY-20220626-0300                          208K      -     1.89T  -
TANK/bibliotek/musica@auto-DAILY-20220702-0300                          208K      -     1.89T  -
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Neither. Snapshots store pointers to the active blocks in a dataset. Remember, ZFS is a copy-on-write filesystem. When you make a change to a file in a dataset, you're writing new active block(s). A snapshot would only need to store pointers to the blocks that replaced formerly active blocks, i.e., the delta between the active blocks at the time of the snapshot and the formerly active blocks before the snapshot. Blocks that didn't get replaced don't need to have new pointers stored.
 
Top