bahamas10 / zfs-prune-snapshots Goto Github PK
View Code? Open in Web Editor NEWRemove snapshots from one or more zpools that match given criteria
Home Page: http://daveeddy.com/2015/12/05/automatic-zfs-snapshots-and-backups/
License: MIT License
Remove snapshots from one or more zpools that match given criteria
Home Page: http://daveeddy.com/2015/12/05/automatic-zfs-snapshots-and-backups/
License: MIT License
./zfs-prune-snapshots: line 145: Shows@data_1534448870 1534448871: syntax error: invalid arithmetic operator (error token is "@data_1534448870 1534448871")
I know it's old and I shouldn't have a space, but any chance you could help fix it? I looked thru the code, but I'm not super good with bash.
What do you think, is it time for a first release of this?
I would like to include this script in Alpine Linux and it would help if its tagged.
I've tried using the correct path /usr/local/bin/zfs-prune-snapshots 1M
but then I get the message Error! zfs command not found. Are you on the right machine?
Any clue as to what I'm doing wrong?
It'd be great if we had an option to run dry-run
or something else that would show an amount of space taken by zfs snapshots.
A nifty improvement might be if the dry run option also confirmed whether you had the permissions to actually do the deletion.
e.g. you can do a dry run without sufficient rights and it's a bit misleading.
I do note that the 'native' zfs destroy has the same issue, so perhaps this is either everyone's preferred behaviour, or it's difficult to implement.
Hi team,
I'm trying to use this script, i do not have any coding experience.
my SunOS version is 11.4. when i'm running the script i got below error
./zfs-prune-snapshots.sh: line 161: %s: syntax error: operand expected (error token is "%s")
Please help to suggest what went wrong.
Thanks
Rohit
If I ask to prune a number of days, it correctly picks the snapshots to remove, but labels them all '1 week old' rather than 'X days old'
»»»» date
Wed 22 May 2024 10:03:24 AM EDT
»»»» zfs-prune-snapshots -n -R 10d
found 28 snapshots (165 GB) on pools: <all>
[dry-run] [1/28] removing tank/backup@autosnap_2024-05-09_18:02:17_daily: 1 week old (56 KB)
[dry-run] [2/28] removing tank/backup@autosnap_2024-05-10_00:00:20_daily: 1 week old (0 B)
[dry-run] [3/28] removing tank/backup@autosnap_2024-05-11_00:00:17_daily: 1 week old (0 B)
[dry-run] [4/28] removing tank/backup@autosnap_2024-05-12_00:00:27_daily: 1 week old (56 KB)
#snipped...
Hi, I'm still wrapping my head around what happened.
The core issue that zfs destroy
can delete a whole dataset.
In my case, it deleted the release snapshots of my jails, with the recursive options. Jails are by default created as clonejails, so effectively it deleted the /root
of my jails.
I'm not sure if there is anything that could be done by the script, but maybe a disclaimer could be sufficient on the README?
I was able to save 4 out of 7 jails because those four were busy and the snapshots couldn't be deleted.
It would be nice to have a running counter of how many snapshots are left to remove.
Something like:
removing 81 of 9512 tank/dataset@autosnap_date
Thanks.
When using syncoid, or other send-based backup solution, the last snapshot is used to calculate the delta to send an incremental stream. Using your script in that application would run the risk of destroying snapshots that zfs send/recv needs for incremental backup. It'd be nice if there was a feature to protect the last x
number of snapshosts as to ensure their existence regardless of time cut-off point.
Hi,
Love the project, extremely useful.
When cleaning up, I am getting alot of snapshot has dependent clones use '-R' to destroy the following datasets:
Would be really helpful if there was a safe was to deal with this in batch.
Tried it and it helped, thank you !
Currently, there is no way to know how to install your code. Is it possible to add a "how to install" section in the readme ? It would be even better to have GitHub releases used (well, and in the best of the worlds a PPA for ubuntu noobs like me 😅, but I do understand if ou don't find that mandatory)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.