Comments (6)
I know this is a bit old, but am just running into this same issue. I need to be able to clean expired snapshots without having to specify all prefixes. This should be able to be done with the -P option, or by default without it. Only specifying -p should refine.
In looking at the source in core.sh, a recommended fix would be to change line 441 in the ValidPrefix() function from this:
437 # Check validity of a prefix
438 ValidPrefix() {
439 local snapshot_prefix="$1"
440
441 [ -z "$PREFIXES" ] && [ -z "$snapshot_prefix" ] && return 0
442
443 local i
444 for i in $PREFIXES; do
445 [ "$snapshot_prefix" = "$i" ] && return 0
446 done
447
448 return 1
449 }
to this:
437 # Check validity of a prefix
438 ValidPrefix() {
439 local snapshot_prefix="$1"
440
441 [ -z "$PREFIXES" ] && return 0
442
443 local i
444 for i in $PREFIXES; do
445 [ "$snapshot_prefix" = "$i" ] && return 0
446 done
447
448 return 1
449 }
The -P option nulls the $PREFIXES variable and it becomes the same as not specifying a -p option. If $PREFIXES is null, we shouldn't be looking for null prefixes in the snapshot name, but rather, we should be ignoring the prefix and returning a valid response with return 0.
Thoughts?
from zfsnap.
One of the other issues points out that you need to include a prefix (-p whatever). There's an option that is supposed to disable requiring prefixes (-P) but it does not appear to be working for me; I get the same behavior as when I run the above commands. Running zfsnap v2.0.0.beta2.
from zfsnap.
@petr-fischer zfSnap v1 is a bit before my time, and I don't remember/know all of the syntax for it. My best advice is to upgrade to zfsnap v2, as it is much better tested and featureful. I've been saying it for too long now... I really need to set aside an evening and release v2 in order to leave v1 behind. Shame on me. ;-)
@graudeejs You use FreeBSD, correct? How should we go about getting v2 in their ports tree? The syntax did break, so I'm not sure if they'd be ok with a normal upgrade path or if they'd prefer a new package. So many of our users are from FreeBSD, it'd really help to get them on latest.
@wolffstarr I'm a bit confused with your problem, as petr-fischer's commands won't work with zfsnap v2; the syntax has changed. Can you be more specific, with some simple examples, of how you expect prefixes to work and how they behave differently than you'd expect?
---Alex
from zfsnap.
@Alexqw Thanks for info! Just looking at the FreeBSD port tree, and there is zfsnap2 package (right way, if syntax was changed!). This package is news to me (added to the port tree on 2016-06-30). Actual version in the ports tree is "2.0.0-beta2" (git tag: af91bd2). So I can comfortably test v2 without issues (or rather wait for v2 final release!). Good news. Thanks (you can close this issue)!
from zfsnap.
@Alexqw: Doh! My apologies, I completely missed the lack of "destroy" after zfsnap. Which, to be fair, I tend to forget to do when I'm typing the command too.
As for prefixes, my assumption originally (which was based on the wording of the prefix options) was that, if I want just a specific prefix I would include "-p prefixname" in the command, and without that it would impact all snapshots regardless of prefix. When leaving out the -p option simply caused the command (for example, "zfsnap destroy -v -r tank/Dataset") to fail silently, I found Issue #74 which indicated -p is required. Again, looking at the output of "zfsnap destroy -h", the -P option says "disable filtering for prefixes", which I would expect to mean "ignore all prefixes". However, this too also fails silently, probably because it's not running a valid command. Adding -v doesn't cause any output either.
So I would expect "zfsnap destroy -r -v tank" to recursively remove all snapshots made for the zpool "tank" and any datasets under it, regardless of prefix. If that would work for snapshots that don't have a prefix, then I would expect -P to mean "apply to all prefixes".
from zfsnap.
@Alexqw zfsnap2 is in FreeBSD port already thanks to [email protected]
https://www.freshports.org/sysutils/zfsnap2/
from zfsnap.
Related Issues (20)
- Argument list too long while deleting old snapshots
- Possibly relying on createtxg and guid properties HOT 4
- smb.conf for zfsnap HOT 1
- Request: Add support for a pre- and post-script HOT 4
- How do I use zfsnap to backup snapshots of one pool to another? HOT 2
- daily snapshots generated, which I never set up HOT 4
- How to use xPERIODICx scripts? HOT 1
- Wanted: new maintainer HOT 7
- zfSnap -d command is not working HOT 2
- zfsnap_delete periodic script needs filesystem arguments
- Make prefixes not need - at the end HOT 3
- Disable filtering when destroying HOT 1
- [feature] Add an option to store TTL as ZFS property - instead of being part of the snapshot name HOT 1
- FATAL: trying to delete zfs pool or filesystem? WTF?
- redirection to stderr prevents use in systemd-services HOT 6
- Recursive snapshot without parent directory
- Is this still an active project? HOT 3
- Delete any snapshots that have expired? HOT 3
- Free predefined amount of space by removing snapshots
- Possibility to use inotify to trigger snapshots HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zfsnap.