Skip to content
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

Remove 'label' (eg frequent/hourly/daily etc) from snapshot name and place in snapshot property #22

Closed
wants to merge 2 commits into from

Conversation

leecallen
Copy link

Re: issue #10 "Integrate shadow copy snapshots for Samba"
Remove 'label' from snapshot name and place in a snapshot property.

This change breaks the --fast option. It may be possible to preserve that feature but it's beyond my scripting skills.

Remove 'label' from snapshot name and place in a snapshot property
@leecallen leecallen closed this Feb 10, 2014
@leecallen leecallen reopened this Feb 10, 2014
@leecallen
Copy link
Author

Fixed the --fast option.

@leecallen leecallen closed this Feb 10, 2014
@@ -347,10 +352,10 @@ ZFS_LIST=$(env LC_ALL=C zfs list -H -t filesystem,volume -s name \

if [ -n "$opt_fast_zfs_list" ]
then
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -o name -s name|grep $opt_prefix |awk '{ print substr( $0, length($0) - 14, length($0) ) " " $0}' |sort -r -k1,1 -k2,2|awk '{ print substr( $0, 17, length($0) )}') \
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -o com.sun:auto-snapshot-label,name -s name|grep $opt_prefix |awk '{ print substr( $0, length($0) - 14, length($0) ) " " $0}' |sort -r -k1,1 -k3,2|awk '{ print substr( $0, 17, length($0) )}') \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

produce the listing with label first, then name, so the awk/sort stuff works correctly

@dajhorn
Copy link
Member

dajhorn commented Feb 11, 2014

@leecallen, thanks. I will look at this when Trusty goes into beta in a few weeks.

@dajhorn dajhorn reopened this Feb 11, 2014
@dajhorn
Copy link
Member

dajhorn commented Apr 16, 2014

@leecallen, I merged this pull request into a topic branch for testing. This script is dash-compatible by design, so I need to think about the "${arrjj[1]#$ii@$GLOB}" line.

@@ -186,7 +191,7 @@ do_snapshots () # properties, flags, snapname, oldglob, [targets...]
fi
fi
fi
done
done <<< "$SNAPSHOTS_OLD"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Debian Wheezy this line gives me a Syntax error: redirection unexpected. The dash shell does not have the <<< operator: http://stackoverflow.com/a/2462357/2728336

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quick workaround for me was to define bash as the specific shell: #!/bin/sh -> #!/bin/bash. This might affect Ubuntu also.

Copy link

@exenza exenza May 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've merged @leecallen as per instructions on the wiki and I've changed to /bin/bash but now I'm getting echoed the error "The filesystem argument list is empty." (line 350 is the print)
I'm on Debian 8.8. I've installed via "make install" because after the merge with leecallen it fails to build the deb package

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, when running zfs-auto-snapshot using bash without arguments, I did get the error that you mention ("The filesystem argument list is empty"). However, when running it with the correct arguments, it worked fine. I used the following arguments:

bash ./zfs-auto-snapshot --quiet --syslog --label=frequent --keep=4 //

@leecallen
Copy link
Author

Yes that's an ugly bit of code.

I am not sure I ever explained the reason for these changes. I am using
ZFSonLinux + zfs-auto-snapshot + Samba. Windows clients can see the
snapshots as "previous versions" if the snapshot names have a naming scheme
that can be defined in smb.conf. That requires a constant prefix, followed
by a formatted date, The date formatting is flexible but the prefix must be
constant, so it cannot contain eg "frequent", "hourly", "daily", etc.

Lee

On Wed, Apr 16, 2014 at 4:20 PM, Darik Horn [email protected]:

@leecallen https://github.com/leecallen, I merged this pull request
into a topic branch for testing. This script is dash-compatible by design,
so I need to think about the "${arrjj[1]#$ii@$GLOB}" line.


Reply to this email directly or view it on GitHubhttps://github.com//pull/22#issuecomment-40647067
.

Lee Allen
email: [email protected]
cell: (716) 880-0854
fax: (716) 408-8844

@maczkojanos
Copy link

Hi,

please explain: how to setup properly zfs-auto-snapshot for windows?
I'll try this : https://github.com/zfsonlinux/zfs-auto-snapshot/wiki/Samba , but i cant know, how to "fix a conflict".

Thanks
Janos

@stuehmer
Copy link
Contributor

Hello Janos, "fixing the conflict" means looking at the file (after having completed the steps listed before) using a text editor and fixing the problem which is marked by the marker <<<<<<<. Those are conflicts that git could not fix automatically for example when two people edited the same line.

An explanation is e.g. here: http://genomewiki.ucsc.edu/index.php/Resolving_merge_conflicts_in_Git paragraph How do I find conflicts within the file itself? and the next paragraph.

@beren12
Copy link

beren12 commented Jul 29, 2019

Any chance this can get updated for latest master?
Or os there another tool that can do the same thing? I need static snapshot names for samba

@highvoltage
Copy link
Contributor

Hi, thanks for the work that you've done on this before. If you're still interested, please submit a renewed patch against master since master has diverged too much already in the last few years. This upstream project has been dead for a while and I'm trying to revive it, so all input is appreciated.

@stuehmer
Copy link
Contributor

@beren12 you won't need special snapshot names for Samba starting with Samba 4.6.2 which became more flexible. See https://github.com/zfsonlinux/zfs-auto-snapshot/wiki/Samba 'Update: Starting with Samba 4.6.2 [...]`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants