# Samba, ZFS and shadow copy (previous versions)



## Savagedlight (Jan 15, 2013)

I currently have the following relevant options in /usr/local/etc/smbd.conf:

```
# Stuff for ZFS  Snapshots
   unix extensions = no
   follow symlinks = yes
   wide links = yes
   vfs objects = shadow_copy2
   shadow: snapdir=.zfs/snapshot
   shadow: sort = desc
   shadow: localtime = yes
   shadow: format = %Y-%m-%d_%H.%M.%S--3w
```
This works, it populates the Previous Versions tab. Everything works as expected with Windows 8 clients.

However, on two separate Windows 7 SP1 clients, the Name field becomes @GMT-YYYY.MM.dd-HH.mm.ss matching the snapshot name/time, with 'Date Modified' equal to what shows up in the 'last modified' columns when you execute _ls -l_ in  the .zfs directory; Which seems to be a rather arbitary date.
If I comment the "shadow: localtime = yes" line, the Windows 7 client will list the proper name (name of the share), but with the incorrect "Date modified" column.

Anyone have any ideas how to make the folder versions display correctly on Windows 7?

Bonus problem:
I use zfSnap to make snapshots. That means it'll append --<expirity> to the snapshot name. I currently use 3w expirity on the 6h snapshots (00:00, 06:00, 12:00, 18:00), and 2m on the weekly snapshots.
Since I've put --3w into the shadow: format definition, it doesn't list the 2m ones. 
Is it possible to list all of them?

Edit:
`$ uname -a
FreeBSD (...) 9.0-RELEASE-p5 FreeBSD 9.0-RELEASE-p5 #1: Sat Dec 29 03:27:31 CET 2012     root@(...):/usr/obj/usr/src/sys/GENERIC  amd64`
`$ smbd --version
Version 3.6.7`


----------



## Sebulon (Jan 16, 2013)

Hi,

for us, you know, we are at the "yeay, itÂ´s working at all"-stage, so while it may sound more like nitpicking, to an uninitiated user that doesnÂ´t, and shouldnÂ´t know about any internals, a "bug" like that can be very confusing.

We have used many different systems that have been able to present snapshots as Previous Versions to users, and they have all had quirks to them. Oracle, EMC, NetApp, and now FreeBSD systems with ZFS and SAMBA all work out quite nicely in the end though, so we have just worked out a manual that tells users how they are supposed to be using PV, instead of them being confused about how they "think" itÂ´s supposed to work.

About zfSnap, if you find any hack, let me know. We are in the same boat

/Sebulon


----------



## usdmatt (Jan 16, 2013)

I have similar issues with the dates on previous versions. I did write about it in an earlier post on here mentioning that it would be nice to have a ZFS specific shadow_copies samba module that tied in with the snapshot creation dates (I did look at the code for the current module which, while fairly short, is still beyond me).

My problem is as follows:
For files it's fine, I can right click on a file and view any previous versions with the name column being the filename and the date column being the modified date of that version of the file. It only shows actual previous versions so if a file hasn't changed in any snapshots, nothing is listed.

For directories exactly the same thing happens. The problem is that it shows an entry for each snapshot (I assume because it can't guarantee the contents are the same so just shows all of them). This makes sense but unfortunately the date column works just like files and displays the modified date of the folder, which as you mention is pretty useless. If I want to browse that folder as it was a few weeks or months ago I just have to pick an entry almost at random.

The same thing happens on the root of the share (which is also the root of the ZFS dataset) although the name column displays '@GMT-xxxxxxx' when I'd ideally rather just have the root folder name so it's consistent. On this entry I have got round the date column problem by 'touch'ing the root dataset folder just before I take each snapshot.

This is a workable fix for me. For files it all works fine. If I want to browse folders in a specific snapshot, I just go to previous versions on the mapped drive itself which shows a list of versions all with the correct snapshot date, nicely grouped into this week/last week/etc, albeit with '@GMT-xxxxx' in the name column.


----------

