No space left on device
lastmod 2024-09-25created 2024-09-254 edits
An error message that appears when the disk has no space left.
inode ?
So an inode is the unit for handling files. It is the unit for handling files, and it is a data structure.
How many of those inodes can be created depends on the file system type of the root file system currently in use. In our case it is ext4. Whether you format with exd4 or with btrfs, each file system format has a number of inodes, that is, a number of inodes within an available range. If you exceed that number, there is still physical space where actual file blocks could go, but because the inodes are full, the same no space error can occur.
Solution
If checking with df shows that there is actually space left but No space left on device keeps appearing, use df -i to check the inodes.
Since an inode is the unit for handling files, having too many files is also a problem, so it also helps to combine find and wc to find and remove folders with too many files.
Checking the disk
df -h
## 명령어를 입력해 확인해보니 디스크를 모두 사용하고 있는걸 확인할 수 있었다.
df -i
## 명령어는 inode 공간을 확인하는 명령어이다. (inode의 자세한 내용은 참고자료에 있다.)
Find the folders using the most space and delete unneeded files.
Finding
du -sh *
## 해당 경로에서 바로 용량 확인하기
du -h --max-depth=1
## 폴더별 용량 sort해서 보기
du -hs * | sort -rh | head -5
Emptying log files
## kern.log 용량 0으로 바꾸기
cat /dev/null > /var/log/kern.log
## syslog 용량 0으로 바꾸기
cat /dev/null > /var/log/syslog
## 나머지 삭제 등등
sudo rm -rf syslog.*
Emptying the trash
Docker
It may be an inode problem. You can check with df -i.
Checking the problem in Docker:
-
docker system df -v -
docker volume prune- remove unused volumes -
docker container prune- remove unused containers -
docker image prune- remove unused images -
docker system prune- remove all unused images, containers, and volumes
See also
Favorite site
- No space left on device / Fixing the "no space left on device" symptom
- (Linux) Fixing No space left on device
- Ubuntu - How to deal with the "No space left on device" error
- File creation no space left on device error | Tencent Cloud