![Linux의 디스크 공간 부족](https://rvso.com/image/1475805/Linux%EC%9D%98%20%EB%94%94%EC%8A%A4%ED%81%AC%20%EA%B3%B5%EA%B0%84%20%EB%B6%80%EC%A1%B1.png)
디스크 공간이 부족합니다(10GB 중 71% 사용).
df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 9.8G 6.5G 2.8G 71% /
udev 10M 0 10M 0% /dev
tmpfs 3.0G 128K 3.0G 1% /run
/dev/disk/by-uuid/af9b99b8-9f61-4eee-aa51-d5113368814d 9.8G 6.5G 2.8G 71% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 6.0G 0 6.0G 0% /run/shm
tmpfs 1.0G 6.1M 1018M 1% /mnt/tmp
하지만 확인하기 위해 이 명령을 실행하면 1.5G만 사용됩니다.
sudo du --all --one-file-system / | awk '{if($1 > 102400) print int($1/1024) "MB" " " $2 }'
117MB /var/cache/apt/archives
164MB /var/cache/apt
168MB /var/cache
132MB /var/lib/apt/lists
132MB /var/lib/apt
148MB /var/lib
416MB /var
115MB /lib/modules/3.16.0-0.bpo.4-amd64/kernel/drivers
159MB /lib/modules/3.16.0-0.bpo.4-amd64/kernel
163MB /lib/modules/3.16.0-0.bpo.4-amd64
163MB /lib/modules
175MB /lib
223MB /usr/lib
146MB /usr/local/lib
106MB /usr/local/share
267MB /usr/local
199MB /usr/share
754MB /usr
1541MB /
어떤 아이디어가 있나요?
답변1
프로세스에 삭제된 대용량 파일에 대한 열린 파일 핸들이 있는 경우 디스크 사용량에는 계속 표시되지만 파일에 액세스할 수 없으며 아래에 표시되지 않습니다 du
.
# Create large file
$ df .
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk0s2 1951845952 284650968 1666682984 15% 35645369 208335373 15% /
$ du -s
2604488 .
# Remove the file -note how the du result decreases
$ rm junk
$ df .
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk0s2 1951845952 285526568 1665807384 15% 35754819 208225923 15% /
$ du -s
61728 .
# Kill the process holding the file - now the df usage decreases
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk0s2 1951845952 282561000 1668772952 15% 35384123 208596619 15% /
$ du -s
61736 .