I have a NAS running on OpenSolaris/illumos/OmniOS with several shared ZFS file systems where autosnaps are active to preserve a history (keep 4 15-minute snaps, 24 hourly snaps, 7 daily snaps and so on). I can access the snapshots with the Windows Explorer Previous Versions window and restore older versions of files or deleted files, which works fine.
The problems I have appear when renaming or moving files:
- If I create
Draft1.txt
and modify it over the course of a day, the history is preserved. When I've finished the draft and rename it to anything else, sayLetter.txt
or evenDraft2.txt
, the versions vanish (they can only be accessed via directory when knowing the old filename or with renaming the file to the old name). - If I create and modify
Draft1.txt
and later save another copy of the finished versionLetter.txt
(now having two files), the first has the history and the second does not (this is OK). If I deleteDraft1.txt
and then want to restore it, I can find it in the directory, but the restored version has now lost its history. - If I move a file to another subdirectory, the history is lost.
- If I (accidentally) rename a file, the history is lost.
So if I want to preserve the full power of previous versions, I have to think of several things when working with the share:
- Never rename files, first chosen name has to stick around forever
- Never move or reorganize files, except in the first day (otherwise the lost changes would be too great)
- Never save a file with a new name after changes have been done (saving it first is OK though)
- Never merge or split directories, because all the contents lose all their history, even if the physical blocks do not change at all
Is there anything I could about this, except live with it? It seems strange that ZFS works on blocks on most things (copy-on-write, send/recv, zvols, snapshots), but does on files in this case. Or is this a limitation of the SMB/CIFS subsystem instead of the file system?
I think this might just be a limitation of the way it works. To me it seems to just scan the snapshots for different versions of the current file, so won't show any versions if the file has been renamed.
However I'm not sure what you mean by history being lost if you move a file to another directory. On my FreeBSD/Samba system I can view previous versions on the share itself. This gives me a full list of all snapshots and I can browse any snapshot, showing the entire contents of the share as it was at that point in time.