Comments (3)
You must specify exact prefix.
in your case this is -p 'hourly-'
Note the quotes.
I see there is a bug with -D switch, that prevents deleting snapshots with prefix.
However -d flag works fine
The regexp is fine. Here's the proof:
echo "test" | grep -E -e '^t()?est$'
BTW, you shouldn't use -D flags to delete snapshots (it ignores TTL)
You should use -d flag instead.
Hope to fix this bug when I have time...
If you got patches, feel free to for and request pull.
from zfsnap.
You must specify exact prefix.
in your case this is -p 'hourly-'
Note the quotes.
Quotes shouldn't be required, there's nothing to escape for the shell.
I see there is a bug with -D switch, that prevents deleting snapshots with prefix.
However -d flag works fineThe regexp is fine. Here's the proof:
echo "test" | grep -E -e '^t()?est$'
The regexp is valid, but it wasn't ever matching. Imagine the input:
zfSnap -D tank/usr/home
I want to delete all snapshots on tank/usr/home. This will fail:
echo tank/usr/home@hourly-2012-10-03_11.04.00--3d | grep -E -e '^(|tank/usr/home)@()?-20[0-9][0-9]-[01][0-9]-[0-3][0-9]_[0-2][0-9].[0-5][0-9].[0-5][0-9]--([0-9]+y)?([0-9]+m)?([0-9]+w)?([0-9]+d)?([0-9]+h)?([0-9]+M)?([0-9]+[s]?)?$'
In the event of an empty prefix, the prefix regexp should default to '[^-]+' which would result in:
echo tank/usr/home@hourly-2012-10-03_11.04.00--3d | grep -E -e '^(|tank/usr/home)@([^-]+)?-20[0-9][0-9]-[01][0-9]-[0-3][0-9]_[0-2][0-9].[0-5][0-9].[0-5][0-9]--([0-9]+y)?([0-9]+m)?([0-9]+w)?([0-9]+d)?([0-9]+h)?([0-9]+M)?([0-9]+[s]?)?$'
Which works.
BTW, you shouldn't use -D flags to delete snapshots (it ignores TTL)
You should use -d flag instead.
Using -D was correct in this situation, the user was doing something to the effect of:
while 1
cat old > new
cat new > old
end
:~]
Hope to fix this bug when I have time...
If you got patches, feel free to for and request pull.
Aye. I haven't tested this yet, but I was thinking about something like:
diff --git a/zfSnap.sh b/zfSnap.sh
index 54318bc..d12e9b8 100755
--- a/zfSnap.sh
+++ b/zfSnap.sh
@@ -370,7 +370,10 @@ fidelete all snap
if [ "$delete_specific_snapshots" != '' ]; then
if [ "$delete_specific_fs_snapshots" != '' ]; then
rm_snapshots=`$zfs_cmd list -H -o name -t snapshot | grep -E -e "^($(echo "$delete_specific_fs_snapshots" | tr ' ' '|
if [ -z "$prefixes" ]; then
prefixes='[^-]+'
fi
rm_snapshots=`$zfs_cmd list -H -o name -t snapshot | grep -E -e "^($(echo "$delete_specific_fs_snapshots" | tr ' ' '| for i in $rm_snapshots; do rm_zfs_snapshot $i done
Which would let you do:
zfSnap -D tank/usr/home
zfSnap -p hourly -D tank/usr/home
zfSnap -p 'hourly|daily' -D tank/usr/home
? I think calling it a prefix is a bit misleading since it's really the frequency at which a particular snapshot is taken. Anyway, I think that's the easiest. I could change , to |, too. Anyway, LMK if that works for you and I can submit a formal pull request. -sc
Sean Chittenden
[email protected]
from zfsnap.
Instead of "hourly-" it could have been "whenever-possible-".
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.