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

Tool for understanding each snapshot used space size #51

Closed
MurzNN opened this issue Feb 26, 2014 · 9 comments
Closed

Tool for understanding each snapshot used space size #51

MurzNN opened this issue Feb 26, 2014 · 9 comments

Comments

@MurzNN
Copy link

MurzNN commented Feb 26, 2014

Very often users want to know, how much size use each snapshot, for understand which snapshots eats most of space. At now I can't find human-understandable report that show this information.

On ZFS there are command:

# zfs list -t snapshot

that shows total snapshot size and used size in easy and human-readable way:

zfs-disks/home@zfs-auto-snap_monthly-2014-01-23-0800   1,44G      -  21,9G  -
zfs-disks/home@zfs-auto-snap_daily-2014-02-04-0915     17,3M      -  21,7G  -
zfs-disks/home@zfs-auto-snap_weekly-2014-02-04-0916    12,8M      -  21,7G  -
zfs-disks/home@zfs-auto-snap_daily-2014-02-05-1010      304M      -  21,9G  -
zfs-disks/home@zfs-auto-snap_daily-2014-02-06-0914      466M      -  21,9G  -
zfs-disks/home@zfs-auto-snap_daily-2014-02-10-0934      199M      -  21,3G  -

Will be good to have utility like this on btrfs snapper package.

@aschnell
Copy link
Member

With btrfs qgroups (quota groups) this is possible. Unfortunately qgroups are not mature yet.

@MurzNN
Copy link
Author

MurzNN commented Mar 10, 2014

Thanks, for the info, qgroups is exactly that I want.

On Ubuntu 13.10 qgroups works well out of the box (btrfs-tools Version: 0.19+20130705-1):

# btrfs quota enable /btrfs/ 
# btrfs qgroup show /btrfs/
0/5 4698025984 8192
0/257 52432896 4096
0/263 4405821440
12288 0/264
4698025984 8192 

But this output is raw and too hard to understand. Here http://dustymabe.com/2013/09/22/btrfs-how-big-are-my-snapshots/ I can find article with script that convert this info into human-readable report:

# btrfs qgroup show /btrfs/ | /root/convert
0/5 4480M 0M
0/257 50M 0M
0/263 4201M 0M
0/264 4480M 0M

This is better, but will be good to see snapper snapshot names instead of id in it.

Can you integrate this snapshot use size report into snapper? If btrfs-tools version is not fresh, you can show warning that this is not supported.

@aschnell
Copy link
Member

The output is already better in newer versions of btrfsprogs, e.g.:

f17:~ # btrfs qgroup show /
qgroupid rfer       excl                 
-------- ----       ----                 
0/5      16384      16384                
0/257    2940633088 -20557824            
0/258    2387968    2387968              
0/259    16384      16384                
0/260    16384      16384                

I want to integrate that in snapper but for me the qgroups are not mature, e.g. see the negative number above!

@cmlsharp
Copy link

Try this oneliner:

sudo btrfs subvolume list / | sed 's///\//g' | awk '{print "sed "s/"$2 " /"$2 " " $9"/" "}' | while read line; do echo -n " ${line} |";done | sed 's/|$/\n/' | sed 's/^/sudo btrfs qgroup show / |/' | source /dev/stdin | sed 's/qgroupid/qgroupid subvol/' | awk 'NF>3' | column -t

@MurzNN
Copy link
Author

MurzNN commented Jan 13, 2016

Good tool for human-readable btrfs snapshot size report is btrfsQuota.py placed here: https://btrfs.wiki.kernel.org/index.php/Quota_support

@MurzNN
Copy link
Author

MurzNN commented Feb 18, 2016

Another tool for understanding btrfs snapshot size: https://poisonpacket.wordpress.com/2015/05/26/btrfs-snapshot-size-disk-usage/

@NicoHood
Copy link
Contributor

NicoHood commented Sep 8, 2016

I recently tried the snapper quota tool:
http://snapper.io/2016/05/18/space-aware-cleanup.html

However with get-config my QGROUP setting is empty as before, even though I ran setup-quota. What is also unclear to me is the meaning of 1/0. And finally where can I set what the maximum disk usage is? Its written about 50% but where can i set this? Does 2-10 then mean: "keep maximum 10 snapshots, but if quota shows high disk usage reduce to minum 2 snapshots?

@HalisCz
Copy link

HalisCz commented Aug 19, 2018

Is there any upgrade on this? I am using snapper on btrfs, but getting snapshot's size is impossible with snapper itself, although I am convinced that snapper should be aware of the snapshot size.

@aschnell
Copy link
Member

aschnell commented Oct 5, 2018

For every snapshot snapper now shows the exclusive space of the corresponding btrfs qgroup, see http://snapper.io/2018/10/04/used-space.html.

@aschnell aschnell closed this as completed Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants