1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Samba 3.6 and Volume Shadow Copy/Previous Versions with ZFS

Discussion in 'Web and Network Services' started by aXon, May 25, 2012.

  1. aXon

    aXon New Member

    Messages:
    7
    Thanks Received:
    0
    I am using FreeBSD 9.0 and have Samba 3.6 installed with a patch from http://www.en.sysadmin-cookbook.net/samba/#toc-gen-6 included in /usr/ports/net/samba36/files before the compilation.

    In my smb.conf I have following entry to enable shadow copy/ Previous versions for Windows clients
    Code:
    [Shared]
       comment = Public Stuff
       path = /pool/shared
       public = yes
       writable = yes
       vfs objects = shadow_copy2
       shadow: snapdir = .zfs/snapshot
       shadow: sort = desc
       shadow: format = AutoH-%Y-%m-%dT%H:%M


    I use a rolling ZFS backup script, and my snapshots fit the format I have given in the smb.conf:
    Code:
    pool/shared@AutoH-2012-05-24T10:00
    pool/shared@AutoH-2012-05-24T11:00
    pool/shared@AutoH-2012-05-24T12:00
    pool/shared@AutoH-2012-05-24T13:00
    pool/shared@AutoH-2012-05-24T14:00
    pool/shared@AutoH-2012-05-24T15:00
    pool/shared@AutoH-2012-05-24T16:00
    pool/shared@AutoH-2012-05-24T17:00
    pool/shared@AutoH-2012-05-24T18:00
    pool/shared@AutoH-2012-05-24T19:00
    pool/shared@AutoH-2012-05-24T20:00
    pool/shared@AutoH-2012-05-24T21:00
    pool/shared@AutoH-2012-05-24T22:00


    It all works fine in Windows, I can got into the properties of items on the network share and find "Previous Versions" as a selectable tab there. Now the problem: it only seems to detect folder versions, but nothing is displayed for files. I can copy and restore directories, but nothing with files.

    The working tab looks like in this screenshot
    [​IMG]

    Resources on the use of Volume Shadow Copy and Previous versions in conjunction with samba are scarce and date quite some time back (as well as being mostly about Solaris). The screenshot shown is from Windows XP SP3 and I have tested the same share on a Windows 7 setup, so my guess is that it seems like a server/samba/smb.conf issue?

    I would be glad for any input someone could offer on this topic :)
     
  2. acheron

    acheron Member

    Messages:
    116
    Thanks Received:
    19
    "Previous Versions" works fine here without the patch from http://www.en.sysadmin-cookbook.net/samba/#toc-gen-6. I just need to put the following line in the global section of smb.conf:
    Code:
    unix extensions = no

    and these lines in the share section:
    Code:
    follow symlinks = yes
    wide links      = yes
     
  3. aXon

    aXon New Member

    Messages:
    7
    Thanks Received:
    0
    Thank you for your input acheron :)
    I have deleted the patch file as well as recompiled/-installed samba and added your suggested parameters to my smb.conf.
    Now a shared entry sample looks like this in the config
    Code:
    [Shared]
      path=/pool/shared
      follow symlinks = yes
      wide links = yes
       vfs objects = shadow_copy2
       shadow: snapdir = .zfs/snapshot
       shadow: sort = desc
       shadow: format = AutoH-%Y-%m-%dT%H:%M


    Unfortunately still no luck as "Previous Versions" tab not showing any entries, but directories do. Could you please post a full example share that works, or maybe example smb.conf file you use, maybe I am missing something else. Thanks again.
     
  4. ondra_knezour

    ondra_knezour Member

    Messages:
    458
    Thanks Received:
    54
    Just blind shoot - compare yours FreeBSD version with acherons one. Last week I had somehow similar problem. Midnight commander installed on FreeBSD stable was displaying only empty directories over ssh link to computer with 9-release. After updating remote computer to stable branch problem disappeared.
     
  5. aXon

    aXon New Member

    Messages:
    7
    Thanks Received:
    0
    Ok, here we go:
    Code:
    FreeBSD hostname 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     
    root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
    samba36-3.6.5
    

    Ports are up to date as well.
     
  6. acheron

    acheron Member

    Messages:
    116
    Thanks Received:
    19
    I'm running CURRENT (I don't know the exact svn revision). My smb.conf is similar to yours. I'm not sure I understand what you mean with
    You just need to double click on the "previous version" you are interested in and an Explorer will pop up and let you pick whatever files/directories you want from that snapshot.
     
  7. aXon

    aXon New Member

    Messages:
    7
    Thanks Received:
    0
    Ok, so we are using a different versions, if this has anything to do with it.

    Maybe I have to clarify how I access "Previous versions" in Windows 7 and XP: I right click on any element, be it file or directory, on the network samba share in the Explorer and select "Properties" and from there I access the tab "Previous versions", which looks like the one in my first post. Now, this only gives me a populated list for directory properties, but for file properties the list of available snapshots is empty. When I select copy or restore for a directory in "Previous versions", everything works, so I am not sure what goes wrong for files.

    Thanks again ;)
    PS: If there is another way of accessing files/directories as you described, I don't know about it, which is why I use PV like I do through Explorer Properties.
     
  8. acheron

    acheron Member

    Messages:
    116
    Thanks Received:
    19
    Ok I see what you mean and I have the same behaviour. What I was doing is right click on the network share, select properties, previous version and double clik on the snapshot I'm interested in.