/usr에서 du 출력이 일관되지 않습니다.

/usr에서 du 출력이 일관되지 않습니다.

먼저 /usr의 크기는 다음과 같습니다.

$ sudo du -sh /usr
6.2G    /usr
$

du의 디렉토리에서 를 수행 /하고 을 선택 하면 /usr다음과 같은 결과가 나타납니다.

$ sudo du -sh /*/ | grep /usr
du: cannot access '/proc/1800845/task/1800845/fd/4': No such file or directory
du: cannot access '/proc/1800845/task/1800845/fdinfo/4': No such file or directory
du: cannot access '/proc/1800845/fd/3': No such file or directory
du: cannot access '/proc/1800845/fdinfo/3': No such file or directory
2.5G    /usr/
$

EDIT0 : 확장 /*/ :

$ sudo du -sh /bdd/ /bin/ /boot/ /data/ /dev/ /etc/ /home/ /lib/ /lib32/ /lib64/ /libx32/ /lost+found/ /media/ /mnt/ /opt/ /proc/ /root/ /run/ /sbin/ /snap/ /srv/ /sys/ /tmp/ /usr/ /var/ / | grep /usr
du: cannot access '/proc/1807041/task/1807041/fd/4': No such file or directory
du: cannot access '/proc/1807041/task/1807041/fdinfo/4': No such file or directory
du: cannot access '/proc/1807041/fd/3': No such file or directory
du: cannot access '/proc/1807041/fdinfo/3': No such file or directory
2.5G    /usr/
$ \ls -ld /lib /lib32 /lib64 /libx32
lrwxrwxrwx 1 root root  7 Mar 17  2023 /lib -> usr/lib
lrwxrwxrwx 1 root root  9 Mar 17  2023 /lib32 -> usr/lib32
lrwxrwxrwx 1 root root  9 Mar 17  2023 /lib64 -> usr/lib64
lrwxrwxrwx 1 root root 10 Mar 17  2023 /libx32 -> usr/libx32
$ \ls -ld /lib/ /lib32/ /lib64/ /libx32/
drwxr-xr-x 98 root root 4096 Jan 30 06:25 /lib/
drwxr-xr-x  2 root root 4096 Mar 17  2023 /lib32/
drwxr-xr-x  2 root root 4096 Jan 11 06:22 /lib64/
drwxr-xr-x  2 root root 4096 Mar 17  2023 /libx32/
$ sudo du -xsh /lib/
3.5G    /lib/
$

출력이 일관되지 않는 이유는 무엇입니까 du?

답변1

du여러 번 발견된 경우에도 각 파일을 한 번만 계산합니다.

첫 번째 명령은 를 선택합니다 /bin. 요즘에는 일반적으로심볼릭 링크따라서 /usr/bin/bin 내용은 다음과 같습니다.또한/usr 내용입니다. 목록의 첫 번째 항목이기 때문에 해당 파일은 처음 발견될 때 /bin으로 간주되고 다음에 /usr이 측정될 때 무시됩니다.

예 - 총합이 어느 쪽이든 23G인지 확인하세요.

# du -hsc /usr/
23G     /usr/
23G     total

# du -hsc /bin/ /usr/
2.6G    /bin/
20G     /usr/
23G     total

# ls -ld /bin /usr
lrwxrwxrwx 1 root root   7 Jan 19 19:10 /bin -> usr/bin/
drwxr-xr-x 1 root root 112 Feb 20 07:23 /usr/

관련 정보