egara / buttermanager

ButterManager is a BTRFS tool for managing snapshots, balancing filesystems and upgrading the system safetly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Proposal] Show snapshot-exclusive files size

lapineige opened this issue · comments

Hello,

I would like to make a proposal : buttermanager could feature a "snapshot exclusive files size" (or rather a "how much storage space as been freed since that snapshot") next to each snapshot.
That would give us an (approximate ?) extra amount of storage that is used by that snapshots, or more precisely by the files (from that snapshot) that are unique (=only found in that snapshot, and no longer present in the system).

I have no idea how doable and difficult it is, I just wanted to know if that something that could be implemented :)
For the record, that's a feature available in Timeshift that I found very handy to catch which snapshot is taking a lot of space.

Thank you

For the record, right now I'm doing it with btrfs filesystem du -s SnapshotFolder(s). But it is slow (like du) and create moderately high (IO) load.
The result gives us Total, Exclusive and Set shared storage spaces.
I realise that, even if my goal here was to display the Exclusive value, giving the Total one is interesting too.

Hi @lapineige and again, thanks for your feedback!!

I don't know exactly what all this means. For this new feature to be useful, a new independent tab should be implemented or this size could appear next to each snapshot within the Snapshots tab?

I've found a script that gives all this information here https://github.com/nachoparker/btrfs-du (I tried to execute the command you gave me but some errors were thrown. After executing this script I learned that I need to enable BTRFS quota).

Could you check that script and tell me if it is useful? If it is, maybe I can contact the developer who created and include it somehow in ButterManager.

Thanks again for your time and feedback!

For this new feature to be useful, a new independent tab should be implemented or this size could appear next to each snapshot within the Snapshots tab?

I was thinking about the second option. Something similar to Timeshift for instance: https://laborversuch.de/wp-content/uploads/2020/03/main_window.png

Could you check that script and tell me if it is useful? If it is, maybe I can contact the developer who created and include it somehow in ButterManager.

In my case I would like not to enable BTRFS quota…
Did you have to enable it to execute btrfs filesystem du command ?

edit: I tried that btrfs-du script, well it works out of the box (and the result is very neat), so maybe I have quota enabled 🤔

edit2: I tried on another btrfs partition, turns out I have quota enable on / but not on the other partition.
Then :

INFO: Quota is disabled. Waiting for rescan to finish ...

This takes forever… uh well I mean 10s, but this is long 😅. But way faster than btrfs filesystem du.

I would be against adding such a feature if it means forcing the user to enable quota, or (worse) enable it for them, and there is still some issues with quota (namely performance issue with many snapshots https://btrfs.wiki.kernel.org/index.php/Status).
But if that works (in a slower way) without them… why not ? :)

I've been digging into btrfs-du script. I don't have quota enabled so, the script will enable it, calculate the space and then disable it again.

Maybe this feature could be disabled by default and include some checkbox to enable it. Then, every time a snapshot is created, launch the script, calculate the information and store it to display it after.

btrfs-du is in AUR for Arch Linux, but I don't know if this package exists on other distributions. Maybe the best way to do it is to re-implement this script in Python in order to include it out of the box with ButterManager.

I'll take a deeper look at the script. By the way, could you attach the information retrieved from btrfs-du script and tell me what values would be useful to see next to every snapshot?

I don't have quota enabled so, the script will enable it, calculate the space and then disable it again.

Oh, that's very interesting !

Maybe this feature could be disabled by default and include some checkbox to enable it. Then, every time a snapshot is created, launch the script, calculate the information and store it to display it after.

I'm ok with that, then a tooltip or so could warn about quota being enabled for a few seconds 🤔

Maybe the best way to do it is to re-implement this script in Python in order to include it out of the box with ButterManager.

I think so too, that would ease a lot the packaging 🤔
It's not on Ubuntu by the way.

what values would be useful to see next to every snapshot?

I'm looking for the "exclusive" size. That would tell me how much extra space is taken by that specific snapshot. That's particularly interesting to know 1) how much space can be freed by deleting that snapshot 2) have an estimation about how much data changed since that snapshot (and maybe how much important it can be). 1) is my goal and main use case here (for that proposal I mean).
The "total" size can be interesting to display too. It's just like "Size" and "unshared" here in Timeshift https://laborversuch.de/wp-content/uploads/2020/03/main_window.png

Hello :)

Any update on that ? Do you wish to implement it ?
Do you need help for testing ?

Thanks

Hi @lapineige

Sorry, I have not started to think about how to implement this feature because a lack of time :(

I'll have to dig into it again.