-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZFS-auto-Snapshot and Samba shadow: snapprefix interaction #84
Comments
I am by far an expert on this and my memory on how I set up my server is hazy but I have some notes which may help. As suggested by: #10 I edited the cron files to change the naming system (i.e. the label argument) for the snapshots following the scheme below:
As a result of this the snapshots have the name format: I then made the following settings in my smb.conf file: vfs objects = shadow_copy2 Note that the last argument is probably the most critical - it matches the format of the snapshots. In effects it uses %S (seconds I think) as a variable character that has no impact. The snapshot directory can be made visible by issuing the following command (but you have probably done this already). sudo set snapdir=visible pool1/media I hope this helps. |
Agreed - localtime is not a good idea. However, the difficulty of setting up snapshots in a format that are suitable for visibility in a samba context might be worthy as considering as a bug/product deficiency. Perhaps the scripts and install could allow for that in some way? Arguably samba could be modified to help setup ZFS appropriately. However, I think it would be reasonable to argue that samba shouldn't have to be aware of every file system but ZFS could be aware of this common use case for ZFS. |
So, are you both talking about this localtime : Thank you both for the insight on this. Yes, I do realize this is a bug tracker, but sometime when you exhaust other resources..... You go to the experts of the script. |
There is a howto to make z-a-s work easily with samba shadow shares. it works great if you follow it. you can adjust your current snapshots to that style, add the properties it needs then rename. |
Beren12, thanks for your input. Yes indeed, I can get the shadow copies to work without issue. The problem is, is that I want multiple levels of shadow copies. I don't just the frequents (Which I don't use). I want the hourlys, dailys, monthlys at the very least to show up. It does appear that the #10 issues is how I need to go it. The regular expression method provided by Samba doesn't appear to work. Which is unfortunate because I didn't want to lose the naming of daily, montly, etc. I plan to have this end-user facing. |
You still didn't read that page. Every snapshot is available because they have a common name. They use a property to tell z-a-s the type, it's not encoded into the name at all. you can convert your current snapshots to that as well by adding the correct property, then renaming them. Easy to script. |
hummm, are you talking about the addition of the leecallen modifications??? I did not do because I don't really know how to do that. Specifically "Fix manual conflict". what ever that means. All I know, is that that stock script will not show all the various snapshots. It only shows the level based on the shadow: format entry in smb.conf |
you just look in the file it tells you for conflicts. basically remove the conflict text. if the tool doesn't work, try again :) |
I appreciate the comments, but I don't think that is a good way to do it. Beside, I don't want to mess with code I know nothing about. There should be absolutely no reason why I should have to change the naming to get this to work since Samba is suppose to have this built in now. Just my thoughts |
I'm running 16.04's Samba, which doesn't support the snapprefix and delimiter options yet, but I think your problem is just your regular expression. From the docs: "The option only supports Basic Regular Expression (BRE)." (), {}, etc. are matched literally in BRE, not treated as grouping characters. Try this: |
I realise this is an old issue, but I hope this can be helpful to someone. It's a bit of a hack but it works with the default zfs-auto-snapshot names and will be fine until 2100.
|
@benpye thanks for sharing that - does this still work well for you? Have you used it in production? |
@recklessnl This works fine for me. My "production" use is a home server but I have no reason to think it shouldn't work in a production environment. |
@benpye Could you help with the syntax to get this to work? I have my snapshots being written like this: autosnap_2018-03-17_11:30:00_frequently And I can't get the snapprefix and formatting to work in Samba. What values should I use in order make Samba work with snapshots that are being made in the above format? |
I don't think windows plays niceley with ':' chars in snapshot names.
Please let me know if that worked for you. |
@recklessnl & @benpye autosnap_frequently_ 2018-03-17_11.30.00 = Should be fine Does anybody know how we make things work with snapshot names appending characters on the end of the name? |
I know this is an old issue. But this is one of the top results when I looking for help, so hopefully this will be visible to the next poor soul trying to figure this out. A general wildcard pattern that works:
Like DeViLRuNNeR-dev says, naming pattern with wildcard after the timestamp won't work. Also, More examples and explanations in my gist. |
First off. My appologizes if this is not the right place to post this. I have tried the Samba forums.
Looking for a little assistance on this as I have been unsuccessful is
getting the shadow: snapprefix, shadow:delimiter and shadow:format to work
as I expect.
I have no issue with getting previous versions in Windows to show me either
hourly, daily or weekly, etc snapshots as previous versions. But I would
like to be able to expose all.
The shadow:snapprefix, etc seems to be the way to do it, but I am unable to
get it to work.
When I setup the prefix, etc, I get no previous versions at all.
My setup in Smb.conf is below, and my directories are named as follows:
shadow:snapprefix =
^(zfs-auto-snap_dai){0,1}(zfs-auto-snap_hour){0,1}$
shadow:delimiter = ly-
shadow:format = ly-%Y-%m-%d-%H%M
Directories :
zfs-auto-snap_daily-2018-01-01-1235
zfs-auto-snap_daily-2018-03-15-1135
zfs-auto-snap_daily-2018-03-29-1135
zfs-auto-snap_hourly-2018-04-03-1817
zfs-auto-snap_hourly-2018-04-04-0817
zfs-auto-snap_weekly-2018-01-17-1240
and a lot more then that
Etc, etc, etc
When I do something like : shadow: format =
zfs-auto-snap_hourly-%Y-%m-%d-%H%M
in the smb.conf, without the prefix, etc, there are no issues. I see the
hourlys appear in my previous versions.
I do understand that this might be outside the scope of this forum, but I thought maybe there is something in the zfs-auto-snapshot script that I could do to make it work, or other of you here have experience using the Samba shadow:snapprefix.
I am using the latest version of Samba, and Ubuntu 16.04, and your ZFS-auto-Snapshot.
Great script.
Any help would be appreciated.
Regards
The text was updated successfully, but these errors were encountered: