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

Feature request : prune subcommand #16

Open
eoli3n opened this issue May 9, 2020 · 4 comments
Open

Feature request : prune subcommand #16

eoli3n opened this issue May 9, 2020 · 4 comments
Assignees
Labels
Priority: Low Status: Help Wanted Extra attention is needed Type: Enhancement New feature or request

Comments

@eoli3n
Copy link

eoli3n commented May 9, 2020

I started to work on a pacman hook and his prune script.

https://github.com/eoli3n/zectl-pacman-hook

I get into some little problems which could be fixed by some zectl query arguments.
Would you check TOFIX lines and tell me what's possible or not ? (It's not usable as is, just a POC to show the idea).
https://github.com/eoli3n/zectl-pacman-hook/blob/master/zectl-prune.sh#L4

Maybe you should consider managing prune subcommand in zectl ?
Something like borg prune would be great : https://github.com/eoli3n/dotfiles/blob/wayland/roles/borgbackup/files/backup#L34

See you.

@johnramsden
Copy link
Owner

I'll definitely think about it, I don't want to add too much extra code that isn't core to the tool, so I'm hesitant to add extra commands, but I will consider it. I do think it would be possible to get the functionality you looking for with your script.

Reviewing your TOFIXes I have some questions/feedback.


L4

TOFIX: 'zectl' needs an 'unset' subcommand

Are you just looking to "erase" a property?

be_active_ds="$(zpool get bootfs -H -o value)"
be_root="${be_active_ds%/*}"
zfs inherit org.zectl:yourprop "${be_root}"

L24

TOFIX: 'zectl get -H nonexistantkey' should print an error and exit 1

Can you work with just having the property empty -? I'm trying to follow zfs get as closely as possible, and that is the behaviour it uses for a non-existent user property.

L47

TOFIX: 'zectl list' needs a positionnal arg to filter/query 'ACTIVE|BOOTED|NONE' envs

I would rather not add a argument just to remove non N/R/RN environments.

L52

TOFIX: 'zectl list' needs a positionnal arg to order by date

This, I would like to just do by default. If you'd like to open an issue for a feature request to remind me, I will put it on my list. I'm not promising any time frame though. We also take PRs ☺️

@eoli3n
Copy link
Author

eoli3n commented May 10, 2020

Are you just looking to "erase" a property?

Thanks it worked.

❯ zfs get all zroot/ROOT | grep zectl
zroot/ROOT  org.zectl:pacmanhook             yes                              local
zroot/ROOT  org.zectl:bootloader             systemdboot                      local
zroot/ROOT  org.zectl:org.zectl.pacmanhook   yes                              local
zroot/ROOT  org.zectl:pacmanhook-prunecount  5                                local

~
❯ sudo zfs inherit -r org.zectl:org.zectl.pacmanhook zroot/ROOT

~
❯ zfs get all zroot/ROOT | grep zectl
zroot/ROOT  org.zectl:pacmanhook             yes                              local
zroot/ROOT  org.zectl:bootloader             systemdboot                      local
zroot/ROOT  org.zectl:pacmanhook-prunecount  5  

Can you work with just having the property empty -?

I do with this -> https://github.com/eoli3n/zectl-pacman-hook/blob/e654483d2d461c0407990ff7b15607cc08bb5746/zectl-prune.sh#L31

I'm trying to follow zfs get as closely as possible

I agree with this.

I would rather not add a argument just to remove non N/R/RN environments.

So let's keep piping into grep -Ev '\ N\ |\ NR\ |\ R\ ' : https://github.com/eoli3n/zectl-pacman-hook/blob/e654483d2d461c0407990ff7b15607cc08bb5746/zectl-prune.sh#L48

We also take PRs

I would like to, but i'm not a C dev :)

Let's rename that issue. Thanks for your answer !

@eoli3n eoli3n changed the title zectl pacman hook and prune script Feature request : prune subcommand May 10, 2020
@eoli3n
Copy link
Author

eoli3n commented May 10, 2020

About the prune subcommand, i think that i would be a useful feature.
Creating snapshots is a thing, but it's more powerful when automated, and it's harder to manage snapshots rotation well without a prune function.

Here's a good base of what it could be : https://borgbackup.readthedocs.io/en/stable/usage/prune.html

@eoli3n
Copy link
Author

eoli3n commented May 11, 2020

AUR hook package in online ;) https://aur.archlinux.org/packages/zectl-pacman-hook/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Status: Help Wanted Extra attention is needed Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants