1

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, say Letter.txt or even Draft2.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 version Letter.txt (now having two files), the first has the history and the second does not (this is OK). If I delete Draft1.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:

  1. Never rename files, first chosen name has to stick around forever
  2. Never move or reorganize files, except in the first day (otherwise the lost changes would be too great)
  3. Never save a file with a new name after changes have been done (saving it first is OK though)
  4. 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?

2

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.

  • Yes, technically the history is not lost, you are correct. If you have the name, you could find it recursively on all hidden .zfs directories on the Unix system - but the Windows GUI only shows what is there, it does not track name/location modifications. – user121391 Apr 28 '16 at 6:39
  • Another way to look at it might be this: if I move a file, should its history be moved with it because it belongs to the file or should it stay on the old location because it belongs to the directory? It seems the second version was chosen by Sun, maybe because it works on file systems (which are seen as directories by Windows) and not on files. – user121391 Apr 28 '16 at 6:43
  • I understand what you're asking for. Unfortunately that would require fairly deep integration between the windows client and ZFS which just isn't there. As mentioned above, all Windows can do is look through the previous versions it's been given (which are effectively just exposed as directories) and find older copies of the file you have selected. You can still access all the data on Windows without having to go into the .zfs directories on the server, but you'd need to remember the old name/directory you're looking for. – USD Matt Apr 29 '16 at 10:32
  • After some thought, I've accepted your answer because it looks like you are right. Windows seems to just look at the .zfs directories of the shared filesystem and there are only snapshots of points in time with the complete layout, not an individual file history like in version control systems. Not perfect, but I think I can live with this view. Thanks again for answering! – user121391 May 19 '16 at 12:15
  • @user121391 Yes, ZFS snapshots are simply read-only moment-in-time markers. – user Jun 15 '16 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.