nachoparker / btrfs-du

Easily print BTRFS subvolume/snapshot disk usage
GNU General Public License v3.0
112 stars 17 forks source link

size reporting still a bit off #6

Open nachoparker opened 6 years ago

nachoparker commented 6 years ago

@jpluimers, doing some quick testing of the new version

$ sudo ~/src/btrfs-du/btrfs-du .
Subvolume                                                         Total  Exclusive  ID
─────────────────────────────────────────────────────────────────────────────────────────
.snap2                                                          4.00GiB    2.00GiB  266
.snap3                                                          3.00GiB 1024.01MiB  268
─────────────────────────────────────────────────────────────────────────────────────────
Total exclusive data                                                            2.00GiB

$ sudo btrfs qgroup show .
qgroupid         rfer         excl
--------         ----         ----
0/5          16.00KiB     16.00KiB
0/261           0.00B        0.00B
0/266         4.00GiB      2.00GiB
0/268         3.00GiB      1.00GiB

$ sudo btrfs qgroup show --raw .
qgroupid         rfer         excl
--------         ----         ----
0/5             16384        16384
0/261               0            0
0/266      4294983680   2147500032
0/268      3221241856   1073758208

$ tree -L 2 --du -h 
.
├── [4.0G]  .snap2
│   ├── [   0]  .snap1
│   ├── [2.0G]  img
│   └── [2.0G]  img1
└── [3.0G]  .snap3
    ├── [   0]  .snap1
    ├── [   0]  .snap2
    ├── [2.0G]  img1
    └── [1.0G]  img2

 7.0G used in 5 directories, 4 files

I think this 1024.01MiB has some small rounding error

nachoparker commented 6 years ago

some more comments: I like the new alignment, except for the latest line. Just pushed a small tweak, I hope you like it ( it shows in the above output )

jpluimers commented 6 years ago

I think it's better to use GiB than MiB for this. Which means I need to document the bash function and write more test cases in https://gist.github.com/jpluimers/0f21bf1d937fe0b9b4044f21944a90ec

I aligned the last line under the "Exclusive" for two reasons: readability and easier post-processing as "fixed width" format in for instance spreadsheets

nachoparker commented 6 years ago

well, it's really a small detail, just wanted to bring it to your attention

really not important