실제로 데이터로 채워진 파일 공칭 크기를 어떻게 출력합니까? 마찬가지로 vmtouch
쇼 얼마나 많은 파일은 현재 메모리에 …
워크 플로는 다음과 같습니다.
$ fallocate -l 1000000 data
$ measure_sparseness data
100%
$ fallocate -p -o 250000 -l 500000 data
$ measure_sparseness
50%
해결 방법 : 사용 du -bsh
및 du -sh
비교하십시오.
답변
find
이 %S
경우에도 “스파 스”라는 형식 지정자를
%S File's sparseness. This is calculated as (BLOCKSIZE*st_blocks / st_size). The exact value you will get for an ordinary file of a certain length is system-dependent. However, normally sparse files will have values less than 1.0, and files which use indirect blocks may have a value which is greater than 1.0. The value used for BLOCKSIZE is system-dependent, but is usually 512 bytes. If the file size is zero, the value printed is undefined. On systems which lack support for st_blocks, a file's sparseness is assumed to be 1.0.
$ fallocate -l 1000000 data
$ find data -printf '%S\n'
1.00352
$ fallocate -p -o 250000 -l 500000 data
$ find data -printf '%S\n'
0.507904
답변
당신이 경우 find
해당 옵션, 70 년대이기 때문에 UNIX에 일이있는 방법이 없습니다 :
ls -ls file
사용 된 실제 블록 수와 기록 된 가장 높은 바이트를 인쇄합니다. 이를 통해 실제로 할당되지 않은 블록 수를 쉽게 계산할 수 있습니다.