시그마 삽질==six 시그마

리눅스 디스크 용량 확인(df/ du) 본문

프로그래밍/Linux

리눅스 디스크 용량 확인(df/ du)

Ethan Matthew Hunt 2020. 3. 15. 11:50

 

-디스크의 남은 용량을 확인

df
 (abbreviation for disk free) is a standard Unix command used to display the amount of available disk space for file systems on which the invoking user has appropriate read access.


- 디렉토리별 사용량을 확인 

du (abbreviated from disk usage) is a standard Unix program used to estimate file space usage—space used under a particular directory or files on a file system.

wikipedia

 

 

 

지금은 도커를 통해 CICD를 하지만 

 

예전에는 젠킨스를 사용하여 배포를 진행했다.

 

젠킨스를 통해 빌드하면 간혹 하단과 같은 에러가 발생했는데

 

계속 쌓였던 war로 인해 디스크 공간이 차서 발생한 에러였다.

 

ERROR: Processing failed due to a bug in the code. Please report this to the issue tracker (https://jenkins.io/redirect/report-an-issue). 
Failed to copy /home/tomcat/.jenkins/workspace/..../target/.....war to /home/tomcat/.jenkins/jobs/modules/.....-0.0.1-SNAPSHOT.war due to No space left on device

 

 

그럴땐

cd  ./.jenkins/jobs/
여기안에 있는 불필요한 war 삭제
find . -name "*.war" -exec rm -rf {} \;

 


/dev/xvda1가 원래는 100%였으나 

 

삭제후 디스크 용량을 조회하면

[ec2-user@ip-10-20-0-67 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        993M   56K  992M   1% /dev
tmpfs          1001M     0 1001M   0% /dev/shm
/dev/xvda1       30G  6.5G   23G  22% /



df : 디스크의 남은 용량을 확인 
df -k : 킬로바이트 단위로 현재 남은 용량을 확인
df -m : 메가바이트 단위로 남은 용량을 왁인 
df -h : 보기 좋게 보여줌
df . : 현재 디렉토리가 포함된 파티션의 남은 용량을 확인

 

 

[ec2-user@ip-10-20-0-67 ~]$ du -h
218M    ./project
8.0K    ./.oracle_jre_usage
12K     ./.ssh
218M    .

du : 현재 디렉토리에서 서브디렉토리까지의 사용량을 확인 
du -a : 현재 디렉토리의 사용량을 파일단위 출력
du -s : 총 사용량을 확인
du -h : 보기 좋게 바꿔줌 
du -sh * : 한단계 서브디렉토리 기준으로 보여준다.

'프로그래밍 > Linux' 카테고리의 다른 글

Linux crontab  (0) 2020.03.17
RPM & YUM  (0) 2020.03.16
리눅스 폴더 찾기, 파일 찾기, 문자열 찾기  (0) 2020.03.14
리눅스 네트워크 설정 파일  (0) 2020.03.14
리눅스 SCP 사용법  (0) 2020.03.14
Comments