
꽤 빠른 디스크 사용 분석기가 작성되었습니다.
GDU는 주로 병렬 처리를 완전히 활용할 수있는 SSD 디스크 용입니다. 그러나 HDD도 작동하지만 성능 이득은 크지 않습니다.
릴리스 페이지로 가서 시스템의 바이너리를 다운로드하십시오.
컬 사용 :
curl -L https://github.com/dundee/gdu/releases/latest/download/gdu_linux_amd64.tgz | tar xz
chmod +x gdu_linux_amd64
mv gdu_linux_amd64 /usr/bin/gdu
시스템에 GDU를 설치하는 방법은 다른 방법은 설치 페이지를 참조하십시오.
또는 Docker를 통해 GDU를 직접 사용할 수 있습니다.
docker run --rm --init --interactive --tty --privileged --volume /:/mnt/root ghcr.io/dundee/gdu /mnt/root
gdu [flags] [directory_to_scan]
Flags:
--config-file string Read config from file (default is $HOME/.gdu.yaml)
-g, --const-gc Enable memory garbage collection during analysis with constant level set by GOGC
--enable-profiling Enable collection of profiling data and provide it on http://localhost:6060/debug/pprof/
-L, --follow-symlinks Follow symlinks for files, i.e. show the size of the file to which symlink points to (symlinks to directories are not followed)
-h, --help help for gdu
-i, --ignore-dirs strings Absolute paths to ignore (separated by comma) (default [/proc,/dev,/sys,/run])
-I, --ignore-dirs-pattern strings Absolute path patterns to ignore (separated by comma)
-X, --ignore-from string Read absolute path patterns to ignore from file
-f, --input-file string Import analysis from JSON file
-l, --log-file string Path to a logfile (default "/dev/null")
-m, --max-cores int Set max cores that Gdu will use. 12 cores available (default 12)
-c, --no-color Do not use colorized output
-x, --no-cross Do not cross filesystem boundaries
--no-delete Do not allow deletions
-H, --no-hidden Ignore hidden directories (beginning with dot)
--no-mouse Do not use mouse
--no-prefix Show sizes as raw numbers without any prefixes (SI or binary) in non-interactive mode
-p, --no-progress Do not show progress in non-interactive mode
-u, --no-unicode Do not use Unicode symbols (for size bar)
-n, --non-interactive Do not run in interactive mode
-o, --output-file string Export all info into file as JSON
-r, --read-from-storage Read analysis data from persistent key-value storage
--sequential Use sequential scanning (intended for rotating HDDs)
-a, --show-apparent-size Show apparent size
-d, --show-disks Show all mounted disks
-C, --show-item-count Show number of items in directory
-M, --show-mtime Show latest mtime of items in directory
-B, --show-relative-size Show relative size
--si Show sizes with decimal SI prefixes (kB, MB, GB) instead of binary prefixes (KiB, MiB, GiB)
--storage-path string Path to persistent key-value storage directory (default "/tmp/badger")
-s, --summarize Show only a total in non-interactive mode
-t, --top int Show only top X largest files in non-interactive mode
--use-storage Use persistent key-value storage for analysis data (experimental)
-v, --version Print version
--write-config Write current configuration to file (default is $HOME/.gdu.yaml)
Basic list of actions in interactive mode (show help modal for more):
↑ or k Move cursor up
↓ or j Move cursor down
→ or Enter or l Go to highlighted directory
← or h Go to parent directory
d Delete the selected file or directory
e Empty the selected directory
n Sort by name
s Sort by size
c Show number of items in directory
? Show help modal
gdu # analyze current dir
gdu -a # show apparent size instead of disk usage
gdu --no-delete # prevent write operations
gdu <some_dir_to_analyze> # analyze given dir
gdu -d # show all mounted disks
gdu -l ./gdu.log <some_dir> # write errors to log file
gdu -i /sys,/proc / # ignore some paths
gdu -I '.*[abc]+' # ignore paths by regular pattern
gdu -X ignore_file / # ignore paths by regular patterns from file
gdu -c / # use only white/gray/black colors
gdu -n / # only print stats, do not start interactive mode
gdu -np / # do not show progress, useful when using its output in a script
gdu -nps /some/dir # show only total usage for given dir
gdu -nt 10 / # show top 10 largest files
gdu / > file # write stats to file, do not start interactive mode
gdu -o- / | gzip -c >report.json.gz # write all info to JSON file for later analysis
zcat report.json.gz | gdu -f- # read analysis from file
GOGC=10 gdu -g --use-storage / # use persistent key-value storage for saving analysis data
gdu -r / # read saved analysis data from persistent key-value storage
GDU에는 인터랙티브 (기본값), 비 응체 및 수출의 세 가지 모드가 있습니다.
예를 들어 출력이 파일에 파이프를 입히거나 플래그를 사용하여 명시 적으로 시작할 수있는 경우 TTY가 감지되지 않으면 비 중환자 모드가 자동으로 시작됩니다.
내보내기 모드 (FLAG -o )는 모든 사용량 데이터를 JSON으로 출력하여 나중에 -f 플래그를 사용하여 열 수 있습니다.
하드 링크는 한 번만 계산됩니다.
파일 및 디렉토리는 다음과 같은 의미를 가진 1 차 문자 플래그에 의해 접두사를 할 수 있습니다.
! 이 디렉토리를 읽는 동안 오류가 발생했습니다.
. 하위 디렉토리를 읽는 동안 오류가 발생했으며 크기가 정확하지 않을 수 있습니다.
@ 파일은 Symlink 또는 소켓입니다.
H 동일한 파일이 이미 계산되었습니다 (하드 링크).
e 디렉토리는 비어 있습니다.
GDU는 YAML 구성 파일을 읽고 쓸 수 있습니다.
$HOME/.config/gdu/gdu.yaml 및 $HOME/.gdu.yaml 은 기본적으로 구성 파일의 사전도에 대해 확인됩니다.
모든 구성 옵션의 전체 목록을 참조하십시오.
echo "no-color: true" >> ~/.gdu.yaml
sorting:
by: name // size, name, itemCount, mtime
order: desc
echo "change-cwd: true" >> ~/.gdu.yaml
gdu --write-config
터미널을 채색 할 수있는 방법이 있습니다. 일부 GDU 프리미티브 (기본 텍스트와 같은)는 다른 색 스키마에 추가하지만 선택한/강조 표시된 행은 그렇지 않습니다.
기본 모양이 충분하지 않으면 구성 파일에서 변경할 수 있습니다.
style:
selected-row:
text-color: black
background-color: "#ff0000"
GDU는 백그라운드에서 항목을 삭제할 수 있으므로 추가 작업을 위해 UI를 차단하지 않습니다. 활성화 :
echo "delete-in-background: true" >> ~/.gdu.yaml
디렉토리 항목도 병렬로 삭제 될 수있어 삭제 속도가 높아질 수 있습니다. 활성화 :
echo "delete-in-parallel: true" >> ~/.gdu.yaml
GDU는 성능과 메모리 사용량의 균형을 유지하려고합니다.
호스트의 총 자유 메모리보다 GDU가 메모리를 적게 사용하는 경우 분석 단계에서 쓰레기 수집이 완전히 비활성화되어 최대 속도를 얻습니다.
그렇지 않으면 GC가 활성화됩니다. 메모리가 많을수록 메모리가 더 적을수록 GC가 더 자주 발생합니다.
쓰레기 수집에 대한 수동 제어를 원한다면 --const-gc / -g 플래그를 사용할 수 있습니다. 분석 단계에서 일정한 수준의 공격성으로 쓰레기 수집을 실행합니다. 결과적으로 분석은 약 25% 느리고 메모리가 약 30% 줄어 듭니다. 레벨을 변경하려면 GOGC 환경 변수를 설정하여 쓰레기 수집이 얼마나 자주 발생하는지 지정할 수 있습니다. 낮은 값 (100 이하)은 GC가 더 자주 실행된다는 것을 의미합니다. 더 높은 수단은 자주 덜 의미합니다. 음수는 GC를 중지합니다.
일정한 GC로 GDU를 실행하는 예이지만 기본값만큼 공격적이지는 않습니다.
GOGC=200 gdu -g /
GDU는 분석 데이터를 메모리 대신 지속적인 키 가치 저장소에 저장할 수 있습니다. GDU는 훨씬 느리게 실행되지만 (약 10 배) 메모리를 훨씬 적게 사용해야합니다 (작은 GOGC를 사용할 때도). GDU는 저장된 데이터로 다시 열 수도 있습니다. 현재 BadgerDB만이 키 값 저장소 (내장)로 지원됩니다.
GOGC=10 gdu -g --use-storage / # saves analysis data to key-value storage
gdu -r / # reads just saved data, does not run analysis again
make install-dev-dependencies
make test
GDU는 --enable-profiling 플래그가 설정되면 프로파일 링 데이터를 수집 할 수 있습니다. 데이터는 url http://localhost:6060/debug/pprof/ 임베디드 HTTP 서버를 통해 제공됩니다.
그런 다음 예를 들어 go tool pprof -web http://localhost:6060/debug/pprof/heap 사용하여 웹 브라우저에서 힙 프로파일을 SVG 이미지로 열 수 있습니다.
하이퍼 핀을 사용하여 500GB SSD에서 50G 디렉토리 (100K 디렉토리, 400K 파일)에서 벤치 마크를 수행했습니다. 자세한 내용은 MakeFile의 benchmark 대상을 참조하십시오.
파일 시스템 캐시는 sync; echo 3 | sudo tee /proc/sys/vm/drop_caches .
| 명령 | 수단] | 민 [S] | 맥스 [S] | 상대적인 |
|---|---|---|---|---|
diskus ~ | 3.126 ± 0.020 | 3.087 | 3.155 | 1.00 |
gdu -npc ~ | 3.132 ± 0.019 | 3.111 | 3.173 | 1.00 ± 0.01 |
gdu -gnpc ~ | 3.136 ± 0.012 | 3.112 | 3.155 | 1.00 ± 0.01 |
pdu ~ | 3.657 ± 0.013 | 3.641 | 3.677 | 1.17 ± 0.01 |
dust -d0 ~ | 3.933 ± 0.144 | 3.849 | 4.213 | 1.26 ± 0.05 |
dua ~ | 3.994 ± 0.073 | 3.827 | 4.134 | 1.28 ± 0.02 |
gdu -npc --use-storage ~ | 12.812 ± 0.078 | 12.644 | 12.912 | 4.10 ± 0.04 |
du -hs ~ | 14.120 ± 0.213 | 13.969 | 14.703 | 4.52 ± 0.07 |
duc index ~ | 14.567 ± 0.080 | 14.385 | 14.657 | 4.66 ± 0.04 |
ncdu -0 -o /dev/null ~ | 14.963 ± 0.254 | 14.759 | 15.637 | 4.79 ± 0.09 |
| 명령 | 평균 [MS] | Min [MS] | MAX [MS] | 상대적인 |
|---|---|---|---|---|
pdu ~ | 226.6 ± 3.7 | 219.6 | 231.2 | 1.00 |
diskus ~ | 227.7 ± 5.2 | 221.6 | 239.9 | 1.00 ± 0.03 |
dust -d0 ~ | 400.1 ± 7.1 | 386.7 | 409.4 | 1.77 ± 0.04 |
dua ~ | 444.9 ± 2.4 | 442.4 | 448.9 | 1.96 ± 0.03 |
gdu -npc ~ | 451.3 ± 3.8 | 445.9 | 458.5 | 1.99 ± 0.04 |
gdu -gnpc ~ | 516.1 ± 6.7 | 503.1 | 527.5 | 2.28 ± 0.05 |
du -hs ~ | 905.0 ± 3.9 | 901.2 | 913.4 | 3.99 ± 0.07 |
duc index ~ | 1053.0 ± 5.1 | 1046.2 | 1064.1 | 4.65 ± 0.08 |
ncdu -0 -o /dev/null ~ | 1653.9 ± 5.7 | 1645.9 | 1663.0 | 7.30 ± 0.12 |
gdu -npc --use-storage ~ | 9754.9 ± 688.7 | 8403.8 | 10427.4 | 43.04 ± 3.12 |
C (LTS) 또는 zig (안정)로 작성되었습니다.Rust 도구Rust 로 작성된 매우 간단하지만 매우 빠른 도구Rust 에 쓰여진 도구Rust 에 쓰여진 도구 Nikita Golubev -Flaticon이 만든 HDD 아이콘