본문 바로가기

Backend Study/Server

[리눅스] 용량부족 해결

EC2에서 파일을 작성하려니 이런 오류가 생겼다. 

오류 :

E: Write error - write (28: No space left on device)

E: IO Error saving source cache

E: The package lists or status file could not be parsed or opened.

 

에러 문구를 확인한 후  바로 디스크 용량 부족을 체크하였다.

 

1. Inode 체크

df -i

 

2. 디스크 용량 체크

df -h

/ 경로와 snap 관련 경로의 용량이 문제 있어 보인다.

 

3. 구글링을 통해서 찾으니..

sudo apt autoremove --purge snapd

통해서 snapd 삭제 가능하다고 함. 

 

Reading package lists... Error!

E: Write error - write (28: No space left on device)

E: IO Error saving source cache

E: The package lists or status file could not be parsed or opened.

root@ip-172-31-47-200:/var/log# for i in /*; do echo $i; find $i |wc -l; done

 

동일한 문제가 발생한다 ㅜㅜ

 

4. 필요없는 파일 우선 삭제

du -sh *

로그를 많이 삭제했지만, 여전히 Use가 100%

 

5. 리눅스의 특정 서비스나 프로세스가 불필요하게 더미데이터를 가진 경우가 있다고해서 Isof로 불필요한 PID 죽이기. 

 

 lsof /   로 확인 

kill -9 포트번호

-> 해결 안됨

 

6.  find /home/ubuntu -size +100000 -print

명령어 사용해서 용량이 큰 파일 찾은 후 삭제

임시 방편으로 97%로 바꾸어둠. 

7.  sudo apt autoremove --purge snapd

snapd 삭제해주는 명령어

오류: 

You might want to run 'apt --fix-broken install' to correct these.

The following packages have unmet dependencies:

 linux-headers-5.4.0-1081-aws : Depends: linux-aws-5.4-headers-5.4.0-1081 but it is not going to be installed

E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

 

의존성 문제로 판단

 

8. apt --fix-broken install 명령어로 해결 후 다시  sudo apt autoremove --purge snapd 실행

성공 !! !!!! !!!! ㅠㅠ