Re:Where has my disk space gone? Flame graphs for file systems
by foxhop on Sunday February 05, 2017 @05:57PM
(#13575223)
[ Parent
| on HN ]
Re:Where has my disk space gone? Flame graphs for file systems
by slavik81 on Sunday February 05, 2017 @06:53PM
(#13575487)
It takes careful inspection to notice the big folders when the units vary. A 25G folder is much larger than both a 43M folder and a 256K folder, but it's not obvious at a glance when you have a big list.
Human-readable units are nice, but without them it's easier to sort by size.
du -s * | sort -n
Re:Where has my disk space gone? Flame graphs for file systems
by diafygi on Sunday February 05, 2017 @07:06PM
(#13575537)
sort supports human values
du -sh * | sort -h
Re:Where has my disk space gone? Flame graphs for file systems
by oneeyedpigeon on Sunday February 05, 2017 @08:10PM
(#13575794)
Not here :( What version of sort are you running?
Re:Where has my disk space gone? Flame graphs for file systems
by davejamesmiller on Monday February 06, 2017 @08:38AM
(#13579259)
It can also be achieved with some Perl:
du -h | perl -e 'sub h{%h=(K=>10,M=>20,G=>30);($n,$u)=shift=~/([0-9.]+)(\D)/; return $n*2**$h{$u}}print sort{h($b)<=>h($a)}<>;'
Source: http://serverfault.com/a/62422/76878
Re:Where has my disk space gone? Flame graphs for file systems
by e12e on Monday February 06, 2017 @02:03AM
(#13577204)
Probably a recent version of GNU sort. AFAIK "sort -h" dates at least as far back as the version shipped with Debian old-stable.
Re:Where has my disk space gone? Flame graphs for file systems
by oneeyedpigeon on Monday February 06, 2017 @06:57AM
(#13578634)
I'm on macOS 10.12.3, GNU coreutils 5.93, and sort doesn't support the "-h" flag.
Re:Where has my disk space gone? Flame graphs for file systems
by justinsaccount on Monday February 06, 2017 @08:33AM
(#13579224)
You're using a version of coreutils from over a decade ago.
coreutils-5.93.tar.bz2 2005-11-06 09:06
Re:Where has my disk space gone? Flame graphs for file systems
by james2vegas on Monday February 06, 2017 @09:30PM
(#13586461)
set BLOCKSIZE to some power of 1024 when running du
Re:Where has my disk space gone? Flame graphs for file systems
by diegorbaquero on Sunday February 05, 2017 @08:18PM
(#13575838)
Not in Mac :/
Re:Where has my disk space gone? Flame graphs for file systems
by kpil on Monday February 06, 2017 @03:30AM
(#13577590)
That's BSD's sort, not GNU sort, isn't it?
Re:Where has my disk space gone? Flame graphs for file systems
by brendangregg on Sunday February 05, 2017 @06:03PM
(#13575258)
I'd try that first, and if it didn't find my space, then flame graphs.
du's output does the first level of directories, but not subdirectories, and also requires reading of text rather than visually comparing line lengths (easier).
Re:Where has my disk space gone? Flame graphs for file systems
by foxhop on Sunday February 05, 2017 @06:11PM
(#13575300)
You can quickly move toward the problem and continue to run 'du'.
Re:Where has my disk space gone? Flame graphs for file systems
by brendangregg on Sunday February 05, 2017 @07:04PM
(#13575529)
If I'm at the command line already, that may well work.
Or, it may not (the initial problem I had, I already knew the high level breakdowns, and was hunting for wasted 1%'s here and there -- the flame graph made it easy to spy everything at once).
Another use of the flame graph approach is with automated build software. Imagine automatically generating one with every linux version, to keep track of where growth is.