Created
June 28, 2022 11:18
-
-
Save jtagcat/74e3220552bc70767209447ca9d7397c to your computer and use it in GitHub Desktop.
Add excluded size from zfs to ncdu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RDIR="tank/foo" | |
ncdu_dir=. | |
dsize_bar="$("$ZFS" list -Hp -o usedds "$RDIR/bar")" | |
ncdu -0o- "/$RDIR" --exclude=bar \ | |
| sed 's/{"name":"bar","dev":0,"ino":0,"excluded":"pattern"}'\ | |
'/{"name":"bar","dev":0,"ino":0,"excluded":"pattern","dsize":'"$dsize_bar"'}/' \ | |
| gzip > "$ncdu_dir/$(date -uI).ncdu.gz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, I tried JSONpatch, it can't do this. There is no
selecŧ
, as there is in jq. sed and roll!Appears like so (foo is lc):
ncdu (footer)
Total size
includes the patched value, apparent size does not (no size parameter).zfs list -o used
does not offer the same used as ncdu size.