du -h -d 2 / 는 NFS 마운트나 /proc 까지 훑어 오래 걸린다. 제외 옵션과 파일시스템 경계 옵션을 함께 쓴다.
# 특정 경로 제외
du -h -d 2 / --exclude=/proc --exclude=/sys --exclude=/mnt --exclude=/nas
# 다른 파일시스템으로 넘어가지 않음 (NFS · 별도 마운트 자동 제외)
du -h -d 2 -x /
# 큰 것부터
du -h -d 2 -x / 2>/dev/null | sort -rh | head -20
2>/dev/null 로 권한 없는 경로의 오류를 지운다.
ls -ltr <dir> # 오래된 것부터
ls -lt <dir> | head -20 # 최신 20 개
find <dir> -type f -newermt "2026-04-01" ! -newermt "2026-04-15" # 날짜 범위
find <dir> -type f -printf '%TY-%Tm-%Td %s %p\n' | sort | head # 시각 · 크기 · 경로
find <dir> -type f -printf '%s %p\n' | sort -rn | head -20 # 큰 파일
Ambari Agent 가 서버에서 받은 명령과 실행 결과를 로컬에 남기는 디렉터리다. 자동 정리가 되지 않아 계속 쌓인다.
| 파일 | 내용 |
|---|---|
command-*.json |
Ambari Server 가 보낸 명령 |
status_command_result-*.json |
서비스 상태 점검 결과 |
structured-out-*.json |
컴포넌트별 상세 출력 |
*-output.txt, *-error.txt |
명령 실행 stdout · stderr |
ls /var/lib/ambari-agent/data/ | wc -l
ls /var/lib/ambari-agent/data/ | sed 's/.*\.//' | sort | uniq -c | sort -rn
ls -ltr /var/lib/ambari-agent/data/ | head -20
정리는 오래된 것부터 지운다. 최근 며칠은 장애 분석에 필요하므로 남긴다.
# 7 일보다 오래된 것 삭제 (먼저 목록으로 확인)
find /var/lib/ambari-agent/data/ -type f -mtime +7 -name '*.json' | head
find /var/lib/ambari-agent/data/ -type f -mtime +7 \( -name '*.json' -o -name '*output*.txt' \) -delete
주기적으로 돌리려면 logrotate 나 cron 에 등록한다. Agent 를 멈출 필요는 없다.